diff options
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hugo/display.cpp | 107 | ||||
-rw-r--r-- | engines/hugo/display_v1d.cpp | 100 | ||||
-rw-r--r-- | engines/hugo/display_v1w.cpp | 94 | ||||
-rw-r--r-- | engines/hugo/intro.cpp | 362 | ||||
-rw-r--r-- | engines/hugo/intro_v1d.cpp | 189 | ||||
-rw-r--r-- | engines/hugo/intro_v1w.cpp | 62 | ||||
-rw-r--r-- | engines/hugo/intro_v2d.cpp | 87 | ||||
-rw-r--r-- | engines/hugo/intro_v2w.cpp | 63 | ||||
-rw-r--r-- | engines/hugo/intro_v3d.cpp | 117 | ||||
-rw-r--r-- | engines/hugo/intro_v3w.cpp | 97 | ||||
-rw-r--r-- | engines/hugo/module.mk | 12 | ||||
-rw-r--r-- | engines/hugo/schedule.cpp | 235 | ||||
-rw-r--r-- | engines/hugo/schedule_v1d.cpp | 147 | ||||
-rw-r--r-- | engines/hugo/schedule_v1w.cpp | 76 | ||||
-rw-r--r-- | engines/hugo/schedule_v2d.cpp | 142 | ||||
-rw-r--r-- | engines/hugo/schedule_v3d.cpp | 60 |
16 files changed, 704 insertions, 1246 deletions
diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp index 0c580c15cc..f55d2ede2a 100644 --- a/engines/hugo/display.cpp +++ b/engines/hugo/display.cpp @@ -594,5 +594,112 @@ void Screen::showCursor() { void Screen::hideCursor() { CursorMan.showMouse(false); } + +Screen_v1d::Screen_v1d(HugoEngine *vm) : Screen(vm) { +} + +Screen_v1d::~Screen_v1d() { +} + +/** +* Load font file, construct font ptrs and reverse data bytes +* TODO: This uses hardcoded fonts in hugo.dat, it should be replaced +* by a proper implementation of .FON files +*/ +void Screen_v1d::loadFont(int16 fontId) { + debugC(2, kDebugDisplay, "loadFont(%d)", fontId); + + assert(fontId < NUM_FONTS); + + _fnt = fontId - FIRST_FONT; // Set current font number + + if (fontLoadedFl[_fnt]) // If already loaded, return + return; + + fontLoadedFl[_fnt] = true; + + memcpy(_fontdata[_fnt], _arrayFont[_fnt], _arrayFontSize[_fnt]); + _font[_fnt][0] = _fontdata[_fnt]; // Store height,width of fonts + + int16 offset = 2; // Start at fontdata[2] ([0],[1] used for height,width) + + // Setup the font array (127 characters) + for (int i = 1; i < 128; i++) { + _font[_fnt][i] = _fontdata[_fnt] + offset; + byte height = *(_fontdata[_fnt] + offset); + byte width = *(_fontdata[_fnt] + offset + 1); + + int16 size = height * ((width + 7) >> 3); + for (int j = 0; j < size; j++) + Utils::reverseByte(&_fontdata[_fnt][offset + 2 + j]); + + offset += 2 + size; + } +} + +/** +* Load fonts from Hugo.dat +* These fonts are a workaround to avoid handling TTF fonts used by DOS versions +* TODO: Properly handle the vector based font files (win31) +*/ +void Screen_v1d::loadFontArr(Common::File &in) { + for (int i = 0; i < NUM_FONTS; i++) { + _arrayFontSize[i] = in.readUint16BE(); + _arrayFont[i] = (byte *)malloc(sizeof(byte) * _arrayFontSize[i]); + for (int j = 0; j < _arrayFontSize[i]; j++) { + _arrayFont[i][j] = in.readByte(); + } + } +} + +Screen_v1w::Screen_v1w(HugoEngine *vm) : Screen(vm) { +} + +Screen_v1w::~Screen_v1w() { +} + +/** +* Load font file, construct font ptrs and reverse data bytes +*/ +void Screen_v1w::loadFont(int16 fontId) { + debugC(2, kDebugDisplay, "loadFont(%d)", fontId); + + _fnt = fontId - FIRST_FONT; // Set current font number + + if (fontLoadedFl[_fnt]) // If already loaded, return + return; + + fontLoadedFl[_fnt] = true; + _vm->_file->readUIFItem(fontId, _fontdata[_fnt]); + + // Compile font ptrs. Note: First ptr points to height,width of font + _font[_fnt][0] = _fontdata[_fnt]; // Store height,width of fonts + + int16 offset = 2; // Start at fontdata[2] ([0],[1] used for height,width) + + // Setup the font array (127 characters) + for (int i = 1; i < 128; i++) { + _font[_fnt][i] = _fontdata[_fnt] + offset; + byte height = *(_fontdata[_fnt] + offset); + byte width = *(_fontdata[_fnt] + offset + 1); + + int16 size = height * ((width + 7) >> 3); + for (int j = 0; j < size; j++) + Utils::reverseByte(&_fontdata[_fnt][offset + 2 + j]); + + offset += 2 + size; + } +} + +/** +* Skips the fonts used by the DOS versions +*/ +void Screen_v1w::loadFontArr(Common::File &in) { + for (int i = 0; i < NUM_FONTS; i++) { + uint16 numElem = in.readUint16BE(); + for (int j = 0; j < numElem; j++) + in.readByte(); + } +} } // End of namespace Hugo diff --git a/engines/hugo/display_v1d.cpp b/engines/hugo/display_v1d.cpp deleted file mode 100644 index 28c8e4407a..0000000000 --- a/engines/hugo/display_v1d.cpp +++ /dev/null @@ -1,100 +0,0 @@ -/* 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on original Hugo Trilogy source code - * - * Copyright (c) 1989-1995 David P. Gray - * - */ - -// Display.c - DIB related code for HUGOWIN - -#include "common/system.h" - -#include "hugo/hugo.h" -#include "hugo/display.h" -#include "hugo/util.h" - -namespace Hugo { - -Screen_v1d::Screen_v1d(HugoEngine *vm) : Screen(vm) { -} - -Screen_v1d::~Screen_v1d() { -} - -/** -* Load font file, construct font ptrs and reverse data bytes -* TODO: This uses hardcoded fonts in hugo.dat, it should be replaced -* by a proper implementation of .FON files -*/ -void Screen_v1d::loadFont(int16 fontId) { - debugC(2, kDebugDisplay, "loadFont(%d)", fontId); - - assert(fontId < NUM_FONTS); - - _fnt = fontId - FIRST_FONT; // Set current font number - - if (fontLoadedFl[_fnt]) // If already loaded, return - return; - - fontLoadedFl[_fnt] = true; - - memcpy(_fontdata[_fnt], _arrayFont[_fnt], _arrayFontSize[_fnt]); - _font[_fnt][0] = _fontdata[_fnt]; // Store height,width of fonts - - int16 offset = 2; // Start at fontdata[2] ([0],[1] used for height,width) - - // Setup the font array (127 characters) - for (int i = 1; i < 128; i++) { - _font[_fnt][i] = _fontdata[_fnt] + offset; - byte height = *(_fontdata[_fnt] + offset); - byte width = *(_fontdata[_fnt] + offset + 1); - - int16 size = height * ((width + 7) >> 3); - for (int j = 0; j < size; j++) - Utils::reverseByte(&_fontdata[_fnt][offset + 2 + j]); - - offset += 2 + size; - } -} - -/** -* Load fonts from Hugo.dat -* These fonts are a workaround to avoid handling TTF fonts used by DOS versions -* TODO: Properly handle the vector based font files (win31) -*/ -void Screen_v1d::loadFontArr(Common::File &in) { - for (int i = 0; i < NUM_FONTS; i++) { - _arrayFontSize[i] = in.readUint16BE(); - _arrayFont[i] = (byte *)malloc(sizeof(byte) * _arrayFontSize[i]); - for (int j = 0; j < _arrayFontSize[i]; j++) { - _arrayFont[i][j] = in.readByte(); - } - } -} -} // End of namespace Hugo - diff --git a/engines/hugo/display_v1w.cpp b/engines/hugo/display_v1w.cpp deleted file mode 100644 index 7cc94cc85a..0000000000 --- a/engines/hugo/display_v1w.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on original Hugo Trilogy source code - * - * Copyright (c) 1989-1995 David P. Gray - * - */ - -// Display.c - DIB related code for HUGOWIN - -#include "common/system.h" - -#include "hugo/hugo.h" -#include "hugo/display.h" -#include "hugo/file.h" -#include "hugo/util.h" - -namespace Hugo { - -Screen_v1w::Screen_v1w(HugoEngine *vm) : Screen(vm) { -} - -Screen_v1w::~Screen_v1w() { -} - -/** -* Load font file, construct font ptrs and reverse data bytes -*/ -void Screen_v1w::loadFont(int16 fontId) { - debugC(2, kDebugDisplay, "loadFont(%d)", fontId); - - _fnt = fontId - FIRST_FONT; // Set current font number - - if (fontLoadedFl[_fnt]) // If already loaded, return - return; - - fontLoadedFl[_fnt] = true; - _vm->_file->readUIFItem(fontId, _fontdata[_fnt]); - - // Compile font ptrs. Note: First ptr points to height,width of font - _font[_fnt][0] = _fontdata[_fnt]; // Store height,width of fonts - - int16 offset = 2; // Start at fontdata[2] ([0],[1] used for height,width) - - // Setup the font array (127 characters) - for (int i = 1; i < 128; i++) { - _font[_fnt][i] = _fontdata[_fnt] + offset; - byte height = *(_fontdata[_fnt] + offset); - byte width = *(_fontdata[_fnt] + offset + 1); - - int16 size = height * ((width + 7) >> 3); - for (int j = 0; j < size; j++) - Utils::reverseByte(&_fontdata[_fnt][offset + 2 + j]); - - offset += 2 + size; - } -} - -/** -* Skips the fonts used by the DOS versions -*/ -void Screen_v1w::loadFontArr(Common::File &in) { - for (int i = 0; i < NUM_FONTS; i++) { - uint16 numElem = in.readUint16BE(); - for (int j = 0; j < numElem; j++) - in.readByte(); - } -} -} // End of namespace Hugo - diff --git a/engines/hugo/intro.cpp b/engines/hugo/intro.cpp index d63a979fe1..9294c9a6af 100644 --- a/engines/hugo/intro.cpp +++ b/engines/hugo/intro.cpp @@ -34,6 +34,9 @@ #include "hugo/hugo.h" #include "hugo/intro.h" +#include "hugo/util.h" +#include "hugo/display.h" +#include "hugo/sound.h" namespace Hugo { @@ -43,4 +46,363 @@ IntroHandler::IntroHandler(HugoEngine *vm) : _vm(vm) { IntroHandler::~IntroHandler() { } +intro_v1d::intro_v1d(HugoEngine *vm) : IntroHandler(vm) { +} + +intro_v1d::~intro_v1d() { +} + +void intro_v1d::preNewGame() { +} + +void intro_v1d::introInit() { + introTicks = 0; + surf.w = 320; + surf.h = 200; + surf.pixels = _vm->_screen->getFrontBuffer(); + surf.pitch = 320; + surf.bytesPerPixel = 1; +} + +bool intro_v1d::introPlay() { + static int state = 0; + byte introSize = _vm->getIntroSize(); + + if (_vm->getGameStatus().skipIntroFl) + return true; + + if (introTicks < introSize) { + switch (state++) { + case 0: + _vm->_screen->drawRectangle(true, 0, 0, 319, 199, _TMAGENTA); + _vm->_screen->drawRectangle(true, 10, 10, 309, 189, _TBLACK); + break; + + case 1: + _vm->_screen->drawShape(20, 92,_TLIGHTMAGENTA,_TMAGENTA); + _vm->_screen->drawShape(250,92,_TLIGHTMAGENTA,_TMAGENTA); + + // TROMAN, size 10-5 + if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8))) + error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8"); + + char buffer[80]; + if (_boot.registered) + strcpy(buffer, "Registered Version"); + else + strcpy(buffer, "Shareware Version"); + + font.drawString(&surf, buffer, 0, 163, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + font.drawString(&surf, COPYRIGHT, 0, 176, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + + if (scumm_stricmp(_boot.distrib, "David P. Gray")) { + sprintf(buffer, "Distributed by %s.", _boot.distrib); + font.drawString(&surf, buffer, 0, 75, 320, _TMAGENTA, Graphics::kTextAlignCenter); + } + + // SCRIPT, size 24-16 + strcpy(buffer, "Hugo's"); + + if (font.loadFromFON("SCRIPT.FON")) { + font.drawString(&surf, buffer, 0, 20, 320, _TMAGENTA, Graphics::kTextAlignCenter); + } else { + // Workaround: SCRIPT.FON doesn't load properly at the moment + _vm->_screen->loadFont(2); + _vm->_screen->writeStr(CENTER, 20, buffer, _TMAGENTA); + } + + // TROMAN, size 30-24 + if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 24))) + error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 24"); + + strcpy(buffer, "House of Horrors !"); + font.drawString(&surf, buffer, 0, 50, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + break; + case 2: + _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); + + // TROMAN, size 16-9 + if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 14))) + error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 14"); + + strcpy(buffer, "S t a r r i n g :"); + font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); + break; + case 3: + // TROMAN, size 20-9 + if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 18))) + error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 18"); + + strcpy(buffer, "Hugo !"); + font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + break; + case 4: + _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); + + // TROMAN, size 16-9 + if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 14))) + error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 14"); + + strcpy(buffer, "P r o d u c e d b y :"); + font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); + break; + case 5: + // TROMAN size 16-9 + strcpy(buffer, "David P Gray !"); + font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + break; + case 6: + _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); + + // TROMAN, size 16-9 + strcpy(buffer, "D i r e c t e d b y :"); + font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); + break; + case 7: + // TROMAN, size 16-9 + strcpy(buffer, "David P Gray !"); + font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + break; + case 8: + _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); + + // TROMAN, size 16-9 + strcpy(buffer, "M u s i c b y :"); + font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); + break; + case 9: + // TROMAN, size 16-9 + strcpy(buffer, "David P Gray !"); + font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + break; + case 10: + _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); + + // TROMAN, size 20-14 + if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 18))) + error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 18"); + + strcpy(buffer, "E n j o y !"); + font.drawString(&surf, buffer, 0, 100, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); + break; + } + + _vm->_screen->displayBackground(); + g_system->updateScreen(); + g_system->delayMillis(1000); + } + + return (++introTicks >= introSize); +} + +intro_v2d::intro_v2d(HugoEngine *vm) : IntroHandler(vm) { +} + +intro_v2d::~intro_v2d() { +} + +void intro_v2d::preNewGame() { +} + +void intro_v2d::introInit() { + _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen + surf.w = 320; + surf.h = 200; + surf.pixels = _vm->_screen->getFrontBuffer(); + surf.pitch = 320; + surf.bytesPerPixel = 1; + + char buffer[128]; + + // TROMAN, size 10-5 + if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8))) + error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8"); + + if (_boot.registered) + sprintf(buffer, "%s Registered Version", COPYRIGHT); + else + sprintf(buffer, "%s Shareware Version", COPYRIGHT); + + font.drawString(&surf, buffer, 0, 186, 320, _TLIGHTRED, Graphics::kTextAlignCenter); + + if (scumm_stricmp(_boot.distrib, "David P. Gray")) { + // TROMAN, size 10-5 + sprintf(buffer, "Distributed by %s.", _boot.distrib); + font.drawString(&surf, buffer, 0, 1, 320, _TLIGHTRED, Graphics::kTextAlignCenter); + } + + _vm->_screen->displayBackground(); + g_system->updateScreen(); + g_system->delayMillis(5000); +} + +bool intro_v2d::introPlay() { + return true; +} + +intro_v3d::intro_v3d(HugoEngine *vm) : IntroHandler(vm) { +} + +intro_v3d::~intro_v3d() { +} + +void intro_v3d::preNewGame() { +} + +void intro_v3d::introInit() { + _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen + surf.w = 320; + surf.h = 200; + surf.pixels = _vm->_screen->getFrontBuffer(); + surf.pitch = 320; + surf.bytesPerPixel = 1; + + char buffer[128]; + if (_boot.registered) + sprintf(buffer, "%s Registered Version", COPYRIGHT); + else + sprintf(buffer,"%s Shareware Version", COPYRIGHT); + + // TROMAN, size 10-5 + if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8))) + error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8"); + + font.drawString(&surf, buffer, 0, 190, 320, _TBROWN, Graphics::kTextAlignCenter); + + if (scumm_stricmp(_boot.distrib, "David P. Gray")) { + sprintf(buffer, "Distributed by %s.", _boot.distrib); + font.drawString(&surf, buffer, 0, 0, 320, _TBROWN, Graphics::kTextAlignCenter); + } + + _vm->_screen->displayBackground(); + g_system->updateScreen(); + g_system->delayMillis(5000); + + _vm->_file->readBackground(22); // display screen MAP_3d + _vm->_screen->displayBackground(); + introTicks = 0; + _vm->_sound->DOSSongPtr = _vm->_sound->DOSIntroSong; +} + +/** +* Hugo 3 - Preamble screen before going into game. Draws path of Hugo's plane. +* Called every tick. Returns TRUE when complete +*/ +bool intro_v3d::introPlay() { + if (_vm->getGameStatus().skipIntroFl) + return true; + + if (introTicks < _vm->getIntroSize()) { + font.drawString(&surf, ".", _vm->_introX[introTicks], _vm->_introY[introTicks] - DIBOFF_Y, 320, _TBRIGHTWHITE); + _vm->_screen->displayBackground(); + + // Text boxes at various times + switch (introTicks) { + case 4: + Utils::Box(BOX_OK, "%s", _vm->_textIntro[kIntro1]); + break; + case 9: + Utils::Box(BOX_OK, "%s", _vm->_textIntro[kIntro2]); + break; + case 35: + Utils::Box(BOX_OK, "%s", _vm->_textIntro[kIntro3]); + break; + } + } + + return (++introTicks >= _vm->getIntroSize()); +} + +intro_v1w::intro_v1w(HugoEngine *vm) : IntroHandler(vm) { +} + +intro_v1w::~intro_v1w() { +} + +void intro_v1w::preNewGame() { + _vm->getGameStatus().viewState = V_INTROINIT; +} + +void intro_v1w::introInit() { +} + +bool intro_v1w::introPlay() { + return true; +} + +intro_v2w::intro_v2w(HugoEngine *vm) : IntroHandler(vm) { +} + +intro_v2w::~intro_v2w() { +} + +void intro_v2w::preNewGame() { +} + +void intro_v2w::introInit() { + _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen + + _vm->_screen->displayBackground(); + g_system->updateScreen(); + g_system->delayMillis(3000); +} + +bool intro_v2w::introPlay() { + return true; +} + +intro_v3w::intro_v3w(HugoEngine *vm) : IntroHandler(vm) { +} + +intro_v3w::~intro_v3w() { +} + +void intro_v3w::preNewGame() { +} + +/** +* Hugo 3 - show map and set up for introPlay() +*/ +void intro_v3w::introInit() { + + _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen + + _vm->_screen->displayBackground(); + g_system->updateScreen(); + g_system->delayMillis(3000); + _vm->_file->readBackground(22); // display screen MAP_3w + _vm->_screen->displayBackground(); + introTicks = 0; + _vm->_screen->loadFont(0); +} + +/** +* Hugo 3 - Preamble screen before going into game. Draws path of Hugo's plane. +* Called every tick. Returns TRUE when complete +*/ +bool intro_v3w::introPlay() { + if (_vm->getGameStatus().skipIntroFl) + return true; + + if (introTicks < _vm->getIntroSize()) { + // Scale viewport x_intro,y_intro to screen (offsetting y) + _vm->_screen->writeStr(_vm->_introX[introTicks], _vm->_introY[introTicks] - DIBOFF_Y, "x", _TBRIGHTWHITE); + _vm->_screen->displayBackground(); + + // Text boxes at various times + switch (introTicks) { + case 4: + Utils::Box(BOX_OK, "%s", _vm->_textIntro[kIntro1]); + break; + case 9: + Utils::Box(BOX_OK, "%s", _vm->_textIntro[kIntro2]); + break; + case 35: + Utils::Box(BOX_OK, "%s", _vm->_textIntro[kIntro3]); + break; + } + } + + return (++introTicks >= _vm->getIntroSize()); +} } // End of namespace Hugo diff --git a/engines/hugo/intro_v1d.cpp b/engines/hugo/intro_v1d.cpp deleted file mode 100644 index f04780eec9..0000000000 --- a/engines/hugo/intro_v1d.cpp +++ /dev/null @@ -1,189 +0,0 @@ -/* 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on original Hugo Trilogy source code - * - * Copyright (c) 1989-1995 David P. Gray - * - */ - -#include "common/system.h" - -#include "hugo/hugo.h" -#include "hugo/intro.h" -#include "hugo/display.h" - -namespace Hugo { -intro_v1d::intro_v1d(HugoEngine *vm) : IntroHandler(vm) { -} - -intro_v1d::~intro_v1d() { -} - -void intro_v1d::preNewGame() { -} - -void intro_v1d::introInit() { - introTicks = 0; - surf.w = 320; - surf.h = 200; - surf.pixels = _vm->_screen->getFrontBuffer(); - surf.pitch = 320; - surf.bytesPerPixel = 1; -} - -bool intro_v1d::introPlay() { - static int state = 0; - byte introSize = _vm->getIntroSize(); - - if (_vm->getGameStatus().skipIntroFl) - return true; - - if (introTicks < introSize) { - switch (state++) { - case 0: - _vm->_screen->drawRectangle(true, 0, 0, 319, 199, _TMAGENTA); - _vm->_screen->drawRectangle(true, 10, 10, 309, 189, _TBLACK); - break; - - case 1: - _vm->_screen->drawShape(20, 92,_TLIGHTMAGENTA,_TMAGENTA); - _vm->_screen->drawShape(250,92,_TLIGHTMAGENTA,_TMAGENTA); - - // TROMAN, size 10-5 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8))) - error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8"); - - char buffer[80]; - if (_boot.registered) - strcpy(buffer, "Registered Version"); - else - strcpy(buffer, "Shareware Version"); - - font.drawString(&surf, buffer, 0, 163, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); - font.drawString(&surf, COPYRIGHT, 0, 176, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); - - if (scumm_stricmp(_boot.distrib, "David P. Gray")) { - sprintf(buffer, "Distributed by %s.", _boot.distrib); - font.drawString(&surf, buffer, 0, 75, 320, _TMAGENTA, Graphics::kTextAlignCenter); - } - - // SCRIPT, size 24-16 - strcpy(buffer, "Hugo's"); - - if (font.loadFromFON("SCRIPT.FON")) { - font.drawString(&surf, buffer, 0, 20, 320, _TMAGENTA, Graphics::kTextAlignCenter); - } else { - // Workaround: SCRIPT.FON doesn't load properly at the moment - _vm->_screen->loadFont(2); - _vm->_screen->writeStr(CENTER, 20, buffer, _TMAGENTA); - } - - // TROMAN, size 30-24 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 24))) - error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 24"); - - strcpy(buffer, "House of Horrors !"); - font.drawString(&surf, buffer, 0, 50, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); - break; - case 2: - _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); - - // TROMAN, size 16-9 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 14))) - error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 14"); - - strcpy(buffer, "S t a r r i n g :"); - font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); - break; - case 3: - // TROMAN, size 20-9 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 18))) - error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 18"); - - strcpy(buffer, "Hugo !"); - font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); - break; - case 4: - _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); - - // TROMAN, size 16-9 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 14))) - error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 14"); - - strcpy(buffer, "P r o d u c e d b y :"); - font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); - break; - case 5: - // TROMAN size 16-9 - strcpy(buffer, "David P Gray !"); - font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); - break; - case 6: - _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); - - // TROMAN, size 16-9 - strcpy(buffer, "D i r e c t e d b y :"); - font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); - break; - case 7: - // TROMAN, size 16-9 - strcpy(buffer, "David P Gray !"); - font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); - break; - case 8: - _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); - - // TROMAN, size 16-9 - strcpy(buffer, "M u s i c b y :"); - font.drawString(&surf, buffer, 0, 95, 320, _TMAGENTA, Graphics::kTextAlignCenter); - break; - case 9: - // TROMAN, size 16-9 - strcpy(buffer, "David P Gray !"); - font.drawString(&surf, buffer, 0, 115, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); - break; - case 10: - _vm->_screen->drawRectangle(true, 82, 92, 237, 138, _TBLACK); - - // TROMAN, size 20-14 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 18))) - error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 18"); - - strcpy(buffer, "E n j o y !"); - font.drawString(&surf, buffer, 0, 100, 320, _TLIGHTMAGENTA, Graphics::kTextAlignCenter); - break; - } - - _vm->_screen->displayBackground(); - g_system->updateScreen(); - g_system->delayMillis(1000); - } - - return (++introTicks >= introSize); -} - -} // End of namespace Hugo diff --git a/engines/hugo/intro_v1w.cpp b/engines/hugo/intro_v1w.cpp deleted file mode 100644 index 923cd3658f..0000000000 --- a/engines/hugo/intro_v1w.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on original Hugo Trilogy source code - * - * Copyright (c) 1989-1995 David P. Gray - * - */ - -#include "common/system.h" - -#include "hugo/hugo.h" -#include "hugo/intro.h" -#include "hugo/file.h" - - - -namespace Hugo { -intro_v1w::intro_v1w(HugoEngine *vm) : IntroHandler(vm) { -} - -intro_v1w::~intro_v1w() { -} - -/** -* Auto-start a new game -*/ -void intro_v1w::preNewGame() { - _vm->getGameStatus().viewState = V_INTROINIT; -} - -void intro_v1w::introInit() { -} - -bool intro_v1w::introPlay() { - return true; -} - -} // End of namespace Hugo diff --git a/engines/hugo/intro_v2d.cpp b/engines/hugo/intro_v2d.cpp deleted file mode 100644 index 5e408a7608..0000000000 --- a/engines/hugo/intro_v2d.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on original Hugo Trilogy source code - * - * Copyright (c) 1989-1995 David P. Gray - * - */ - -#include "common/system.h" - -#include "hugo/hugo.h" -#include "hugo/intro.h" -#include "hugo/file.h" -#include "hugo/display.h" - -namespace Hugo { - -intro_v2d::intro_v2d(HugoEngine *vm) : IntroHandler(vm) { -} - -intro_v2d::~intro_v2d() { -} - -void intro_v2d::preNewGame() { -} - -void intro_v2d::introInit() { - _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen - surf.w = 320; - surf.h = 200; - surf.pixels = _vm->_screen->getFrontBuffer(); - surf.pitch = 320; - surf.bytesPerPixel = 1; - - char buffer[128]; - - // TROMAN, size 10-5 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8))) - error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8"); - - if (_boot.registered) - sprintf(buffer, "%s Registered Version", COPYRIGHT); - else - sprintf(buffer, "%s Shareware Version", COPYRIGHT); - - font.drawString(&surf, buffer, 0, 186, 320, _TLIGHTRED, Graphics::kTextAlignCenter); - - if (scumm_stricmp(_boot.distrib, "David P. Gray")) { - // TROMAN, size 10-5 - sprintf(buffer, "Distributed by %s.", _boot.distrib); - font.drawString(&surf, buffer, 0, 1, 320, _TLIGHTRED, Graphics::kTextAlignCenter); - } - - _vm->_screen->displayBackground(); - g_system->updateScreen(); - g_system->delayMillis(5000); -} - -bool intro_v2d::introPlay() { - return true; -} - -} // End of namespace Hugo diff --git a/engines/hugo/intro_v2w.cpp b/engines/hugo/intro_v2w.cpp deleted file mode 100644 index 77f8eaa83c..0000000000 --- a/engines/hugo/intro_v2w.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on original Hugo Trilogy source code - * - * Copyright (c) 1989-1995 David P. Gray - * - */ - -#include "common/system.h" - -#include "hugo/hugo.h" -#include "hugo/intro.h" -#include "hugo/display.h" - - -namespace Hugo { - -intro_v2w::intro_v2w(HugoEngine *vm) : IntroHandler(vm) { -} - -intro_v2w::~intro_v2w() { -} - -void intro_v2w::preNewGame() { -} - -void intro_v2w::introInit() { - _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen - - _vm->_screen->displayBackground(); - g_system->updateScreen(); - g_system->delayMillis(3000); -} - -bool intro_v2w::introPlay() { - return true; -} - -} // End of namespace Hugo diff --git a/engines/hugo/intro_v3d.cpp b/engines/hugo/intro_v3d.cpp deleted file mode 100644 index e723e639d4..0000000000 --- a/engines/hugo/intro_v3d.cpp +++ /dev/null @@ -1,117 +0,0 @@ -/* 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on original Hugo Trilogy source code - * - * Copyright (c) 1989-1995 David P. Gray - * - */ - -#include "common/system.h" - -#include "hugo/hugo.h" -#include "hugo/intro.h" -#include "hugo/file.h" -#include "hugo/display.h" -#include "hugo/util.h" -#include "hugo/sound.h" - - -namespace Hugo { -intro_v3d::intro_v3d(HugoEngine *vm) : IntroHandler(vm) { -} - -intro_v3d::~intro_v3d() { -} - -void intro_v3d::preNewGame() { -} - -void intro_v3d::introInit() { - _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen - surf.w = 320; - surf.h = 200; - surf.pixels = _vm->_screen->getFrontBuffer(); - surf.pitch = 320; - surf.bytesPerPixel = 1; - - char buffer[128]; - if (_boot.registered) - sprintf(buffer, "%s Registered Version", COPYRIGHT); - else - sprintf(buffer,"%s Shareware Version", COPYRIGHT); - - // TROMAN, size 10-5 - if (!font.loadFromFON("TMSRB.FON", Graphics::WinFontDirEntry("Tms Rmn", 8))) - error("Unable to load font TMSRB.FON, face 'Tms Rmn', size 8"); - - font.drawString(&surf, buffer, 0, 190, 320, _TBROWN, Graphics::kTextAlignCenter); - - if (scumm_stricmp(_boot.distrib, "David P. Gray")) { - sprintf(buffer, "Distributed by %s.", _boot.distrib); - font.drawString(&surf, buffer, 0, 0, 320, _TBROWN, Graphics::kTextAlignCenter); - } - - _vm->_screen->displayBackground(); - g_system->updateScreen(); - g_system->delayMillis(5000); - - _vm->_file->readBackground(22); // display screen MAP_3d - _vm->_screen->displayBackground(); - introTicks = 0; - _vm->_sound->DOSSongPtr = _vm->_sound->DOSIntroSong; -} - -/** -* Hugo 3 - Preamble screen before going into game. Draws path of Hugo's plane. -* Called every tick. Returns TRUE when complete -*/ -bool intro_v3d::introPlay() { - if (_vm->getGameStatus().skipIntroFl) - return true; - - if (introTicks < _vm->getIntroSize()) { - font.drawString(&surf, ".", _vm->_introX[introTicks], _vm->_introY[introTicks] - DIBOFF_Y, 320, _TBRIGHTWHITE); - _vm->_screen->displayBackground(); - - // Text boxes at various times - switch (introTicks) { - case 4: - Utils::Box(BOX_OK, "%s", _vm->_textIntro[kIntro1]); - break; - case 9: - Utils::Box(BOX_OK, "%s", _vm->_textIntro[kIntro2]); - break; - case 35: - Utils::Box(BOX_OK, "%s", _vm->_textIntro[kIntro3]); - break; - } - } - - return (++introTicks >= _vm->getIntroSize()); -} - -} // End of namespace Hugo diff --git a/engines/hugo/intro_v3w.cpp b/engines/hugo/intro_v3w.cpp deleted file mode 100644 index 21e21775d2..0000000000 --- a/engines/hugo/intro_v3w.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on original Hugo Trilogy source code - * - * Copyright (c) 1989-1995 David P. Gray - * - */ - -#include "common/system.h" - -#include "hugo/hugo.h" -#include "hugo/intro.h" -#include "hugo/file.h" -#include "hugo/display.h" -#include "hugo/util.h" - -namespace Hugo { - -intro_v3w::intro_v3w(HugoEngine *vm) : IntroHandler(vm) { -} - -intro_v3w::~intro_v3w() { -} - -void intro_v3w::preNewGame() { -} - -/** -* Hugo 3 - show map and set up for introPlay() -*/ -void intro_v3w::introInit() { - - _vm->_file->readBackground(_vm->_numScreens - 1); // display splash screen - - _vm->_screen->displayBackground(); - g_system->updateScreen(); - g_system->delayMillis(3000); - _vm->_file->readBackground(22); // display screen MAP_3w - _vm->_screen->displayBackground(); - introTicks = 0; - _vm->_screen->loadFont(0); -} - -/** -* Hugo 3 - Preamble screen before going into game. Draws path of Hugo's plane. -* Called every tick. Returns TRUE when complete -*/ -bool intro_v3w::introPlay() { - if (_vm->getGameStatus().skipIntroFl) - return true; - - if (introTicks < _vm->getIntroSize()) { - // Scale viewport x_intro,y_intro to screen (offsetting y) - _vm->_screen->writeStr(_vm->_introX[introTicks], _vm->_introY[introTicks] - DIBOFF_Y, "x", _TBRIGHTWHITE); - _vm->_screen->displayBackground(); - - // Text boxes at various times - switch (introTicks) { - case 4: - Utils::Box(BOX_OK, "%s", _vm->_textIntro[kIntro1]); - break; - case 9: - Utils::Box(BOX_OK, "%s", _vm->_textIntro[kIntro2]); - break; - case 35: - Utils::Box(BOX_OK, "%s", _vm->_textIntro[kIntro3]); - break; - } - } - - return (++introTicks >= _vm->getIntroSize()); -} -} // End of namespace Hugo diff --git a/engines/hugo/module.mk b/engines/hugo/module.mk index 5b6610075f..ab64116ec7 100644 --- a/engines/hugo/module.mk +++ b/engines/hugo/module.mk @@ -4,8 +4,6 @@ MODULE_OBJS := \ console.o \ detection.o \ display.o \ - display_v1d.o \ - display_v1w.o \ file.o \ file_v1d.o \ file_v2d.o \ @@ -14,12 +12,6 @@ MODULE_OBJS := \ file_v2w.o \ hugo.o \ intro.o \ - intro_v1d.o \ - intro_v2d.o \ - intro_v3d.o \ - intro_v1w.o \ - intro_v2w.o \ - intro_v3w.o \ inventory.o \ menu.o \ mouse.o \ @@ -35,10 +27,6 @@ MODULE_OBJS := \ parser_v3d.o \ route.o \ schedule.o \ - schedule_v1d.o \ - schedule_v1w.o \ - schedule_v2d.o \ - schedule_v3d.o \ sound.o \ util.o diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp index 0667c4370f..715084d615 100644 --- a/engines/hugo/schedule.cpp +++ b/engines/hugo/schedule.cpp @@ -1241,4 +1241,239 @@ event_t *Scheduler::doAction(event_t *curEvent) { return wrkEvent; // Return next event ptr } } + +Scheduler_v1d::Scheduler_v1d(HugoEngine *vm) : Scheduler(vm) { +} + +Scheduler_v1d::~Scheduler_v1d() { +} + +const char *Scheduler_v1d::getCypher() { + return "Copyright (c) 1990, Gray Design Associates"; +} + +uint32 Scheduler_v1d::getTicks() { + return getDosTicks(false); +} + +/** +* Delete an event structure (i.e. return it to the free list) +* Note that event is assumed at head of queue (i.e. earliest). To delete +* an event from the middle of the queue, merely overwrite its action type +* to be ANULL +*/ +void Scheduler_v1d::delQueue(event_t *curEvent) { + debugC(4, kDebugSchedule, "delQueue()"); + + if (curEvent == _headEvent) // If p was the head ptr + _headEvent = curEvent->nextEvent; // then make new head_p + + if (_headEvent) + _headEvent->prevEvent = 0; // Mark end of list + else + _tailEvent = 0; // Empty queue + + curEvent->nextEvent = _freeEvent; // Return p to free list + if (_freeEvent) // Special case, if free list was empty + _freeEvent->prevEvent = curEvent; + _freeEvent = curEvent; +} + +/** +* This is the scheduler which runs every tick. It examines the event queue +* for any events whose time has come. It dequeues these events and performs +* the action associated with the event, returning it to the free queue +*/ +void Scheduler_v1d::runScheduler() { + debugC(6, kDebugSchedule, "runScheduler"); + + uint32 ticker = getTicks(); // The time now, in ticks + event_t *curEvent = _headEvent; // The earliest event + + while (curEvent && (curEvent->time <= ticker)) // While mature events found + curEvent = doAction(curEvent); // Perform the action (returns next_p) +} + +void Scheduler_v1d::delEventType(action_t actTypeDel) { + // Note: actions are not deleted here, simply turned into NOPs! + event_t *wrkEvent = _headEvent; // The earliest event + while (wrkEvent) { // While events found in list + if (wrkEvent->action->a20.actType == actTypeDel) + wrkEvent->action->a20.actType = ANULL; + wrkEvent = wrkEvent->nextEvent; + } +} + +void Scheduler_v1d::promptAction(act *action) { + Utils::Box(BOX_PROMPT, "%s", _vm->_file->fetchString(action->a3.promptIndex)); + + warning("STUB: doAction(act3)"); + // TODO: The answer of the player is not handled currently! Once it'll be read in the messageBox, uncomment this block +#if 0 + char response[256]; + // TODO: Put user input in response + + Utils::strlwr(response); + if (action->a3.encodedFl) { + warning("Encrypted flag set"); + decodeString(response); + } + + if (strstr(response, _vm->_file->fetchString(action->a3.responsePtr[0])) + insertActionList(action->a3.actPassIndex); + else + insertActionList(action->a3.actFailIndex); +#endif + + // HACK: As the answer is not read, currently it's always considered correct + insertActionList(action->a3.actPassIndex); +} + +/** +* Decode a response to a prompt +*/ +void Scheduler_v1d::decodeString(char *line) { + debugC(1, kDebugSchedule, "decodeString(%s)", line); + + static const char *cypher = getCypher(); + + for(uint16 i = 0; i < strlen(line); i++) { + line[i] = (line[i] + cypher[i]) % '~'; + if (line[i] < ' ') + line[i] += ' '; + } +} + +Scheduler_v2d::Scheduler_v2d(HugoEngine *vm) : Scheduler_v1d(vm) { +} + +Scheduler_v2d::~Scheduler_v2d() { +} + +const char *Scheduler_v2d::getCypher() { + return "Copyright 1991, Gray Design Associates"; +} + +/** +* Delete an event structure (i.e. return it to the free list) +* Historical note: Originally event p was assumed to be at head of queue +* (i.e. earliest) since all events were deleted in order when proceeding to +* a new screen. To delete an event from the middle of the queue, the action +* was overwritten to be ANULL. With the advent of GLOBAL events, delQueue +* was modified to allow deletes anywhere in the list, and the DEL_EVENT +* action was modified to perform the actual delete. +*/ +void Scheduler_v2d::delQueue(event_t *curEvent) { + debugC(4, kDebugSchedule, "delQueue()"); + + if (curEvent == _headEvent) { // If p was the head ptr + _headEvent = curEvent->nextEvent; // then make new head_p + } else { // Unlink p + curEvent->prevEvent->nextEvent = curEvent->nextEvent; + if (curEvent->nextEvent) + curEvent->nextEvent->prevEvent = curEvent->prevEvent; + else + _tailEvent = curEvent->prevEvent; + } + + if (_headEvent) + _headEvent->prevEvent = 0; // Mark end of list + else + _tailEvent = 0; // Empty queue + + curEvent->nextEvent = _freeEvent; // Return p to free list + if (_freeEvent) // Special case, if free list was empty + _freeEvent->prevEvent = curEvent; + _freeEvent = curEvent; +} + +void Scheduler_v2d::delEventType(action_t actTypeDel) { + // Note: actions are not deleted here, simply turned into NOPs! + event_t *wrkEvent = _headEvent; // The earliest event + event_t *saveEvent; + + while (wrkEvent) { // While events found in list + saveEvent = wrkEvent->nextEvent; + if (wrkEvent->action->a20.actType == actTypeDel) + delQueue(wrkEvent); + wrkEvent = saveEvent; + } +} + +void Scheduler_v2d::promptAction(act *action) { + Utils::Box(BOX_PROMPT, "%s", _vm->_file->fetchString(action->a3.promptIndex)); + warning("STUB: doAction(act3), expecting answer %s", _vm->_file->fetchString(action->a3.responsePtr[0])); + + // TODO: The answer of the player is not handled currently! Once it'll be read in the messageBox, uncomment this block +#if 0 + char *response = Utils::Box(BOX_PROMPT, "%s", _vm->_file->fetchString(action->a3.promptIndex)); + + bool found = false; + char *tmpStr; // General purpose string ptr + + for (dx = 0; !found && (action->a3.responsePtr[dx] != -1); dx++) { + tmpStr = _vm->_file->fetchString(action->a3.responsePtr[dx]); + if (strstr(Utils::strlwr(response) , tmpStr)) + found = true; + } + + if (found) + insertActionList(action->a3.actPassIndex); + else + insertActionList(action->a3.actFailIndex); +#endif + + // HACK: As the answer is not read, currently it's always considered correct + insertActionList(action->a3.actPassIndex); +} + +/** +* Decode a string +*/ +void Scheduler_v2d::decodeString(char *line) { + debugC(1, kDebugSchedule, "decodeString(%s)", line); + + static const char *cypher = getCypher(); + + for (uint16 i = 0; i < strlen(line); i++) + line[i] -= cypher[i % strlen(cypher)]; + debugC(1, kDebugSchedule, "result : %s", line); +} + +Scheduler_v3d::Scheduler_v3d(HugoEngine *vm) : Scheduler_v2d(vm) { +} + +Scheduler_v3d::~Scheduler_v3d() { +} + +const char *Scheduler_v3d::getCypher() { + return "Copyright 1992, Gray Design Associates"; +} + +Scheduler_v1w::Scheduler_v1w(HugoEngine *vm) : Scheduler_v3d(vm) { +} + +Scheduler_v1w::~Scheduler_v1w() { +} + +uint32 Scheduler_v1w::getTicks() { + return getWinTicks(); +} + +/** +* This is the scheduler which runs every tick. It examines the event queue +* for any events whose time has come. It dequeues these events and performs +* the action associated with the event, returning it to the free queue +*/ +void Scheduler_v1w::runScheduler() { + debugC(6, kDebugSchedule, "runScheduler"); + + uint32 ticker = getTicks(); // The time now, in ticks + event_t *curEvent = _headEvent; // The earliest event + + while (curEvent && (curEvent->time <= ticker)) // While mature events found + curEvent = doAction(curEvent); // Perform the action (returns next_p) + + _vm->getGameStatus().tick++; // Accessed elsewhere via getTicks() +} } // End of namespace Hugo diff --git a/engines/hugo/schedule_v1d.cpp b/engines/hugo/schedule_v1d.cpp deleted file mode 100644 index 817eaf019c..0000000000 --- a/engines/hugo/schedule_v1d.cpp +++ /dev/null @@ -1,147 +0,0 @@ -/* 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on original Hugo Trilogy source code - * - * Copyright (c) 1989-1995 David P. Gray - * - */ - -// This module contains all the scheduling and timing stuff - -#include "common/system.h" - -#include "hugo/game.h" -#include "hugo/hugo.h" -#include "hugo/schedule.h" -#include "hugo/file.h" -#include "hugo/display.h" -#include "hugo/util.h" - -namespace Hugo { - -Scheduler_v1d::Scheduler_v1d(HugoEngine *vm) : Scheduler(vm) { -} - -Scheduler_v1d::~Scheduler_v1d() { -} - -const char *Scheduler_v1d::getCypher() { - return "Copyright (c) 1990, Gray Design Associates"; -} - -uint32 Scheduler_v1d::getTicks() { - return getDosTicks(false); -} - -/** -* Delete an event structure (i.e. return it to the free list) -* Note that event is assumed at head of queue (i.e. earliest). To delete -* an event from the middle of the queue, merely overwrite its action type -* to be ANULL -*/ -void Scheduler_v1d::delQueue(event_t *curEvent) { - debugC(4, kDebugSchedule, "delQueue()"); - - if (curEvent == _headEvent) // If p was the head ptr - _headEvent = curEvent->nextEvent; // then make new head_p - - if (_headEvent) - _headEvent->prevEvent = 0; // Mark end of list - else - _tailEvent = 0; // Empty queue - - curEvent->nextEvent = _freeEvent; // Return p to free list - if (_freeEvent) // Special case, if free list was empty - _freeEvent->prevEvent = curEvent; - _freeEvent = curEvent; -} - -/** -* This is the scheduler which runs every tick. It examines the event queue -* for any events whose time has come. It dequeues these events and performs -* the action associated with the event, returning it to the free queue -*/ -void Scheduler_v1d::runScheduler() { - debugC(6, kDebugSchedule, "runScheduler"); - - uint32 ticker = getTicks(); // The time now, in ticks - event_t *curEvent = _headEvent; // The earliest event - - while (curEvent && (curEvent->time <= ticker)) // While mature events found - curEvent = doAction(curEvent); // Perform the action (returns next_p) -} - -void Scheduler_v1d::delEventType(action_t actTypeDel) { - // Note: actions are not deleted here, simply turned into NOPs! - event_t *wrkEvent = _headEvent; // The earliest event - while (wrkEvent) { // While events found in list - if (wrkEvent->action->a20.actType == actTypeDel) - wrkEvent->action->a20.actType = ANULL; - wrkEvent = wrkEvent->nextEvent; - } -} - -void Scheduler_v1d::promptAction(act *action) { - Utils::Box(BOX_PROMPT, "%s", _vm->_file->fetchString(action->a3.promptIndex)); - - warning("STUB: doAction(act3)"); - // TODO: The answer of the player is not handled currently! Once it'll be read in the messageBox, uncomment this block -#if 0 - char response[256]; - // TODO: Put user input in response - - Utils::strlwr(response); - if (action->a3.encodedFl) { - warning("Encrypted flag set"); - decodeString(response); - } - - if (strstr(response, _vm->_file->fetchString(action->a3.responsePtr[0])) - insertActionList(action->a3.actPassIndex); - else - insertActionList(action->a3.actFailIndex); -#endif - - // HACK: As the answer is not read, currently it's always considered correct - insertActionList(action->a3.actPassIndex); -} - -/** -* Decode a response to a prompt -*/ -void Scheduler_v1d::decodeString(char *line) { - debugC(1, kDebugSchedule, "decodeString(%s)", line); - - static const char *cypher = getCypher(); - - for(uint16 i = 0; i < strlen(line); i++) { - line[i] = (line[i] + cypher[i]) % '~'; - if (line[i] < ' ') - line[i] += ' '; - } -} -} // End of namespace Hugo diff --git a/engines/hugo/schedule_v1w.cpp b/engines/hugo/schedule_v1w.cpp deleted file mode 100644 index 1cb9d4b42b..0000000000 --- a/engines/hugo/schedule_v1w.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/* 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on original Hugo Trilogy source code - * - * Copyright (c) 1989-1995 David P. Gray - * - */ - -// This module contains all the scheduling and timing stuff - -#include "common/system.h" - -#include "hugo/game.h" -#include "hugo/hugo.h" -#include "hugo/schedule.h" -#include "hugo/global.h" -#include "hugo/file.h" -#include "hugo/display.h" -#include "hugo/parser.h" -#include "hugo/util.h" -#include "hugo/sound.h" -#include "hugo/object.h" - -namespace Hugo { - -Scheduler_v1w::Scheduler_v1w(HugoEngine *vm) : Scheduler_v3d(vm) { -} - -Scheduler_v1w::~Scheduler_v1w() { -} - -uint32 Scheduler_v1w::getTicks() { - return getWinTicks(); -} - -/** -* This is the scheduler which runs every tick. It examines the event queue -* for any events whose time has come. It dequeues these events and performs -* the action associated with the event, returning it to the free queue -*/ -void Scheduler_v1w::runScheduler() { - debugC(6, kDebugSchedule, "runScheduler"); - - uint32 ticker = getTicks(); // The time now, in ticks - event_t *curEvent = _headEvent; // The earliest event - - while (curEvent && (curEvent->time <= ticker)) // While mature events found - curEvent = doAction(curEvent); // Perform the action (returns next_p) - - _vm->getGameStatus().tick++; // Accessed elsewhere via getTicks() -} -} // End of namespace Hugo diff --git a/engines/hugo/schedule_v2d.cpp b/engines/hugo/schedule_v2d.cpp deleted file mode 100644 index 1e651ceada..0000000000 --- a/engines/hugo/schedule_v2d.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/* 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on original Hugo Trilogy source code - * - * Copyright (c) 1989-1995 David P. Gray - * - */ - -// This module contains all the scheduling and timing stuff - -#include "common/system.h" - -#include "hugo/game.h" -#include "hugo/hugo.h" -#include "hugo/schedule.h" -#include "hugo/global.h" -#include "hugo/file.h" -#include "hugo/display.h" -#include "hugo/util.h" - -namespace Hugo { - -Scheduler_v2d::Scheduler_v2d(HugoEngine *vm) : Scheduler_v1d(vm) { -} - -Scheduler_v2d::~Scheduler_v2d() { -} - -const char *Scheduler_v2d::getCypher() { - return "Copyright 1991, Gray Design Associates"; -} - -/** -* Delete an event structure (i.e. return it to the free list) -* Historical note: Originally event p was assumed to be at head of queue -* (i.e. earliest) since all events were deleted in order when proceeding to -* a new screen. To delete an event from the middle of the queue, the action -* was overwritten to be ANULL. With the advent of GLOBAL events, delQueue -* was modified to allow deletes anywhere in the list, and the DEL_EVENT -* action was modified to perform the actual delete. -*/ -void Scheduler_v2d::delQueue(event_t *curEvent) { - debugC(4, kDebugSchedule, "delQueue()"); - - if (curEvent == _headEvent) { // If p was the head ptr - _headEvent = curEvent->nextEvent; // then make new head_p - } else { // Unlink p - curEvent->prevEvent->nextEvent = curEvent->nextEvent; - if (curEvent->nextEvent) - curEvent->nextEvent->prevEvent = curEvent->prevEvent; - else - _tailEvent = curEvent->prevEvent; - } - - if (_headEvent) - _headEvent->prevEvent = 0; // Mark end of list - else - _tailEvent = 0; // Empty queue - - curEvent->nextEvent = _freeEvent; // Return p to free list - if (_freeEvent) // Special case, if free list was empty - _freeEvent->prevEvent = curEvent; - _freeEvent = curEvent; -} - -void Scheduler_v2d::delEventType(action_t actTypeDel) { - // Note: actions are not deleted here, simply turned into NOPs! - event_t *wrkEvent = _headEvent; // The earliest event - event_t *saveEvent; - - while (wrkEvent) { // While events found in list - saveEvent = wrkEvent->nextEvent; - if (wrkEvent->action->a20.actType == actTypeDel) - delQueue(wrkEvent); - wrkEvent = saveEvent; - } -} - -void Scheduler_v2d::promptAction(act *action) { - Utils::Box(BOX_PROMPT, "%s", _vm->_file->fetchString(action->a3.promptIndex)); - warning("STUB: doAction(act3), expecting answer %s", _vm->_file->fetchString(action->a3.responsePtr[0])); - - // TODO: The answer of the player is not handled currently! Once it'll be read in the messageBox, uncomment this block -#if 0 - char *response = Utils::Box(BOX_PROMPT, "%s", _vm->_file->fetchString(action->a3.promptIndex)); - - bool found = false; - char *tmpStr; // General purpose string ptr - - for (dx = 0; !found && (action->a3.responsePtr[dx] != -1); dx++) { - tmpStr = _vm->_file->fetchString(action->a3.responsePtr[dx]); - if (strstr(Utils::strlwr(response) , tmpStr)) - found = true; - } - - if (found) - insertActionList(action->a3.actPassIndex); - else - insertActionList(action->a3.actFailIndex); -#endif - - // HACK: As the answer is not read, currently it's always considered correct - insertActionList(action->a3.actPassIndex); -} - -/** -* Decode a string -*/ -void Scheduler_v2d::decodeString(char *line) { - debugC(1, kDebugSchedule, "decodeString(%s)", line); - - static const char *cypher = getCypher(); - - for (uint16 i = 0; i < strlen(line); i++) - line[i] -= cypher[i % strlen(cypher)]; - debugC(1, kDebugSchedule, "result : %s", line); -} -} // End of namespace Hugo diff --git a/engines/hugo/schedule_v3d.cpp b/engines/hugo/schedule_v3d.cpp deleted file mode 100644 index b58f31be74..0000000000 --- a/engines/hugo/schedule_v3d.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* 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. - * - * $URL$ - * $Id$ - * - */ - -/* - * This code is based on original Hugo Trilogy source code - * - * Copyright (c) 1989-1995 David P. Gray - * - */ - -// This module contains all the scheduling and timing stuff - -#include "common/system.h" - -#include "hugo/game.h" -#include "hugo/hugo.h" -#include "hugo/schedule.h" -#include "hugo/global.h" -#include "hugo/file.h" -#include "hugo/display.h" -#include "hugo/parser.h" -#include "hugo/util.h" -#include "hugo/sound.h" -#include "hugo/object.h" - -namespace Hugo { - -Scheduler_v3d::Scheduler_v3d(HugoEngine *vm) : Scheduler_v2d(vm) { -} - -Scheduler_v3d::~Scheduler_v3d() { -} - -const char *Scheduler_v3d::getCypher() { - return "Copyright 1992, Gray Design Associates"; -} - -} // End of namespace Hugo |