From 279746fcf0a3aac428e75bf7ca7e043cb0572aa6 Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 28 Dec 2011 15:07:17 +0200 Subject: DREAMWEB: Completely remove all of the runtime, and move everything into DreamWebEngine Also, remove dead code (allocateMem/deallocateMem) --- engines/dreamweb/backdrop.cpp | 28 +- engines/dreamweb/detection.cpp | 4 +- engines/dreamweb/dreambase.h | 1060 ---------------------------------------- engines/dreamweb/dreamgen.h | 65 --- engines/dreamweb/dreamweb.cpp | 374 +++++++------- engines/dreamweb/dreamweb.h | 1028 +++++++++++++++++++++++++++++++++++++- engines/dreamweb/keypad.cpp | 82 ++-- engines/dreamweb/monitor.cpp | 76 +-- engines/dreamweb/newplace.cpp | 54 +- engines/dreamweb/object.cpp | 124 ++--- engines/dreamweb/pathfind.cpp | 34 +- engines/dreamweb/people.cpp | 206 ++++---- engines/dreamweb/print.cpp | 44 +- engines/dreamweb/runtime.h | 46 -- engines/dreamweb/saveload.cpp | 108 ++-- engines/dreamweb/segment.h | 232 --------- engines/dreamweb/sound.cpp | 43 +- engines/dreamweb/sprite.cpp | 108 ++-- engines/dreamweb/structs.h | 6 +- engines/dreamweb/stubs.cpp | 542 ++++++++++---------- engines/dreamweb/talk.cpp | 36 +- engines/dreamweb/titles.cpp | 28 +- engines/dreamweb/use.cpp | 358 +++++++------- engines/dreamweb/vgafades.cpp | 80 +-- engines/dreamweb/vgagrafx.cpp | 86 ++-- 25 files changed, 2215 insertions(+), 2637 deletions(-) delete mode 100644 engines/dreamweb/dreambase.h delete mode 100644 engines/dreamweb/dreamgen.h delete mode 100644 engines/dreamweb/runtime.h delete mode 100644 engines/dreamweb/segment.h (limited to 'engines') diff --git a/engines/dreamweb/backdrop.cpp b/engines/dreamweb/backdrop.cpp index 528a6c4fd1..f2356eb0b0 100644 --- a/engines/dreamweb/backdrop.cpp +++ b/engines/dreamweb/backdrop.cpp @@ -22,9 +22,9 @@ #include "dreamweb/dreamweb.h" -namespace DreamGen { +namespace DreamWeb { -void DreamBase::doBlocks() { +void DreamWebEngine::doBlocks() { uint16 dstOffset = _mapAdY * 320 + _mapAdX; uint16 mapOffset = _mapY * kMapWidth + _mapX; const uint8 *mapData = _mapData + mapOffset; @@ -61,7 +61,7 @@ void DreamBase::doBlocks() { } } -uint8 DreamBase::getXAd(const uint8 *setData, uint8 *result) { +uint8 DreamWebEngine::getXAd(const uint8 *setData, uint8 *result) { uint8 v0 = setData[0]; uint8 v1 = setData[1]; uint8 v2 = setData[2]; @@ -76,7 +76,7 @@ uint8 DreamBase::getXAd(const uint8 *setData, uint8 *result) { return 1; } -uint8 DreamBase::getYAd(const uint8 *setData, uint8 *result) { +uint8 DreamWebEngine::getYAd(const uint8 *setData, uint8 *result) { uint8 v0 = setData[3]; uint8 v1 = setData[4]; if (v0 < _mapY) @@ -88,7 +88,7 @@ uint8 DreamBase::getYAd(const uint8 *setData, uint8 *result) { return 1; } -uint8 DreamBase::getMapAd(const uint8 *setData, uint16 *x, uint16 *y) { +uint8 DreamWebEngine::getMapAd(const uint8 *setData, uint16 *x, uint16 *y) { uint8 xad, yad; if (getXAd(setData, &xad) == 0) return 0; @@ -99,7 +99,7 @@ uint8 DreamBase::getMapAd(const uint8 *setData, uint16 *x, uint16 *y) { return 1; } -void DreamBase::calcFrFrame(const Frame &frame, uint8 *width, uint8 *height, uint16 x, uint16 y, ObjPos *objPos) { +void DreamWebEngine::calcFrFrame(const Frame &frame, uint8 *width, uint8 *height, uint16 x, uint16 y, ObjPos *objPos) { *width = frame.width; *height = frame.height; @@ -109,7 +109,7 @@ void DreamBase::calcFrFrame(const Frame &frame, uint8 *width, uint8 *height, uin objPos->yMax = objPos->yMin + frame.height; } -void DreamBase::makeBackOb(SetObject *objData, uint16 x, uint16 y) { +void DreamWebEngine::makeBackOb(SetObject *objData, uint16 x, uint16 y) { if (_vars._newObs == 0) return; uint8 priority = objData->priority; @@ -126,7 +126,7 @@ void DreamBase::makeBackOb(SetObject *objData, uint16 x, uint16 y) { sprite->animFrame = 0; } -void DreamBase::showAllObs() { +void DreamWebEngine::showAllObs() { const unsigned int count = 128; _setList.clear(); @@ -172,7 +172,7 @@ static bool addLength(const MapFlag *mapFlags) { return false; } -void DreamBase::getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize) { +void DreamWebEngine::getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize) { uint8 yStart = 0; while (! addAlong(_mapFlags + 11 * yStart)) ++yStart; @@ -199,7 +199,7 @@ void DreamBase::getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize _mapYSize = *mapYsize << 4; } -void DreamBase::calcMapAd() { +void DreamWebEngine::calcMapAd() { uint8 mapXstart, mapYstart; uint8 mapXsize, mapYsize; getDimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize); @@ -207,7 +207,7 @@ void DreamBase::calcMapAd() { _mapAdY = _mapOffsetY - 8 * (mapYsize + 2 * mapYstart - 10); } -void DreamBase::showAllFree() { +void DreamWebEngine::showAllFree() { const unsigned int count = 80; _freeList.clear(); @@ -234,7 +234,7 @@ void DreamBase::showAllFree() { } } -void DreamBase::drawFlags() { +void DreamWebEngine::drawFlags() { MapFlag *mapFlag = _mapFlags; uint16 mapOffset = _mapY * kMapWidth + _mapX; const uint8 *mapData = _mapData + mapOffset; @@ -250,7 +250,7 @@ void DreamBase::drawFlags() { } } -void DreamBase::showAllEx() { +void DreamWebEngine::showAllEx() { const unsigned int count = 100; _exList.clear(); @@ -279,4 +279,4 @@ void DreamBase::showAllEx() { } } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/detection.cpp b/engines/dreamweb/detection.cpp index 3a5c28a104..b891c2a3ea 100644 --- a/engines/dreamweb/detection.cpp +++ b/engines/dreamweb/detection.cpp @@ -133,8 +133,8 @@ SaveStateDescriptor DreamWebMetaEngine::querySaveMetaInfos(const char *target, i Common::InSaveFile *in = g_system->getSavefileManager()->openForLoading(filename.c_str()); if (in) { - DreamGen::FileHeader header; - in->read((uint8 *)&header, sizeof(DreamGen::FileHeader)); + DreamWeb::FileHeader header; + in->read((uint8 *)&header, sizeof(DreamWeb::FileHeader)); Common::String saveName; byte descSize = header.len(0); diff --git a/engines/dreamweb/dreambase.h b/engines/dreamweb/dreambase.h deleted file mode 100644 index ebbe24c9cc..0000000000 --- a/engines/dreamweb/dreambase.h +++ /dev/null @@ -1,1060 +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. - * - */ - -#ifndef DREAMBASE_H -#define DREAMBASE_H - -#include "common/scummsys.h" -#include "common/list.h" - -#include "dreamweb/segment.h" - -namespace DreamWeb { - class DreamWebEngine; -} - - -namespace DreamGen { - - // Note: duplication from dreamgen.h -const unsigned int kNumReelRoutines = 57; -const unsigned int kUnderTextSizeX = 180; -const unsigned int kUnderTextSizeY = 10; -const unsigned int kUnderTimedTextSizeY = 24; -const unsigned int kUnderTextSizeX_f = 228; // foreign version -const unsigned int kUnderTextSizeY_f = 13; // foreign version -const unsigned int kUnderTimedTextSizeY_f = 30; -const unsigned int kUnderTextBufSize = kUnderTextSizeX_f * kUnderTextSizeY_f; -const unsigned int kUnderTimedTextBufSize = 256 * kUnderTimedTextSizeY_f; -const unsigned int kLengthOfVars = 68; -const unsigned int kNumChanges = 250; -const unsigned int kLenOfMapStore = 22*8*20*8; -const unsigned int kMapWidth = 66; -const unsigned int kMapHeight = 60; -const unsigned int kLengthOfMap = kMapWidth * kMapHeight; -const unsigned int kNumExObjects = 114; -const unsigned int kScreenwidth = 320; -const unsigned int kDiaryx = (68+24); -const unsigned int kDiaryy = (48+12); -const unsigned int kInventx = 80; -const unsigned int kInventy = 58; -const unsigned int kMenux = (80+40); -const unsigned int kMenuy = 60; -const unsigned int kOpsx = 60; -const unsigned int kOpsy = 52; -const unsigned int kSymbolx = 64; -const unsigned int kSymboly = 56; -const unsigned int kLengthofvars = 68; - -/** - * This class is one of the parent classes of DreamGenContext. Its sole purpose - * is to allow us to incrementally move things out of DreamGenContext into this - * base class, as soon as they don't modify any context registers (ax, bx, cx, ...) - * anymore. - * Ultimately, DreamGenContext should be empty, at which point it can be removed - * together with class Context. When that happens, we can probably merge - * DreamBase into DreamWebEngine. - */ -class DreamBase : public SegmentManager { -protected: - DreamWeb::DreamWebEngine *engine; - - const char *_timedString; - GameVars _vars; // saved variables - - // from backdrop.cpp - uint8 *_backdropBlocks; - BackdropMapFlag _backdropFlags[96]; - uint8 _mapData[kLengthOfMap + 32]; - - // from keypad.cpp - uint8 _pressList[6]; - - // from monitor.cpp - char _inputLine[64]; - char _operand1[14]; - char _currentFile[14]; - - // from newplace.cpp - uint8 _roomsCanGo[16]; - - // from object.cpp - uint16 _openChangeSize; - ObjectRef _oldSubject; - - // from pathfind.cpp - Common::Point _lineData[200]; // Output of Bresenham - - // from saveload.cpp - char _saveNames[17*7]; - char _saveNamesOld[17*7]; - - // from vgagrafx.cpp - uint8 _workspace[(0x1000 + 2) * 16]; - uint8 _mapStore[kLenOfMapStore + 32]; - - // from people.cpp - ReelRoutine _reelRoutines[kNumReelRoutines+1]; - ReelRoutine *_personData; - - // from Buffers - uint8 _textUnder[kUnderTextBufSize]; - ObjectRef _openInvList[16]; - ObjectRef _ryanInvList[30]; - uint8 _pointerBack[32*32]; - MapFlag _mapFlags[11*10]; - uint8 _startPal[3*256]; - uint8 _endPal[3*256]; - uint8 _mainPal[3*256]; - Common::List _spriteTable; - Common::List _setList; - Common::List _freeList; - Common::List _exList; - Common::List _peopleList; - uint8 _zoomSpace[46*40]; - // _printedList (unused?) - Change _listOfChanges[kNumChanges]; // Note: this array is saved - uint8 _underTimedText[kUnderTimedTextBufSize]; - Common::List _rainList; - - // textfiles - TextFile _textFile1; - TextFile _textFile2; - TextFile _textFile3; - TextFile _travelText; - TextFile _puzzleText; - TextFile _commandText; - - // graphics files - GraphicsFile _tempGraphics; - GraphicsFile _tempGraphics2; - GraphicsFile _tempGraphics3; - GraphicsFile _icons1; - GraphicsFile _icons2; - GraphicsFile _tempCharset; - GraphicsFile _charset1; - GraphicsFile _mainSprites; - const GraphicsFile *_currentCharset; - - // room files - GraphicsFile _setFrames; - GraphicsFile _freeFrames; - GraphicsFile _reel1; - GraphicsFile _reel2; - GraphicsFile _reel3; - TextFile _setDesc; - TextFile _blockDesc; - TextFile _roomDesc; - TextFile _freeDesc; - TextFile _personText; - uint16 _personFramesLE[12]; - RoomPaths _pathData[36]; - Reel *_reelList; - SetObject _setDat[128]; - DynObject _freeDat[80]; - - // Extras segment (NB: this is saved) - GraphicsFile _exFrames; - DynObject _exData[kNumExObjects]; - TextFile _exText; - -public: - DreamBase(DreamWeb::DreamWebEngine *en); - - bool _quitRequested; - bool _subtitles; - bool _foreignRelease; - - bool _wonGame; - - // sound related - uint8 _roomsSample; - uint8 _currentSample; - uint8 _channel0Playing; - uint8 _channel0Repeat; - uint8 _channel1Playing; - - uint8 _volume; - uint8 _volumeTo; - int8 _volumeDirection; - uint8 _volumeCount; - - bool _speechLoaded; - - // misc variables - uint8 _speechCount; - uint16 _charShift; - uint8 _kerning; - uint8 _brightness; - uint8 _roomLoaded; - uint8 _didZoom; - uint16 _lineSpacing; - uint16 _textAddressX; - uint16 _textAddressY; - uint8 _textLen; - uint16 _lastXPos; - uint8 _itemFrame; - uint8 _withObject; - uint8 _withType; - uint16 _lookCounter; - uint8 _command; - uint8 _commandType; - uint8 _objectType; - uint8 _getBack; - uint8 _invOpen; - uint8 _mainMode; - uint8 _pickUp; - uint8 _lastInvPos; - uint8 _examAgain; - uint8 _newTextLine; - uint8 _openedOb; - uint8 _openedType; - uint16 _mapAdX; - uint16 _mapAdY; - uint16 _mapOffsetX; - uint16 _mapOffsetY; - uint16 _mapXStart; - uint16 _mapYStart; - uint8 _mapXSize; - uint8 _mapYSize; - uint8 _haveDoneObs; - uint8 _manIsOffScreen; - uint8 _facing; - uint8 _leaveDirection; - uint8 _turnToFace; - uint8 _turnDirection; - uint16 _mainTimer; - uint8 _introCount; - uint8 _currentKey; - uint8 _timerCount; - uint8 _mapX; - uint8 _mapY; - uint8 _ryanX; - uint8 _ryanY; - uint8 _lastFlag; - uint8 _destPos; - uint8 _realLocation; - uint8 _roomNum; - uint8 _nowInNewRoom; - uint8 _resetManXY; - uint8 _newLocation; - uint8 _autoLocation; - uint16 _mouseX; - uint16 _mouseY; - uint16 _mouseButton; - uint16 _oldButton; - uint16 _oldX; - uint16 _oldY; - uint16 _oldPointerX; - uint16 _oldPointerY; - uint16 _delHereX; - uint16 _delHereY; - uint8 _pointerXS; - uint8 _pointerYS; - uint8 _delXS; - uint8 _delYS; - uint8 _pointerFrame; - uint8 _pointerPower; - uint8 _pointerMode; - uint8 _pointerSpeed; - uint8 _pointerCount; - uint8 _inMapArea; - uint8 _talkMode; - uint8 _talkPos; - uint8 _character; - uint8 _watchDump; - uint8 _logoNum; - uint8 _oldLogoNum; - uint8 _pressed; - uint16 _pressPointer; - uint8 _graphicPress; - uint8 _pressCount; - uint8 _lightCount; - uint8 _folderPage; - uint8 _diaryPage; - uint8 _menuCount; - uint8 _symbolTopX; - uint8 _symbolTopNum; - uint8 _symbolTopDir; - uint8 _symbolBotX; - uint8 _symbolBotNum; - uint8 _symbolBotDir; - uint16 _dumpX; - uint16 _dumpY; - uint8 _walkAndExam; - uint8 _walkExamType; - uint8 _walkExamNum; - uint16 _cursLocX; - uint16 _cursLocY; - uint16 _curPos; - uint16 _monAdX; - uint16 _monAdY; - uint16 _timeCount; - uint16 _countToTimed; - uint8 _timedY; - uint8 _timedX; - uint8 _needToDumpTimed; - uint8 _loadingOrSave; - uint8 _currentSlot; - uint8 _cursorPos; - uint8 _colourPos; - uint8 _fadeDirection; - uint8 _numToFade; - uint8 _fadeCount; - uint8 _addToGreen; - uint8 _addToRed; - uint8 _addToBlue; - uint16 _lastSoundReel; - uint8 _lastHardKey; - uint16 _bufferIn; - uint16 _bufferOut; - uint8 _blinkFrame; - uint8 _blinkCount; - uint8 _reAssesChanges; - uint8 _pointersPath; - uint8 _mansPath; - uint8 _pointerFirstPath; - uint8 _finalDest; - uint8 _destination; - uint16 _lineStartX; - uint16 _lineStartY; - uint16 _lineEndX; - uint16 _lineEndY; - uint8 _linePointer; - uint8 _lineDirection; - uint8 _lineLength; - - // from backdrop.cpp - void doBlocks(); - uint8 getXAd(const uint8 *setData, uint8 *result); - uint8 getYAd(const uint8 *setData, uint8 *result); - uint8 getMapAd(const uint8 *setData, uint16 *x, uint16 *y); - void calcFrFrame(const Frame &frame, uint8* width, uint8* height, uint16 x, uint16 y, ObjPos *objPos); - void makeBackOb(SetObject *objData, uint16 x, uint16 y); - void showAllObs(); - void getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize); - void calcMapAd(); - void showAllFree(); - void drawFlags(); - void showAllEx(); - - // from keypad.cpp - void getUnderMenu(); - void putUnderMenu(); - void singleKey(uint8 key, uint16 x, uint16 y); - void loadKeypad(); - void showKeypad(); - bool isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); - void addToPressList(); - void buttonOne(); - void buttonTwo(); - void buttonThree(); - void buttonFour(); - void buttonFive(); - void buttonSix(); - void buttonSeven(); - void buttonEight(); - void buttonNine(); - void buttonNought(); - void buttonEnter(); - void buttonPress(uint8 buttonId); - void showOuterPad(); - void dumpKeypad(); - void dumpSymbol(); - void dumpSymBox(); - void quitSymbol(); - void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); - - // from monitor.cpp - void input(); - byte makeCaps(byte c); - void delChar(); - void monMessage(uint8 index); - void netError(); - void monitorLogo(); - void randomAccess(uint16 count); - void printOuterMon(); - void showCurrentFile(); - void accessLightOn(); - void accessLightOff(); - void turnOnPower(); - void powerLightOn(); - void powerLightOff(); - void printLogo(); - void scrollMonitor(); - const char *monPrint(const char *string); - void lockLightOn(); - void lockLightOff(); - void loadPersonal(); - void loadNews(); - void loadCart(); - void showKeys(); - const char *parser(); - const char *searchForString(const char *topic, const char *text); - const char *getKeyAndLogo(const char *foundString); - void read(); - void dirFile(const char *dirName); - void dirCom(); - void useMon(); - bool execCommand(); - - // from newplace.cpp - void getUnderCentre(); - void putUnderCentre(); - void showArrows(); - uint8 getLocation(uint8 index); - void setLocation(uint8 index); - void clearLocation(uint8 index); - void resetLocation(uint8 index); - void readCityPic(); - void readDestIcon(); - void showCity(); - void locationPic(); - void selectLocation(); - void newPlace(); - void nextDest(); - void lastDest(); - void destSelect(); - void lookAtPlace(); - - // from object.cpp - void obIcons(); - void fillRyan(); - void findAllRyan(); - void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y); - void obPicture(); - void removeObFromInv(); - void deleteExObject(uint8 index); - void deleteExFrame(uint8 frameNum); - void deleteExText(uint8 textNum); - void purgeALocation(uint8 index); - const uint8 *getObTextStart(); - void wornError(); - void makeWorn(DynObject *object); - void dropObject(); - ObjectRef findOpenPos(); - byte getOpenedSlotSize(); - byte getOpenedSlotCount(); - void openOb(); - void findAllOpen(); - void fillOpen(); - ObjectRef findInvPos(); - void reExFromInv(); - void swapWithInv(); - void transferText(uint8 from, uint8 to); - void pickupConts(uint8 from, uint8 containerEx); - byte transferToEx(uint8 from); - void swapWithOpen(); - void outOfOpen(); - void inToInv(); - void outOfInv(); - bool checkObjectSize(); - void useOpened(); - void setPickup(); - void selectOpenOb(); - void examineOb(bool examineAgain = true); - void selectOb(); - void inventory(); - void identifyOb(); - - // from pathfind.cpp - void turnPathOn(uint8 param); - void turnPathOff(uint8 param); - void turnAnyPathOn(uint8 param, uint8 room); - void turnAnyPathOff(uint8 param, uint8 room); - RoomPaths *getRoomsPaths(); - void faceRightWay(); - void setWalk(); - void autoSetWalk(); - void checkDest(const RoomPaths *roomsPaths); - void findXYFromPath(); - bool checkIfPathIsOn(uint8 index); - void bresenhams(); - void workoutFrames(); - byte findFirstPath(byte x, byte y); - byte findPathOfPoint(byte x, byte y); - - // from people.cpp - void setupInitialReelRoutines(); - void updatePeople(); - void madmanText(); - void madman(ReelRoutine &routine); - void madMode(); - void addToPeopleList(ReelRoutine *routine); - bool checkSpeed(ReelRoutine &routine); - void sparkyDrip(ReelRoutine &routine); - void genericPerson(ReelRoutine &routine); - void gamer(ReelRoutine &routine); - void eden(ReelRoutine &routine); - void sparky(ReelRoutine &routine); - void rockstar(ReelRoutine &routine); - void madmansTelly(ReelRoutine &routine); - void smokeBloke(ReelRoutine &routine); - void manAsleep(ReelRoutine &routine); - void drunk(ReelRoutine &routine); - void introMagic1(ReelRoutine &routine); - void introMagic2(ReelRoutine &routine); - void introMagic3(ReelRoutine &routine); - void introMusic(ReelRoutine &routine); - void candles(ReelRoutine &routine); - void candles1(ReelRoutine &routine); - void candles2(ReelRoutine &routine); - void smallCandle(ReelRoutine &routine); - void gates(ReelRoutine &routine); - void security(ReelRoutine &routine); - void edenInBath(ReelRoutine &routine); - void louis(ReelRoutine &routine); - void handClap(ReelRoutine &routine); - void carParkDrip(ReelRoutine &routine); - void foghornSound(ReelRoutine &routine); - void train(ReelRoutine &routine); - void attendant(ReelRoutine &routine); - void keeper(ReelRoutine &routine); - void interviewer(ReelRoutine &routine); - void drinker(ReelRoutine &routine); - void alleyBarkSound(ReelRoutine &routine); - void louisChair(ReelRoutine &routine); - void bossMan(ReelRoutine &routine); - void priest(ReelRoutine &routine); - void monkAndRyan(ReelRoutine &routine); - void copper(ReelRoutine &routine); - void introMonks1(ReelRoutine &routine); - void introMonks2(ReelRoutine &routine); - void soldier1(ReelRoutine &routine); - void receptionist(ReelRoutine &routine); - void bartender(ReelRoutine &routine); - void heavy(ReelRoutine &routine); - void helicopter(ReelRoutine &routine); - void mugger(ReelRoutine &routine); - void businessMan(ReelRoutine &routine); - void endGameSeq(ReelRoutine &routine); - void poolGuard(ReelRoutine &routine); - - // from print.cpp - uint8 getNextWord(const GraphicsFile &charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount); - void printChar(const GraphicsFile &charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height); - void printChar(const GraphicsFile &charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height); - void printBoth(const GraphicsFile &charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar); - uint8 printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered); - uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered); - uint8 getNumber(const GraphicsFile &charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset); - uint8 kernChars(uint8 firstChar, uint8 secondChar, uint8 width); - uint8 printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered); - uint16 waitFrames(); - void printCurs(); - void delCurs(); - void rollEndCreditsGameWon(); - void rollEndCreditsGameLost(); - - // from saveload.cpp - void loadGame(); - void doLoad(int slot); - void saveGame(); - void namesToOld(); - void oldToNames(); - void saveLoad(); - void doSaveLoad(); - void showMainOps(); - void showDiscOps(); - void discOps(); - void actualSave(); - void actualLoad(); - void loadPosition(unsigned int slot); - void savePosition(unsigned int slot, const char *descbuf); - uint scanForNames(); - void loadOld(); - void showDecisions(); - void loadSaveBox(); - void showNames(); - void checkInput(); - void selectSlot(); - void showSlots(); - void showOpBox(); - void showSaveOps(); - void showLoadOps(); - - // from sound.cpp - bool loadSpeech(byte type1, int idx1, byte type2, int idx2); - void volumeAdjust(); - void cancelCh0(); - void cancelCh1(); - void loadRoomsSample(); - void playChannel0(uint8 index, uint8 repeat); - void playChannel1(uint8 index); - - // from sprite.cpp - void printSprites(); - void printASprite(const Sprite *sprite); - void clearSprites(); - Sprite *makeSprite(uint8 x, uint8 y, uint16 updateCallback, const GraphicsFile *frameData, uint16 somethingInDi); - void initMan(); - void walking(Sprite *sprite); - void aboutTurn(Sprite *sprite); - void backObject(Sprite *sprite); - void constant(Sprite *sprite, SetObject *objData); - void randomSprite(Sprite *sprite, SetObject *objData); - void doorway(Sprite *sprite, SetObject *objData); - void wideDoor(Sprite *sprite, SetObject *objData); - void doDoor(Sprite *sprite, SetObject *objData, Common::Rect check); - void steady(Sprite *sprite, SetObject *objData); - void lockedDoorway(Sprite *sprite, SetObject *objData); - void liftSprite(Sprite *sprite, SetObject *objData); - - Reel *getReelStart(uint16 reelPointer); - const GraphicsFile *findSource(uint16 &frame); - void showReelFrame(Reel *reel); - void showGameReel(ReelRoutine *routine); - const Frame *getReelFrameAX(uint16 frame); - void moveMap(uint8 param); - void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY); - - uint8 getBlockOfPixel(uint8 x, uint8 y); - void splitIntoLines(uint8 x, uint8 y); - void initRain(); - - void intro1Text(); - void intro2Text(uint16 nextReelPointer); - void intro3Text(uint16 nextReelPointer); - - void monks2text(); - void textForEnd(); - void textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); - void textForMonk(); - void priestText(ReelRoutine &routine); - void soundOnReels(uint16 reelPointer); - void clearBeforeLoad(); - void clearReels(); - void getRidOfReels(); - void liftNoise(uint8 index); - void checkForExit(Sprite *sprite); - void mainMan(Sprite *sprite); - void spriteUpdate(); - void showRain(); - void reconstruct(); - void reelsOnScreen(); - - // from stubs.cpp - void setupInitialVars(); - bool isCD(); - void crosshair(); - void delTextLine(); - void showBlink(); - void dumpBlink(); - void dumpPointer(); - void showPointer(); - void delPointer(); - void showRyanPage(); - void switchRyanOn(); - void switchRyanOff(); - void middlePanel(); - void showDiary(); - void readMouse(); - uint16 readMouseState(); - void hangOn(uint16 frameCount); - void lockMon(); - uint8 *textUnder(); - void readKey(); - void findOrMake(uint8 index, uint8 value, uint8 type); - DynObject *getFreeAd(uint8 index); - DynObject *getExAd(uint8 index); - DynObject *getEitherAdCPP(); - void *getAnyAdDir(uint8 index, uint8 flag); - void showWatch(); - void showTime(); - void showExit(); - void showMan(); - void panelIcons1(); - SetObject *getSetAd(uint8 index); - void *getAnyAd(uint8 *slotSize, uint8 *slotCount); - const uint8 *getTextInFile1(uint16 index); - uint8 findNextColon(const uint8 **string); - void allocateBuffers(); - uint16 allocateMem(uint16 paragraphs); - void deallocateMem(uint16 segment); - void loadTextFile(TextFile &file, const char *fileName); - void loadGraphicsFile(GraphicsFile &file, const char *fileName); - void loadGraphicsSegment(GraphicsFile &file, unsigned int len); - void loadTextSegment(TextFile &file, unsigned int len); - void loadIntoTemp(const char *fileName); - void loadIntoTemp2(const char *fileName); - void loadIntoTemp3(const char *fileName); - void loadTempCharset(const char *fileName); - void loadTravelText(); - void loadTempText(const char *fileName); - void clearAndLoad(uint8 *buf, uint8 c, unsigned int size, unsigned int maxSize); - void sortOutMap(); - void loadRoomData(const Room &room, bool skipDat); - void useTempCharset(); - void useCharset1(); - void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered); - void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count); - bool isItDescribed(const ObjPos *objPos); - void zoomIcon(); - void roomName(); - void showIcon(); - void eraseOldObs(); - void commandOnly(uint8 command); - void blank(); - void setTopLeft(); - void setTopRight(); - void setBotLeft(); - void setBotRight(); - void examIcon(); - void animPointer(); - void getFlagUnderP(uint8 *flag, uint8 *flagEx); - void workToScreenM(); - void quitKey(); - void restoreReels(); - void loadFolder(); - void folderHints(); - void folderExit(); - void showFolder(); - void showLeftPage(); - void showRightPage(); - void underTextLine(); - void hangOnP(uint16 count); - void getUnderZoom(); - void putUnderZoom(); - void examineInventory(); - void openInv(); - void getBack1(); - void getBackFromOb(); - void getBackFromOps(); - void getBackToOps(); - void DOSReturn(); - bool isItWorn(const DynObject *object); - bool compare(uint8 index, uint8 flag, const char id[4]); - void hangOnW(uint16 frameCount); - void getRidOfTemp(); - void getRidOfTempText(); - void getRidOfTemp2(); - void getRidOfTemp3(); - void getRidOfTempCharset(); - void getRidOfAll(); - void placeSetObject(uint8 index); - void removeSetObject(uint8 index); - bool isSetObOnMap(uint8 index); - void dumpZoom(); - void diaryKeyP(); - void diaryKeyN(); - void findRoomInLoc(); - void loadMenu(); - void showMenu(); - void dumpMenu(); - void dealWithSpecial(uint8 firstParam, uint8 secondParam); - void plotReel(uint16 &reelPointer); - void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); - void getUnderTimed(); - void putUnderTimed(); - void dumpTextLine(); - void useTimedText(); - void dumpTimedText(); - void getTime(); - void doChange(uint8 index, uint8 value, uint8 type); - bool isRyanHolding(const char *id); - void clearBuffers(); - void clearChanges(); - void drawFloor(); - uint16 findSetObject(const char *id); - void hangOnCurs(uint16 frameCount); - const uint8 *findObName(uint8 type, uint8 index); - void copyName(uint8 type, uint8 index, uint8 *dst); - uint16 findExObject(const char *id); - void makeMainScreen(); - void showWatchReel(); - void watchReel(); - void commandWithOb(uint8 command, uint8 type, uint8 index); - void examineObText(); - void blockNameText(); - void personNameText(); - void walkToText(); - void entryTexts(); - void setAllChanges(); - void restoreAll(); - void redrawMainScrn(); - - template - void checkCoords(const RectWithCallback *rectWithCallbacks) { - if (_newLocation != 0xff) - return; - - const RectWithCallback *r; - for (r = rectWithCallbacks; r->_xMin != 0xffff; ++r) { - if (r->contains(_mouseX, _mouseY)) { - (((T *)this)->*(r->_callback))(); - return; - } - } - } - - void newGame(); - void deleteTaken(); - void autoAppear(); - void loadRoom(); - void startLoading(const Room &room); - void startup(); - void atmospheres(); - bool objectMatches(void *object, const char *id); - void checkFolderCoords(); - void nextFolder(); - void lastFolder(); - void lookAtCard(); - void obsThatDoThings(); - void describeOb(); - void putBackObStuff(); - void reExFromOpen(); - void showDiaryPage(); - void showDiaryKeys(); - void dumpDiaryKeys(); - void useMenu(); - void incRyanPage(); - void edensFlatReminders(); - void dropError(); - void cantDrop(); - void entryAnims(); - bool finishedWalking(); - void emergencyPurge(); - void purgeAnItem(); - uint8 nextSymbol(uint8 symbol); - void enterSymbol(); - void showSymbol(); - void updateSymbolTop(); - void updateSymbolBot(); - void pickupOb(uint8 command, uint8 pos); - void errorMessage1(); - void errorMessage2(); - void errorMessage3(); - void decide(); - void allPointer(); - void dumpWatch(); - void watchCount(); - void signOn(); - void searchForFiles(const char *filesString); - void triggerMessage(uint16 index); - void processTrigger(); - void dreamweb(); - void screenUpdate(); - void startup1(); - void quickQuit(); - void readOneBlock(); - void seeCommandTail(); - void quickQuit2(); - bool checkIfPerson(uint8 x, uint8 y); - bool checkIfFree(uint8 x, uint8 y); - bool checkIfEx(uint8 x, uint8 y); - void walkAndExamine(); - void obName(uint8 command, uint8 commandType); - bool checkIfSet(uint8 x, uint8 y); - void readSetData(); - void look(); - void autoLook(); - void doLook(); - void mainScreen(); - void zoomOnOff(); - void initialInv(); - void walkIntoRoom(); - void afterNewRoom(); - void madmanRun(); - void showGun(); - - // from talk.cpp - void talk(); - void convIcons(); - uint16 getPersFrame(uint8 index); - const uint8 *getPersonText(uint8 index, uint8 talkPos); - void startTalk(); - void moreTalk(); - void doSomeTalk(); - bool hangOnPQ(); - void redes(); - - // from titles.cpp - void endGame(); - void monkSpeaking(); - void gettingShot(); - void bibleQuote(); - void hangOne(uint16 delay); - void intro(); - void runIntroSeq(); - void runEndSeq(); - void loadIntroRoom(); - void set16ColPalette(); - void realCredits(); - uint8 getExPos(); - - // from use.cpp - void useRoutine(); - void useObject(); - void placeFreeObject(uint8 index); - void removeFreeObject(uint8 index); - void setupTimedUse(uint16 offset, uint16 countToTimed, uint16 timeCount, byte x, byte y); - void withWhat(); - uint16 checkInside(uint16 command, uint16 type); - void showPuzText(uint16 command, uint16 count); - void useText(const uint8 *string); - void showFirstUse(); - void showSecondUse(); - void viewFolder(); - void edensCDPlayer(); - void hotelBell(); - void playGuitar(); - void useElevator1(); - void useElevator2(); - void useElevator3(); - void useElevator4(); - void useElevator5(); - void useHatch(); - void wheelSound(); - void callHotelLift(); - void useShield(); - void useCoveredBox(); - void useRailing(); - void useChurchHole(); - void sitDownInBar(); - void useBalcony(); - void useWindow(); - void trapDoor(); - void useDryer(); - void callEdensDLift(); - void callEdensLift(); - void openYourNeighbour(); - void openRyan(); - void openPoolBoss(); - void openEden(); - void openSarters(); - void openLouis(); - void useWall(); - void useChurchGate(); - void useLadder(); - void useLadderB(); - bool defaultUseHandler(const char *id); - void slabDoorA(); - void slabDoorB(); - void slabDoorC(); - void slabDoorE(); - void slabDoorD(); - void slabDoorF(); - void useGun(); - void useFullCart(); - void useClearBox(); - void openTVDoor(); - void usePlate(); - void usePlinth(); - void useElvDoor(); - void useWinch(); - void useCart(); - void useHole(); - void openHotelDoor(); - void openHotelDoor2(); - void grafittiDoor(); - void useCardReader1(); - void useCardReader2(); - void useCardReader3(); - void usePoolReader(); - void useLighter(); - void useWire(); - void openTomb(); - void hotelControl(); - void useCooker(); - void useDiary(); - void useControl(); - void useSlab(); - void usePipe(); - void useOpenBox(); - void runTap(); - void useAxe(); - void useHandle(); - void useAltar(); - void notHeldError(); - void useCashCard(); - void useButtonA(); - void wearWatch(); - void wearShades(); - void useTrainer(); - void useStereo(); - void chewy(); - void delEverything(); - void afterIntroRoom(); - - // from vgafades.cpp - void clearStartPal(); - void clearEndPal(); - void palToStartPal(); - void endPalToStart(); - void startPalToEnd(); - void palToEndPal(); - void fadeDOS(); - void doFade(); - void fadeCalculation(); - void fadeUpYellows(); - void fadeUpMonFirst(); - void fadeUpMon(); - void fadeDownMon(); - void initialMonCols(); - void fadeScreenUp(); - void fadeScreenUps(); - void fadeScreenUpHalf(); - void fadeScreenDown(); - void fadeScreenDowns(); - void fadeScreenDownHalf(); - void clearPalette(); - void greyscaleSum(); - void allPalette(); - void dumpCurrent(); - - // from vgagrafx.cpp - inline uint8 *workspace() { return _workspace; } - void clearWork(); - - void panelToMap(); - void mapToPanel(); - void dumpMap(); - void transferFrame(uint8 from, uint8 to, uint8 offset); - void zoom(); - void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height); - void multiPut(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height); - void multiDump(uint16 x, uint16 y, uint8 width, uint8 height); - void workToScreen(); - void printUnderMon(); - void cls(); - void frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y); - void frameOutNm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); - void frameOutBh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); - void frameOutFx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); - void doShake(); - void vSync(); - void setMode(); - void showPCX(const Common::String &name); - void showFrameInternal(const uint8 *pSrc, uint16 x, uint16 y, uint8 effectsFlag, uint8 width, uint8 height); - void showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height); - void showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag); - bool pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y); - void loadPalFromIFF(); - void createPanel(); - void createPanel2(); - void showPanel(); -}; - - -} // End of namespace DreamGen - -#endif diff --git a/engines/dreamweb/dreamgen.h b/engines/dreamweb/dreamgen.h deleted file mode 100644 index dfec45d069..0000000000 --- a/engines/dreamweb/dreamgen.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef TASMRECOVER_DREAMGEN_STUBS_H__ -#define TASMRECOVER_DREAMGEN_STUBS_H__ - -/* PLEASE DO NOT MODIFY THIS FILE. ALL CHANGES WILL BE LOST! LOOK FOR README FOR DETAILS */ - -/* 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 "dreamweb/runtime.h" - -#include "dreamweb/structs.h" -#include "dreamweb/dreambase.h" - -namespace DreamGen { - -static const uint16 kDebuglevel1 = (0); -static const uint16 kDebuglevel2 = (0); -static const uint16 kPlayback = (0); -static const uint16 kSpanish = (0); -static const uint16 kRecording = (0); -static const uint16 kGerman = (0); -static const uint16 kDemo = (0); -static const uint16 kExframedata = (0); -static const uint16 kExframes = (0+2080); -static const uint16 kExdata = (0+2080+30000); -static const uint16 kExtextdat = (0+2080+30000+(16*114)); -static const uint16 kExtext = (0+2080+30000+(16*114)+((114+2)*2)); -static const uint16 kLengthofextra = (0+2080+30000+(16*114)+((114+2)*2)+18000); -static const uint16 kForeign = (1); -static const uint16 kCd = (1); -static const uint16 kNumexobjects = (114); -static const uint16 kExtextlen = (18000); -static const uint16 kExframeslen = (30000); -static const uint16 kItempicsize = (44); - - -class DreamGenContext : public DreamBase, public Context { -public: - DreamGenContext(DreamWeb::DreamWebEngine *en) : DreamBase(en), Context(this) {} - - void __start(); -}; - -} // End of namespace DreamGen - -#endif diff --git a/engines/dreamweb/dreamweb.cpp b/engines/dreamweb/dreamweb.cpp index 8bc4975f69..be620bfe3a 100644 --- a/engines/dreamweb/dreamweb.cpp +++ b/engines/dreamweb/dreamweb.cpp @@ -34,12 +34,13 @@ #include "graphics/surface.h" #include "dreamweb/dreamweb.h" -#include "dreamweb/dreamgen.h" namespace DreamWeb { DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gameDesc) : - Engine(syst), _gameDescription(gameDesc), _rnd("dreamweb"), _context(this), _base(_context) { + Engine(syst), _gameDescription(gameDesc), _rnd("dreamweb"), + _exText(kNumExObjects+2), + _setDesc(130), _blockDesc(98), _roomDesc(38), _freeDesc(82), _personText(1026) { // Setup mixer _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, ConfMan.getInt("sfx_volume")); @@ -59,6 +60,170 @@ DreamWebEngine::DreamWebEngine(OSystem *syst, const DreamWebGameDescription *gam _channel1 = 0; _language = gameDesc->desc.language; + + _openChangeSize = kInventx+(4*kItempicsize); + _quitRequested = false; + + _currentSample = 0xff; + _channel0Playing = 0; + _channel0Repeat = 0; + _channel1Playing = 0xff; + + _volume = 0; + _volumeTo = 0; + _volumeDirection = 0; + _volumeCount = 0; + + _speechLoaded = false; + + _backdropBlocks = 0; + _reelList = 0; + + _oldSubject._type = 0; + _oldSubject._index = 0; + + // misc variables + _speechCount = 0; + _charShift = 0; + _kerning = 0; + _brightness = 0; + _roomLoaded = 0; + _didZoom = 0; + _lineSpacing = 10; + _textAddressX = 13; + _textAddressY = 182; + _textLen = 0; + _lastXPos = 0; + _itemFrame = 0; + _withObject = 0; + _withType = 0; + _lookCounter = 0; + _command = 0; + _commandType = 0; + _objectType = 0; + _getBack = 0; + _invOpen = 0; + _mainMode = 0; + _pickUp = 0; + _lastInvPos = 0; + _examAgain = 0; + _newTextLine = 0; + _openedOb = 0; + _openedType = 0; + _mapAdX = 0; + _mapAdY = 0; + _mapOffsetX = 104; + _mapOffsetY = 38; + _mapXStart = 0; + _mapYStart = 0; + _mapXSize = 0; + _mapYSize = 0; + _haveDoneObs = 0; + _manIsOffScreen = 0; + _facing = 0; + _leaveDirection = 0; + _turnToFace = 0; + _turnDirection = 0; + _mainTimer = 0; + _introCount = 0; + _currentKey = 0; + _timerCount = 0; + _mapX = 0; + _mapY = 0; + _ryanX = 0; + _ryanY = 0; + _lastFlag = 0; + _destPos = 0; + _realLocation = 0; + _roomNum = 0; + _nowInNewRoom = 0; + _resetManXY = 0; + _newLocation = 0xFF; + _autoLocation = 0xFF; + _mouseX = 0; + _mouseY = 0; + _mouseButton = 0; + _oldButton = 0; + _oldX = 0; + _oldY = 0; + _oldPointerX = 0; + _oldPointerY = 0; + _delHereX = 0; + _delHereY = 0; + _pointerXS = 32; + _pointerYS = 32; + _delXS = 0; + _delYS = 0; + _pointerFrame = 0; + _pointerPower = 0; + _pointerMode = 0; + _pointerSpeed = 0; + _pointerCount = 0; + _inMapArea = 0; + _talkMode = 0; + _talkPos = 0; + _character = 0; + _watchDump = 0; + _logoNum = 0; + _oldLogoNum = 0; + _pressed = 0; + _pressPointer = 0; + _graphicPress = 0; + _pressCount = 0; + _lightCount = 0; + _folderPage = 0; + _diaryPage = 0; + _menuCount = 0; + _symbolTopX = 0; + _symbolTopNum = 0; + _symbolTopDir = 0; + _symbolBotX = 0; + _symbolBotNum = 0; + _symbolBotDir = 0; + _dumpX = 0; + _dumpY = 0; + _walkAndExam = 0; + _walkExamType = 0; + _walkExamNum = 0; + _cursLocX = 0; + _cursLocY = 0; + _curPos = 0; + _monAdX = 0; + _monAdY = 0; + _timeCount = 0; + _countToTimed = 0; + _timedY = 0; + _timedX = 0; + _needToDumpTimed = 0; + _loadingOrSave = 0; + _currentSlot = 0; + _cursorPos = 0; + _colourPos = 0; + _fadeDirection = 0; + _numToFade = 0; + _fadeCount = 0; + _addToGreen = 0; + _addToRed = 0; + _addToBlue = 0; + _lastSoundReel = 0; + _lastHardKey = 0; + _bufferIn = 0; + _bufferOut = 0; + _blinkFrame = 23; + _blinkCount = 0; + _reAssesChanges = 0; + _pointersPath = 0; + _mansPath = 0; + _pointerFirstPath = 0; + _finalDest = 0; + _destination = 0; + _lineStartX = 0; + _lineStartY = 0; + _lineEndX = 0; + _lineEndY = 0; + _linePointer = 0; + _lineDirection = 0; + _lineLength = 0; } DreamWebEngine::~DreamWebEngine() { @@ -88,14 +253,14 @@ void DreamWebEngine::waitForVSync() { setVSyncInterrupt(false); } - _base.doShake(); - _base.doFade(); + doShake(); + doFade(); _system->updateScreen(); } void DreamWebEngine::quit() { - _base._quitRequested = true; - _base._lastHardKey = 1; + _quitRequested = true; + _lastHardKey = 1; } void DreamWebEngine::processEvents() { @@ -130,8 +295,8 @@ void DreamWebEngine::processEvents() { break; case Common::KEYCODE_c: //skip statue puzzle - _base._symbolBotNum = 3; - _base._symbolTopNum = 5; + _symbolBotNum = 3; + _symbolTopNum = 5; break; default: @@ -161,7 +326,7 @@ void DreamWebEngine::processEvents() { break; } - _base._lastHardKey = hardKey; + _lastHardKey = hardKey; // The rest of the keys are converted to ASCII. This // is fairly restrictive, and eventually we may want @@ -204,8 +369,8 @@ Common::Error DreamWebEngine::run() { ConfMan.registerDefault("dreamweb_originalsaveload", "false"); _timer->installTimerProc(vSyncInterrupt, 1000000 / 70, this, "dreamwebVSync"); - _context.dreamweb(); - _base._quitRequested = false; + dreamweb(); + _quitRequested = false; _timer->removeTimerProc(vSyncInterrupt); @@ -267,14 +432,14 @@ Common::String DreamWebEngine::getSavegameFilename(int slot) const { void DreamWebEngine::keyPressed(uint16 ascii) { debug(2, "key pressed = %04x", ascii); - uint16 in = (_base._bufferIn + 1) & 0x0f; - uint16 out = _base._bufferOut; + uint16 in = (_bufferIn + 1) & 0x0f; + uint16 out = _bufferOut; if (in == out) { warning("keyboard buffer is full"); return; } - _base._bufferIn = in; - DreamGen::g_keyBuffer[in] = ascii; + _bufferIn = in; + DreamWeb::g_keyBuffer[in] = ascii; } void DreamWebEngine::mouseCall(uint16 *x, uint16 *y, uint16 *state) { @@ -322,7 +487,7 @@ void DreamWebEngine::blit(const uint8 *src, int pitch, int x, int y, int w, int } void DreamWebEngine::printUnderMonitor() { - uint8 *dst = _base.workspace() + DreamGen::kScreenwidth * 43 + 76; + uint8 *dst = workspace() + DreamWeb::kScreenwidth * 43 + 76; Graphics::Surface *s = _system->lockScreen(); if (!s) @@ -337,7 +502,7 @@ void DreamWebEngine::printUnderMonitor() { ++dst; ++src; } } - dst += DreamGen::kScreenwidth - 170; + dst += DreamWeb::kScreenwidth - 170; } _system->unlockScreen(); } @@ -402,178 +567,3 @@ uint8 DreamWebEngine::modifyChar(uint8 c) const { } } // End of namespace DreamWeb - - -namespace DreamGen { - -// FIXME/TODO: Move this to a better place. -DreamBase::DreamBase(DreamWeb::DreamWebEngine *en) : - engine(en), _exText(kNumExObjects+2), - _setDesc(130), _blockDesc(98), _roomDesc(38), _freeDesc(82), _personText(1026) { - - _openChangeSize = kInventx+(4*kItempicsize); - _quitRequested = false; - - _currentSample = 0xff; - _channel0Playing = 0; - _channel0Repeat = 0; - _channel1Playing = 0xff; - - _volume = 0; - _volumeTo = 0; - _volumeDirection = 0; - _volumeCount = 0; - - _speechLoaded = false; - - _backdropBlocks = 0; - _reelList = 0; - - _oldSubject._type = 0; - _oldSubject._index = 0; - - // misc variables - _speechCount = 0; - _charShift = 0; - _kerning = 0; - _brightness = 0; - _roomLoaded = 0; - _didZoom = 0; - _lineSpacing = 10; - _textAddressX = 13; - _textAddressY = 182; - _textLen = 0; - _lastXPos = 0; - _itemFrame = 0; - _withObject = 0; - _withType = 0; - _lookCounter = 0; - _command = 0; - _commandType = 0; - _objectType = 0; - _getBack = 0; - _invOpen = 0; - _mainMode = 0; - _pickUp = 0; - _lastInvPos = 0; - _examAgain = 0; - _newTextLine = 0; - _openedOb = 0; - _openedType = 0; - _mapAdX = 0; - _mapAdY = 0; - _mapOffsetX = 104; - _mapOffsetY = 38; - _mapXStart = 0; - _mapYStart = 0; - _mapXSize = 0; - _mapYSize = 0; - _haveDoneObs = 0; - _manIsOffScreen = 0; - _facing = 0; - _leaveDirection = 0; - _turnToFace = 0; - _turnDirection = 0; - _mainTimer = 0; - _introCount = 0; - _currentKey = 0; - _timerCount = 0; - _mapX = 0; - _mapY = 0; - _ryanX = 0; - _ryanY = 0; - _lastFlag = 0; - _destPos = 0; - _realLocation = 0; - _roomNum = 0; - _nowInNewRoom = 0; - _resetManXY = 0; - _newLocation = 0xFF; - _autoLocation = 0xFF; - _mouseX = 0; - _mouseY = 0; - _mouseButton = 0; - _oldButton = 0; - _oldX = 0; - _oldY = 0; - _oldPointerX = 0; - _oldPointerY = 0; - _delHereX = 0; - _delHereY = 0; - _pointerXS = 32; - _pointerYS = 32; - _delXS = 0; - _delYS = 0; - _pointerFrame = 0; - _pointerPower = 0; - _pointerMode = 0; - _pointerSpeed = 0; - _pointerCount = 0; - _inMapArea = 0; - _talkMode = 0; - _talkPos = 0; - _character = 0; - _watchDump = 0; - _logoNum = 0; - _oldLogoNum = 0; - _pressed = 0; - _pressPointer = 0; - _graphicPress = 0; - _pressCount = 0; - _lightCount = 0; - _folderPage = 0; - _diaryPage = 0; - _menuCount = 0; - _symbolTopX = 0; - _symbolTopNum = 0; - _symbolTopDir = 0; - _symbolBotX = 0; - _symbolBotNum = 0; - _symbolBotDir = 0; - _dumpX = 0; - _dumpY = 0; - _walkAndExam = 0; - _walkExamType = 0; - _walkExamNum = 0; - _cursLocX = 0; - _cursLocY = 0; - _curPos = 0; - _monAdX = 0; - _monAdY = 0; - _timeCount = 0; - _countToTimed = 0; - _timedY = 0; - _timedX = 0; - _needToDumpTimed = 0; - _loadingOrSave = 0; - _currentSlot = 0; - _cursorPos = 0; - _colourPos = 0; - _fadeDirection = 0; - _numToFade = 0; - _fadeCount = 0; - _addToGreen = 0; - _addToRed = 0; - _addToBlue = 0; - _lastSoundReel = 0; - _lastHardKey = 0; - _bufferIn = 0; - _bufferOut = 0; - _blinkFrame = 23; - _blinkCount = 0; - _reAssesChanges = 0; - _pointersPath = 0; - _mansPath = 0; - _pointerFirstPath = 0; - _finalDest = 0; - _destination = 0; - _lineStartX = 0; - _lineStartY = 0; - _lineEndX = 0; - _lineEndY = 0; - _linePointer = 0; - _lineDirection = 0; - _lineLength = 0; -} - -} // End of namespace DreamGen diff --git a/engines/dreamweb/dreamweb.h b/engines/dreamweb/dreamweb.h index 58354a9516..9e1341bfa2 100644 --- a/engines/dreamweb/dreamweb.h +++ b/engines/dreamweb/dreamweb.h @@ -37,7 +37,6 @@ #include "engines/advancedDetector.h" #include "engines/engine.h" -#include "dreamweb/dreamgen.h" #include "dreamweb/console.h" #include "dreamweb/structs.h" @@ -46,8 +45,55 @@ #define SCUMMVM_BLOCK_MAGIC_SIZE 0x1234 #define SAVEGAME_VERSION 1 -namespace DreamGen { +namespace DreamWeb { +const unsigned int kNumReelRoutines = 57; +const unsigned int kUnderTextSizeX = 180; +const unsigned int kUnderTextSizeY = 10; +const unsigned int kUnderTimedTextSizeY = 24; +const unsigned int kUnderTextSizeX_f = 228; // foreign version +const unsigned int kUnderTextSizeY_f = 13; // foreign version +const unsigned int kUnderTimedTextSizeY_f = 30; +const unsigned int kUnderTextBufSize = kUnderTextSizeX_f * kUnderTextSizeY_f; +const unsigned int kUnderTimedTextBufSize = 256 * kUnderTimedTextSizeY_f; +const unsigned int kLengthOfVars = 68; +const unsigned int kNumChanges = 250; +const unsigned int kLenOfMapStore = 22*8*20*8; +const unsigned int kMapWidth = 66; +const unsigned int kMapHeight = 60; +const unsigned int kLengthOfMap = kMapWidth * kMapHeight; +const unsigned int kNumExObjects = 114; +const unsigned int kScreenwidth = 320; +const unsigned int kDiaryx = (68+24); +const unsigned int kDiaryy = (48+12); +const unsigned int kInventx = 80; +const unsigned int kInventy = 58; +const unsigned int kMenux = (80+40); +const unsigned int kMenuy = 60; +const unsigned int kOpsx = 60; +const unsigned int kOpsy = 52; +const unsigned int kSymbolx = 64; +const unsigned int kSymboly = 56; +const unsigned int kLengthofvars = 68; +const unsigned int kDebuglevel1 = (0); +const unsigned int kDebuglevel2 = (0); +const unsigned int kPlayback = (0); +const unsigned int kSpanish = (0); +const unsigned int kRecording = (0); +const unsigned int kGerman = (0); +const unsigned int kDemo = (0); +const unsigned int kExframedata = (0); +const unsigned int kExframes = (0+2080); +const unsigned int kExdata = (0+2080+30000); +const unsigned int kExtextdat = (0+2080+30000+(16*114)); +const unsigned int kExtext = (0+2080+30000+(16*114)+((114+2)*2)); +const unsigned int kLengthofextra = (0+2080+30000+(16*114)+((114+2)*2)+18000); +const unsigned int kForeign = (1); +const unsigned int kCd = (1); +const unsigned int kNumexobjects = (114); +const unsigned int kExtextlen = (18000); +const unsigned int kExframeslen = (30000); +const unsigned int kItempicsize = (44); // These are for ReelRoutine::reelPointer, which is a callback field. const uint16 addr_backobject = 0xc170; const uint16 addr_mainman = 0xc138; @@ -56,10 +102,6 @@ const uint16 addr_mainman = 0xc138; // into this, making it a ring buffer extern uint8 g_keyBuffer[16]; -} - -namespace DreamWeb { - // Engine Debug Flags enum { kDebugAnimation = (1 << 0), @@ -159,8 +201,978 @@ private: Audio::SoundHandle _channelHandle[2]; uint8 _channel0, _channel1; - DreamGen::DreamGenContext _context; - DreamGen::DreamBase &_base; +protected: + const char *_timedString; + GameVars _vars; // saved variables + + // from backdrop.cpp + uint8 *_backdropBlocks; + BackdropMapFlag _backdropFlags[96]; + uint8 _mapData[kLengthOfMap + 32]; + + // from keypad.cpp + uint8 _pressList[6]; + + // from monitor.cpp + char _inputLine[64]; + char _operand1[14]; + char _currentFile[14]; + + // from newplace.cpp + uint8 _roomsCanGo[16]; + + // from object.cpp + uint16 _openChangeSize; + ObjectRef _oldSubject; + + // from pathfind.cpp + Common::Point _lineData[200]; // Output of Bresenham + + // from saveload.cpp + char _saveNames[17*7]; + char _saveNamesOld[17*7]; + + // from vgagrafx.cpp + uint8 _workspace[(0x1000 + 2) * 16]; + uint8 _mapStore[kLenOfMapStore + 32]; + + // from people.cpp + ReelRoutine _reelRoutines[kNumReelRoutines+1]; + ReelRoutine *_personData; + + // from Buffers + uint8 _textUnder[kUnderTextBufSize]; + ObjectRef _openInvList[16]; + ObjectRef _ryanInvList[30]; + uint8 _pointerBack[32*32]; + MapFlag _mapFlags[11*10]; + uint8 _startPal[3*256]; + uint8 _endPal[3*256]; + uint8 _mainPal[3*256]; + Common::List _spriteTable; + Common::List _setList; + Common::List _freeList; + Common::List _exList; + Common::List _peopleList; + uint8 _zoomSpace[46*40]; + // _printedList (unused?) + Change _listOfChanges[kNumChanges]; // Note: this array is saved + uint8 _underTimedText[kUnderTimedTextBufSize]; + Common::List _rainList; + + // textfiles + TextFile _textFile1; + TextFile _textFile2; + TextFile _textFile3; + TextFile _travelText; + TextFile _puzzleText; + TextFile _commandText; + + // graphics files + GraphicsFile _tempGraphics; + GraphicsFile _tempGraphics2; + GraphicsFile _tempGraphics3; + GraphicsFile _icons1; + GraphicsFile _icons2; + GraphicsFile _tempCharset; + GraphicsFile _charset1; + GraphicsFile _mainSprites; + const GraphicsFile *_currentCharset; + + // room files + GraphicsFile _setFrames; + GraphicsFile _freeFrames; + GraphicsFile _reel1; + GraphicsFile _reel2; + GraphicsFile _reel3; + TextFile _setDesc; + TextFile _blockDesc; + TextFile _roomDesc; + TextFile _freeDesc; + TextFile _personText; + uint16 _personFramesLE[12]; + RoomPaths _pathData[36]; + Reel *_reelList; + SetObject _setDat[128]; + DynObject _freeDat[80]; + + // Extras segment (NB: this is saved) + GraphicsFile _exFrames; + DynObject _exData[kNumExObjects]; + TextFile _exText; + +public: + DreamWebEngine(/*DreamWeb::DreamWebEngine *en*/); + + bool _quitRequested; + bool _subtitles; + bool _foreignRelease; + + bool _wonGame; + + // sound related + uint8 _roomsSample; + uint8 _currentSample; + uint8 _channel0Playing; + uint8 _channel0Repeat; + uint8 _channel1Playing; + + uint8 _volume; + uint8 _volumeTo; + int8 _volumeDirection; + uint8 _volumeCount; + + bool _speechLoaded; + + // misc variables + uint8 _speechCount; + uint16 _charShift; + uint8 _kerning; + uint8 _brightness; + uint8 _roomLoaded; + uint8 _didZoom; + uint16 _lineSpacing; + uint16 _textAddressX; + uint16 _textAddressY; + uint8 _textLen; + uint16 _lastXPos; + uint8 _itemFrame; + uint8 _withObject; + uint8 _withType; + uint16 _lookCounter; + uint8 _command; + uint8 _commandType; + uint8 _objectType; + uint8 _getBack; + uint8 _invOpen; + uint8 _mainMode; + uint8 _pickUp; + uint8 _lastInvPos; + uint8 _examAgain; + uint8 _newTextLine; + uint8 _openedOb; + uint8 _openedType; + uint16 _mapAdX; + uint16 _mapAdY; + uint16 _mapOffsetX; + uint16 _mapOffsetY; + uint16 _mapXStart; + uint16 _mapYStart; + uint8 _mapXSize; + uint8 _mapYSize; + uint8 _haveDoneObs; + uint8 _manIsOffScreen; + uint8 _facing; + uint8 _leaveDirection; + uint8 _turnToFace; + uint8 _turnDirection; + uint16 _mainTimer; + uint8 _introCount; + uint8 _currentKey; + uint8 _timerCount; + uint8 _mapX; + uint8 _mapY; + uint8 _ryanX; + uint8 _ryanY; + uint8 _lastFlag; + uint8 _destPos; + uint8 _realLocation; + uint8 _roomNum; + uint8 _nowInNewRoom; + uint8 _resetManXY; + uint8 _newLocation; + uint8 _autoLocation; + uint16 _mouseX; + uint16 _mouseY; + uint16 _mouseButton; + uint16 _oldButton; + uint16 _oldX; + uint16 _oldY; + uint16 _oldPointerX; + uint16 _oldPointerY; + uint16 _delHereX; + uint16 _delHereY; + uint8 _pointerXS; + uint8 _pointerYS; + uint8 _delXS; + uint8 _delYS; + uint8 _pointerFrame; + uint8 _pointerPower; + uint8 _pointerMode; + uint8 _pointerSpeed; + uint8 _pointerCount; + uint8 _inMapArea; + uint8 _talkMode; + uint8 _talkPos; + uint8 _character; + uint8 _watchDump; + uint8 _logoNum; + uint8 _oldLogoNum; + uint8 _pressed; + uint16 _pressPointer; + uint8 _graphicPress; + uint8 _pressCount; + uint8 _lightCount; + uint8 _folderPage; + uint8 _diaryPage; + uint8 _menuCount; + uint8 _symbolTopX; + uint8 _symbolTopNum; + uint8 _symbolTopDir; + uint8 _symbolBotX; + uint8 _symbolBotNum; + uint8 _symbolBotDir; + uint16 _dumpX; + uint16 _dumpY; + uint8 _walkAndExam; + uint8 _walkExamType; + uint8 _walkExamNum; + uint16 _cursLocX; + uint16 _cursLocY; + uint16 _curPos; + uint16 _monAdX; + uint16 _monAdY; + uint16 _timeCount; + uint16 _countToTimed; + uint8 _timedY; + uint8 _timedX; + uint8 _needToDumpTimed; + uint8 _loadingOrSave; + uint8 _currentSlot; + uint8 _cursorPos; + uint8 _colourPos; + uint8 _fadeDirection; + uint8 _numToFade; + uint8 _fadeCount; + uint8 _addToGreen; + uint8 _addToRed; + uint8 _addToBlue; + uint16 _lastSoundReel; + uint8 _lastHardKey; + uint16 _bufferIn; + uint16 _bufferOut; + uint8 _blinkFrame; + uint8 _blinkCount; + uint8 _reAssesChanges; + uint8 _pointersPath; + uint8 _mansPath; + uint8 _pointerFirstPath; + uint8 _finalDest; + uint8 _destination; + uint16 _lineStartX; + uint16 _lineStartY; + uint16 _lineEndX; + uint16 _lineEndY; + uint8 _linePointer; + uint8 _lineDirection; + uint8 _lineLength; + + // from backdrop.cpp + void doBlocks(); + uint8 getXAd(const uint8 *setData, uint8 *result); + uint8 getYAd(const uint8 *setData, uint8 *result); + uint8 getMapAd(const uint8 *setData, uint16 *x, uint16 *y); + void calcFrFrame(const Frame &frame, uint8* width, uint8* height, uint16 x, uint16 y, ObjPos *objPos); + void makeBackOb(SetObject *objData, uint16 x, uint16 y); + void showAllObs(); + void getDimension(uint8 *mapXstart, uint8 *mapYstart, uint8 *mapXsize, uint8 *mapYsize); + void calcMapAd(); + void showAllFree(); + void drawFlags(); + void showAllEx(); + + // from keypad.cpp + void getUnderMenu(); + void putUnderMenu(); + void singleKey(uint8 key, uint16 x, uint16 y); + void loadKeypad(); + void showKeypad(); + bool isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); + void addToPressList(); + void buttonOne(); + void buttonTwo(); + void buttonThree(); + void buttonFour(); + void buttonFive(); + void buttonSix(); + void buttonSeven(); + void buttonEight(); + void buttonNine(); + void buttonNought(); + void buttonEnter(); + void buttonPress(uint8 buttonId); + void showOuterPad(); + void dumpKeypad(); + void dumpSymbol(); + void dumpSymBox(); + void quitSymbol(); + void enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3); + + // from monitor.cpp + void input(); + byte makeCaps(byte c); + void delChar(); + void monMessage(uint8 index); + void netError(); + void monitorLogo(); + void randomAccess(uint16 count); + void printOuterMon(); + void showCurrentFile(); + void accessLightOn(); + void accessLightOff(); + void turnOnPower(); + void powerLightOn(); + void powerLightOff(); + void printLogo(); + void scrollMonitor(); + const char *monPrint(const char *string); + void lockLightOn(); + void lockLightOff(); + void loadPersonal(); + void loadNews(); + void loadCart(); + void showKeys(); + const char *parser(); + const char *searchForString(const char *topic, const char *text); + const char *getKeyAndLogo(const char *foundString); + void read(); + void dirFile(const char *dirName); + void dirCom(); + void useMon(); + bool execCommand(); + + // from newplace.cpp + void getUnderCentre(); + void putUnderCentre(); + void showArrows(); + uint8 getLocation(uint8 index); + void setLocation(uint8 index); + void clearLocation(uint8 index); + void resetLocation(uint8 index); + void readCityPic(); + void readDestIcon(); + void showCity(); + void locationPic(); + void selectLocation(); + void newPlace(); + void nextDest(); + void lastDest(); + void destSelect(); + void lookAtPlace(); + + // from object.cpp + void obIcons(); + void fillRyan(); + void findAllRyan(); + void obToInv(uint8 index, uint8 flag, uint16 x, uint16 y); + void obPicture(); + void removeObFromInv(); + void deleteExObject(uint8 index); + void deleteExFrame(uint8 frameNum); + void deleteExText(uint8 textNum); + void purgeALocation(uint8 index); + const uint8 *getObTextStart(); + void wornError(); + void makeWorn(DynObject *object); + void dropObject(); + ObjectRef findOpenPos(); + byte getOpenedSlotSize(); + byte getOpenedSlotCount(); + void openOb(); + void findAllOpen(); + void fillOpen(); + ObjectRef findInvPos(); + void reExFromInv(); + void swapWithInv(); + void transferText(uint8 from, uint8 to); + void pickupConts(uint8 from, uint8 containerEx); + byte transferToEx(uint8 from); + void swapWithOpen(); + void outOfOpen(); + void inToInv(); + void outOfInv(); + bool checkObjectSize(); + void useOpened(); + void setPickup(); + void selectOpenOb(); + void examineOb(bool examineAgain = true); + void selectOb(); + void inventory(); + void identifyOb(); + + // from pathfind.cpp + void turnPathOn(uint8 param); + void turnPathOff(uint8 param); + void turnAnyPathOn(uint8 param, uint8 room); + void turnAnyPathOff(uint8 param, uint8 room); + RoomPaths *getRoomsPaths(); + void faceRightWay(); + void setWalk(); + void autoSetWalk(); + void checkDest(const RoomPaths *roomsPaths); + void findXYFromPath(); + bool checkIfPathIsOn(uint8 index); + void bresenhams(); + void workoutFrames(); + byte findFirstPath(byte x, byte y); + byte findPathOfPoint(byte x, byte y); + + // from people.cpp + void setupInitialReelRoutines(); + void updatePeople(); + void madmanText(); + void madman(ReelRoutine &routine); + void madMode(); + void addToPeopleList(ReelRoutine *routine); + bool checkSpeed(ReelRoutine &routine); + void sparkyDrip(ReelRoutine &routine); + void genericPerson(ReelRoutine &routine); + void gamer(ReelRoutine &routine); + void eden(ReelRoutine &routine); + void sparky(ReelRoutine &routine); + void rockstar(ReelRoutine &routine); + void madmansTelly(ReelRoutine &routine); + void smokeBloke(ReelRoutine &routine); + void manAsleep(ReelRoutine &routine); + void drunk(ReelRoutine &routine); + void introMagic1(ReelRoutine &routine); + void introMagic2(ReelRoutine &routine); + void introMagic3(ReelRoutine &routine); + void introMusic(ReelRoutine &routine); + void candles(ReelRoutine &routine); + void candles1(ReelRoutine &routine); + void candles2(ReelRoutine &routine); + void smallCandle(ReelRoutine &routine); + void gates(ReelRoutine &routine); + void security(ReelRoutine &routine); + void edenInBath(ReelRoutine &routine); + void louis(ReelRoutine &routine); + void handClap(ReelRoutine &routine); + void carParkDrip(ReelRoutine &routine); + void foghornSound(ReelRoutine &routine); + void train(ReelRoutine &routine); + void attendant(ReelRoutine &routine); + void keeper(ReelRoutine &routine); + void interviewer(ReelRoutine &routine); + void drinker(ReelRoutine &routine); + void alleyBarkSound(ReelRoutine &routine); + void louisChair(ReelRoutine &routine); + void bossMan(ReelRoutine &routine); + void priest(ReelRoutine &routine); + void monkAndRyan(ReelRoutine &routine); + void copper(ReelRoutine &routine); + void introMonks1(ReelRoutine &routine); + void introMonks2(ReelRoutine &routine); + void soldier1(ReelRoutine &routine); + void receptionist(ReelRoutine &routine); + void bartender(ReelRoutine &routine); + void heavy(ReelRoutine &routine); + void helicopter(ReelRoutine &routine); + void mugger(ReelRoutine &routine); + void businessMan(ReelRoutine &routine); + void endGameSeq(ReelRoutine &routine); + void poolGuard(ReelRoutine &routine); + + // from print.cpp + uint8 getNextWord(const GraphicsFile &charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount); + void printChar(const GraphicsFile &charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height); + void printChar(const GraphicsFile &charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height); + void printBoth(const GraphicsFile &charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar); + uint8 printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered); + uint8 printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered); + uint8 getNumber(const GraphicsFile &charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16 *offset); + uint8 kernChars(uint8 firstChar, uint8 secondChar, uint8 width); + uint8 printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered); + uint16 waitFrames(); + void printCurs(); + void delCurs(); + void rollEndCreditsGameWon(); + void rollEndCreditsGameLost(); + + // from saveload.cpp + void loadGame(); + void doLoad(int slot); + void saveGame(); + void namesToOld(); + void oldToNames(); + void saveLoad(); + void doSaveLoad(); + void showMainOps(); + void showDiscOps(); + void discOps(); + void actualSave(); + void actualLoad(); + void loadPosition(unsigned int slot); + void savePosition(unsigned int slot, const char *descbuf); + uint scanForNames(); + void loadOld(); + void showDecisions(); + void loadSaveBox(); + void showNames(); + void checkInput(); + void selectSlot(); + void showSlots(); + void showOpBox(); + void showSaveOps(); + void showLoadOps(); + + // from sound.cpp + bool loadSpeech(byte type1, int idx1, byte type2, int idx2); + void volumeAdjust(); + void cancelCh0(); + void cancelCh1(); + void loadRoomsSample(); + void playChannel0(uint8 index, uint8 repeat); + void playChannel1(uint8 index); + + // from sprite.cpp + void printSprites(); + void printASprite(const Sprite *sprite); + void clearSprites(); + Sprite *makeSprite(uint8 x, uint8 y, uint16 updateCallback, const GraphicsFile *frameData, uint16 somethingInDi); + void initMan(); + void walking(Sprite *sprite); + void aboutTurn(Sprite *sprite); + void backObject(Sprite *sprite); + void constant(Sprite *sprite, SetObject *objData); + void randomSprite(Sprite *sprite, SetObject *objData); + void doorway(Sprite *sprite, SetObject *objData); + void wideDoor(Sprite *sprite, SetObject *objData); + void doDoor(Sprite *sprite, SetObject *objData, Common::Rect check); + void steady(Sprite *sprite, SetObject *objData); + void lockedDoorway(Sprite *sprite, SetObject *objData); + void liftSprite(Sprite *sprite, SetObject *objData); + + Reel *getReelStart(uint16 reelPointer); + const GraphicsFile *findSource(uint16 &frame); + void showReelFrame(Reel *reel); + void showGameReel(ReelRoutine *routine); + const Frame *getReelFrameAX(uint16 frame); + void moveMap(uint8 param); + void checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY); + + uint8 getBlockOfPixel(uint8 x, uint8 y); + void splitIntoLines(uint8 x, uint8 y); + void initRain(); + + void intro1Text(); + void intro2Text(uint16 nextReelPointer); + void intro3Text(uint16 nextReelPointer); + + void monks2text(); + void textForEnd(); + void textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); + void textForMonk(); + void priestText(ReelRoutine &routine); + void soundOnReels(uint16 reelPointer); + void clearBeforeLoad(); + void clearReels(); + void getRidOfReels(); + void liftNoise(uint8 index); + void checkForExit(Sprite *sprite); + void mainMan(Sprite *sprite); + void spriteUpdate(); + void showRain(); + void reconstruct(); + void reelsOnScreen(); + + // from stubs.cpp + void setupInitialVars(); + bool isCD(); + void crosshair(); + void delTextLine(); + void showBlink(); + void dumpBlink(); + void dumpPointer(); + void showPointer(); + void delPointer(); + void showRyanPage(); + void switchRyanOn(); + void switchRyanOff(); + void middlePanel(); + void showDiary(); + void readMouse(); + uint16 readMouseState(); + void hangOn(uint16 frameCount); + void lockMon(); + uint8 *textUnder(); + void readKey(); + void findOrMake(uint8 index, uint8 value, uint8 type); + DynObject *getFreeAd(uint8 index); + DynObject *getExAd(uint8 index); + DynObject *getEitherAdCPP(); + void *getAnyAdDir(uint8 index, uint8 flag); + void showWatch(); + void showTime(); + void showExit(); + void showMan(); + void panelIcons1(); + SetObject *getSetAd(uint8 index); + void *getAnyAd(uint8 *slotSize, uint8 *slotCount); + const uint8 *getTextInFile1(uint16 index); + uint8 findNextColon(const uint8 **string); + void allocateBuffers(); + void loadTextFile(TextFile &file, const char *fileName); + void loadGraphicsFile(GraphicsFile &file, const char *fileName); + void loadGraphicsSegment(GraphicsFile &file, unsigned int len); + void loadTextSegment(TextFile &file, unsigned int len); + void loadIntoTemp(const char *fileName); + void loadIntoTemp2(const char *fileName); + void loadIntoTemp3(const char *fileName); + void loadTempCharset(const char *fileName); + void loadTravelText(); + void loadTempText(const char *fileName); + void clearAndLoad(uint8 *buf, uint8 c, unsigned int size, unsigned int maxSize); + void sortOutMap(); + void loadRoomData(const Room &room, bool skipDat); + void useTempCharset(); + void useCharset1(); + void printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered); + void printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count); + bool isItDescribed(const ObjPos *objPos); + void zoomIcon(); + void roomName(); + void showIcon(); + void eraseOldObs(); + void commandOnly(uint8 command); + void blank(); + void setTopLeft(); + void setTopRight(); + void setBotLeft(); + void setBotRight(); + void examIcon(); + void animPointer(); + void getFlagUnderP(uint8 *flag, uint8 *flagEx); + void workToScreenM(); + void quitKey(); + void restoreReels(); + void loadFolder(); + void folderHints(); + void folderExit(); + void showFolder(); + void showLeftPage(); + void showRightPage(); + void underTextLine(); + void hangOnP(uint16 count); + void getUnderZoom(); + void putUnderZoom(); + void examineInventory(); + void openInv(); + void getBack1(); + void getBackFromOb(); + void getBackFromOps(); + void getBackToOps(); + void DOSReturn(); + bool isItWorn(const DynObject *object); + bool compare(uint8 index, uint8 flag, const char id[4]); + void hangOnW(uint16 frameCount); + void getRidOfTemp(); + void getRidOfTempText(); + void getRidOfTemp2(); + void getRidOfTemp3(); + void getRidOfTempCharset(); + void getRidOfAll(); + void placeSetObject(uint8 index); + void removeSetObject(uint8 index); + bool isSetObOnMap(uint8 index); + void dumpZoom(); + void diaryKeyP(); + void diaryKeyN(); + void findRoomInLoc(); + void loadMenu(); + void showMenu(); + void dumpMenu(); + void dealWithSpecial(uint8 firstParam, uint8 secondParam); + void plotReel(uint16 &reelPointer); + void setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount); + void getUnderTimed(); + void putUnderTimed(); + void dumpTextLine(); + void useTimedText(); + void dumpTimedText(); + void getTime(); + void doChange(uint8 index, uint8 value, uint8 type); + bool isRyanHolding(const char *id); + void clearBuffers(); + void clearChanges(); + void drawFloor(); + uint16 findSetObject(const char *id); + void hangOnCurs(uint16 frameCount); + const uint8 *findObName(uint8 type, uint8 index); + void copyName(uint8 type, uint8 index, uint8 *dst); + uint16 findExObject(const char *id); + void makeMainScreen(); + void showWatchReel(); + void watchReel(); + void commandWithOb(uint8 command, uint8 type, uint8 index); + void examineObText(); + void blockNameText(); + void personNameText(); + void walkToText(); + void entryTexts(); + void setAllChanges(); + void restoreAll(); + void redrawMainScrn(); + + template + void checkCoords(const RectWithCallback *rectWithCallbacks) { + if (_newLocation != 0xff) + return; + + const RectWithCallback *r; + for (r = rectWithCallbacks; r->_xMin != 0xffff; ++r) { + if (r->contains(_mouseX, _mouseY)) { + (((T *)this)->*(r->_callback))(); + return; + } + } + } + + void newGame(); + void deleteTaken(); + void autoAppear(); + void loadRoom(); + void startLoading(const Room &room); + void startup(); + void atmospheres(); + bool objectMatches(void *object, const char *id); + void checkFolderCoords(); + void nextFolder(); + void lastFolder(); + void lookAtCard(); + void obsThatDoThings(); + void describeOb(); + void putBackObStuff(); + void reExFromOpen(); + void showDiaryPage(); + void showDiaryKeys(); + void dumpDiaryKeys(); + void useMenu(); + void incRyanPage(); + void edensFlatReminders(); + void dropError(); + void cantDrop(); + void entryAnims(); + bool finishedWalking(); + void emergencyPurge(); + void purgeAnItem(); + uint8 nextSymbol(uint8 symbol); + void enterSymbol(); + void showSymbol(); + void updateSymbolTop(); + void updateSymbolBot(); + void pickupOb(uint8 command, uint8 pos); + void errorMessage1(); + void errorMessage2(); + void errorMessage3(); + void decide(); + void allPointer(); + void dumpWatch(); + void watchCount(); + void signOn(); + void searchForFiles(const char *filesString); + void triggerMessage(uint16 index); + void processTrigger(); + void dreamweb(); + void screenUpdate(); + void startup1(); + void quickQuit(); + void readOneBlock(); + void seeCommandTail(); + void quickQuit2(); + bool checkIfPerson(uint8 x, uint8 y); + bool checkIfFree(uint8 x, uint8 y); + bool checkIfEx(uint8 x, uint8 y); + void walkAndExamine(); + void obName(uint8 command, uint8 commandType); + bool checkIfSet(uint8 x, uint8 y); + void readSetData(); + void look(); + void autoLook(); + void doLook(); + void mainScreen(); + void zoomOnOff(); + void initialInv(); + void walkIntoRoom(); + void afterNewRoom(); + void madmanRun(); + void showGun(); + + // from talk.cpp + void talk(); + void convIcons(); + uint16 getPersFrame(uint8 index); + const uint8 *getPersonText(uint8 index, uint8 talkPos); + void startTalk(); + void moreTalk(); + void doSomeTalk(); + bool hangOnPQ(); + void redes(); + + // from titles.cpp + void endGame(); + void monkSpeaking(); + void gettingShot(); + void bibleQuote(); + void hangOne(uint16 delay); + void intro(); + void runIntroSeq(); + void runEndSeq(); + void loadIntroRoom(); + void set16ColPalette(); + void realCredits(); + uint8 getExPos(); + + // from use.cpp + void useRoutine(); + void useObject(); + void placeFreeObject(uint8 index); + void removeFreeObject(uint8 index); + void setupTimedUse(uint16 offset, uint16 countToTimed, uint16 timeCount, byte x, byte y); + void withWhat(); + uint16 checkInside(uint16 command, uint16 type); + void showPuzText(uint16 command, uint16 count); + void useText(const uint8 *string); + void showFirstUse(); + void showSecondUse(); + void viewFolder(); + void edensCDPlayer(); + void hotelBell(); + void playGuitar(); + void useElevator1(); + void useElevator2(); + void useElevator3(); + void useElevator4(); + void useElevator5(); + void useHatch(); + void wheelSound(); + void callHotelLift(); + void useShield(); + void useCoveredBox(); + void useRailing(); + void useChurchHole(); + void sitDownInBar(); + void useBalcony(); + void useWindow(); + void trapDoor(); + void useDryer(); + void callEdensDLift(); + void callEdensLift(); + void openYourNeighbour(); + void openRyan(); + void openPoolBoss(); + void openEden(); + void openSarters(); + void openLouis(); + void useWall(); + void useChurchGate(); + void useLadder(); + void useLadderB(); + bool defaultUseHandler(const char *id); + void slabDoorA(); + void slabDoorB(); + void slabDoorC(); + void slabDoorE(); + void slabDoorD(); + void slabDoorF(); + void useGun(); + void useFullCart(); + void useClearBox(); + void openTVDoor(); + void usePlate(); + void usePlinth(); + void useElvDoor(); + void useWinch(); + void useCart(); + void useHole(); + void openHotelDoor(); + void openHotelDoor2(); + void grafittiDoor(); + void useCardReader1(); + void useCardReader2(); + void useCardReader3(); + void usePoolReader(); + void useLighter(); + void useWire(); + void openTomb(); + void hotelControl(); + void useCooker(); + void useDiary(); + void useControl(); + void useSlab(); + void usePipe(); + void useOpenBox(); + void runTap(); + void useAxe(); + void useHandle(); + void useAltar(); + void notHeldError(); + void useCashCard(); + void useButtonA(); + void wearWatch(); + void wearShades(); + void useTrainer(); + void useStereo(); + void chewy(); + void delEverything(); + void afterIntroRoom(); + + // from vgafades.cpp + void clearStartPal(); + void clearEndPal(); + void palToStartPal(); + void endPalToStart(); + void startPalToEnd(); + void palToEndPal(); + void fadeDOS(); + void doFade(); + void fadeCalculation(); + void fadeUpYellows(); + void fadeUpMonFirst(); + void fadeUpMon(); + void fadeDownMon(); + void initialMonCols(); + void fadeScreenUp(); + void fadeScreenUps(); + void fadeScreenUpHalf(); + void fadeScreenDown(); + void fadeScreenDowns(); + void fadeScreenDownHalf(); + void clearPalette(); + void greyscaleSum(); + void allPalette(); + void dumpCurrent(); + + // from vgagrafx.cpp + inline uint8 *workspace() { return _workspace; } + void clearWork(); + + void panelToMap(); + void mapToPanel(); + void dumpMap(); + void transferFrame(uint8 from, uint8 to, uint8 offset); + void zoom(); + void multiGet(uint8 *dst, uint16 x, uint16 y, uint8 width, uint8 height); + void multiPut(const uint8 *src, uint16 x, uint16 y, uint8 width, uint8 height); + void multiDump(uint16 x, uint16 y, uint8 width, uint8 height); + void workToScreen(); + void printUnderMon(); + void frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y); + void frameOutNm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); + void frameOutBh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); + void frameOutFx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y); + void doShake(); + void vSync(); + void setMode(); + void showPCX(const Common::String &name); + void showFrameInternal(const uint8 *pSrc, uint16 x, uint16 y, uint8 effectsFlag, uint8 width, uint8 height); + void showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height); + void showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag); + bool pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y); + void loadPalFromIFF(); + void createPanel(); + void createPanel2(); + void showPanel(); }; } // End of namespace DreamWeb diff --git a/engines/dreamweb/keypad.cpp b/engines/dreamweb/keypad.cpp index 864cc8e8fa..731c58f2f8 100644 --- a/engines/dreamweb/keypad.cpp +++ b/engines/dreamweb/keypad.cpp @@ -22,20 +22,20 @@ #include "dreamweb/dreamweb.h" -namespace DreamGen { +namespace DreamWeb { const uint16 kKeypadx = 36+112; const uint16 kKeypady = 72; -void DreamBase::getUnderMenu() { +void DreamWebEngine::getUnderMenu() { multiGet(_underTimedText, kMenux, kMenuy, 48, 48); } -void DreamBase::putUnderMenu() { +void DreamWebEngine::putUnderMenu() { multiPut(_underTimedText, kMenux, kMenuy, 48, 48); } -void DreamBase::singleKey(uint8 key, uint16 x, uint16 y) { +void DreamWebEngine::singleKey(uint8 key, uint16 x, uint16 y) { if (key == _graphicPress) { key += 11; if (_pressCount < 8) @@ -45,11 +45,11 @@ void DreamBase::singleKey(uint8 key, uint16 x, uint16 y) { showFrame(_tempGraphics, x, y, key, 0); } -void DreamBase::loadKeypad() { +void DreamWebEngine::loadKeypad() { loadIntoTemp("DREAMWEB.G02"); } -void DreamBase::showKeypad() { +void DreamWebEngine::showKeypad() { singleKey(22, kKeypadx+9, kKeypady+5); singleKey(23, kKeypadx+31, kKeypady+5); singleKey(24, kKeypadx+53, kKeypady+5); @@ -78,13 +78,13 @@ void DreamBase::showKeypad() { } } -bool DreamBase::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { +bool DreamWebEngine::isItRight(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { return digit0 == _pressList[0] && digit1 == _pressList[1] && digit2 == _pressList[2] && digit3 == _pressList[3]; } -void DreamBase::addToPressList() { +void DreamWebEngine::addToPressList() { if (_pressPointer == 5) return; uint8 pressed = _pressed; @@ -95,21 +95,21 @@ void DreamBase::addToPressList() { ++_pressPointer; } -void DreamBase::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { - RectWithCallback keypadList[] = { - { kKeypadx+9,kKeypadx+30,kKeypady+9,kKeypady+22,&DreamBase::buttonOne }, - { kKeypadx+31,kKeypadx+52,kKeypady+9,kKeypady+22,&DreamBase::buttonTwo }, - { kKeypadx+53,kKeypadx+74,kKeypady+9,kKeypady+22,&DreamBase::buttonThree }, - { kKeypadx+9,kKeypadx+30,kKeypady+23,kKeypady+40,&DreamBase::buttonFour }, - { kKeypadx+31,kKeypadx+52,kKeypady+23,kKeypady+40,&DreamBase::buttonFive }, - { kKeypadx+53,kKeypadx+74,kKeypady+23,kKeypady+40,&DreamBase::buttonSix }, - { kKeypadx+9,kKeypadx+30,kKeypady+41,kKeypady+58,&DreamBase::buttonSeven }, - { kKeypadx+31,kKeypadx+52,kKeypady+41,kKeypady+58,&DreamBase::buttonEight }, - { kKeypadx+53,kKeypadx+74,kKeypady+41,kKeypady+58,&DreamBase::buttonNine }, - { kKeypadx+9,kKeypadx+30,kKeypady+59,kKeypady+73,&DreamBase::buttonNought }, - { kKeypadx+31,kKeypadx+74,kKeypady+59,kKeypady+73,&DreamBase::buttonEnter }, - { kKeypadx+72,kKeypadx+86,kKeypady+80,kKeypady+94,&DreamBase::quitKey }, - { 0,320,0,200,&DreamBase::blank }, +void DreamWebEngine::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3) { + RectWithCallback keypadList[] = { + { kKeypadx+9,kKeypadx+30,kKeypady+9,kKeypady+22,&DreamWebEngine::buttonOne }, + { kKeypadx+31,kKeypadx+52,kKeypady+9,kKeypady+22,&DreamWebEngine::buttonTwo }, + { kKeypadx+53,kKeypadx+74,kKeypady+9,kKeypady+22,&DreamWebEngine::buttonThree }, + { kKeypadx+9,kKeypadx+30,kKeypady+23,kKeypady+40,&DreamWebEngine::buttonFour }, + { kKeypadx+31,kKeypadx+52,kKeypady+23,kKeypady+40,&DreamWebEngine::buttonFive }, + { kKeypadx+53,kKeypadx+74,kKeypady+23,kKeypady+40,&DreamWebEngine::buttonSix }, + { kKeypadx+9,kKeypadx+30,kKeypady+41,kKeypady+58,&DreamWebEngine::buttonSeven }, + { kKeypadx+31,kKeypadx+52,kKeypady+41,kKeypady+58,&DreamWebEngine::buttonEight }, + { kKeypadx+53,kKeypadx+74,kKeypady+41,kKeypady+58,&DreamWebEngine::buttonNine }, + { kKeypadx+9,kKeypadx+30,kKeypady+59,kKeypady+73,&DreamWebEngine::buttonNought }, + { kKeypadx+31,kKeypadx+74,kKeypady+59,kKeypady+73,&DreamWebEngine::buttonEnter }, + { kKeypadx+72,kKeypadx+86,kKeypady+80,kKeypady+94,&DreamWebEngine::quitKey }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; @@ -167,51 +167,51 @@ void DreamBase::enterCode(uint8 digit0, uint8 digit1, uint8 digit2, uint8 digit3 workToScreenM(); } -void DreamBase::buttonOne() { +void DreamWebEngine::buttonOne() { buttonPress(1); } -void DreamBase::buttonTwo() { +void DreamWebEngine::buttonTwo() { buttonPress(2); } -void DreamBase::buttonThree() { +void DreamWebEngine::buttonThree() { buttonPress(3); } -void DreamBase::buttonFour() { +void DreamWebEngine::buttonFour() { buttonPress(4); } -void DreamBase::buttonFive() { +void DreamWebEngine::buttonFive() { buttonPress(5); } -void DreamBase::buttonSix() { +void DreamWebEngine::buttonSix() { buttonPress(6); } -void DreamBase::buttonSeven() { +void DreamWebEngine::buttonSeven() { buttonPress(7); } -void DreamBase::buttonEight() { +void DreamWebEngine::buttonEight() { buttonPress(8); } -void DreamBase::buttonNine() { +void DreamWebEngine::buttonNine() { buttonPress(9); } -void DreamBase::buttonNought() { +void DreamWebEngine::buttonNought() { buttonPress(10); } -void DreamBase::buttonEnter() { +void DreamWebEngine::buttonEnter() { buttonPress(11); } -void DreamBase::buttonPress(uint8 buttonId) { +void DreamWebEngine::buttonPress(uint8 buttonId) { uint8 commandType = 100 + buttonId; if (_commandType != commandType) { _commandType = commandType; @@ -226,28 +226,28 @@ void DreamBase::buttonPress(uint8 buttonId) { } } -void DreamBase::showOuterPad() { +void DreamWebEngine::showOuterPad() { showFrame(_tempGraphics, kKeypadx-3, kKeypady-4, 1, 0); showFrame(_tempGraphics, kKeypadx+74, kKeypady+76, 37, 0); } -void DreamBase::dumpKeypad() { +void DreamWebEngine::dumpKeypad() { multiDump(kKeypadx - 3, kKeypady - 4, 120, 90); } -void DreamBase::dumpSymbol() { +void DreamWebEngine::dumpSymbol() { _newTextLine = 0; multiDump(kSymbolx, kSymboly + 20, 104, 60); } -void DreamBase::dumpSymBox() { +void DreamWebEngine::dumpSymBox() { if (_dumpX != 0xFFFF) { multiDump(_dumpX, _dumpY, 30, 77); _dumpX = 0xFFFF; } } -void DreamBase::quitSymbol() { +void DreamWebEngine::quitSymbol() { if (_symbolTopX != 24 || _symbolBotX != 24) { blank(); return; @@ -267,4 +267,4 @@ void DreamBase::quitSymbol() { _getBack = 1; } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/monitor.cpp b/engines/dreamweb/monitor.cpp index 0f6d42040d..2464326e7d 100644 --- a/engines/dreamweb/monitor.cpp +++ b/engines/dreamweb/monitor.cpp @@ -22,7 +22,7 @@ #include "dreamweb/dreamweb.h" -namespace DreamGen { +namespace DreamWeb { struct MonitorKeyEntry { uint8 keyAssigned; @@ -38,7 +38,7 @@ static MonitorKeyEntry monitorKeyEntries[4] = { { 0, "BECKETT", "SEPTIMUS" } }; -void DreamBase::useMon() { +void DreamWebEngine::useMon() { _vars._lastTrigger = 0; _currentFile[0] = 34; memset(_currentFile+1, ' ', 12); @@ -104,7 +104,7 @@ void DreamBase::useMon() { workToScreenM(); } -bool DreamBase::execCommand() { +bool DreamWebEngine::execCommand() { static const char *comlist[] = { "EXIT", "HELP", @@ -170,7 +170,7 @@ bool DreamBase::execCommand() { -void DreamBase::monitorLogo() { +void DreamWebEngine::monitorLogo() { if (_logoNum != _oldLogoNum) { _oldLogoNum = _logoNum; //fadeDownMon(); // FIXME: Commented out in ASM @@ -187,12 +187,12 @@ void DreamBase::monitorLogo() { } } -void DreamBase::printLogo() { +void DreamWebEngine::printLogo() { showFrame(_tempGraphics, 56, 32, 0, 0); showCurrentFile(); } -void DreamBase::input() { +void DreamWebEngine::input() { memset(_inputLine, 0, 64); _curPos = 0; printChar(_tempCharset, _monAdX, _monAdY, '>', 0, NULL, NULL); @@ -235,14 +235,14 @@ void DreamBase::input() { } } -byte DreamBase::makeCaps(byte c) { +byte DreamWebEngine::makeCaps(byte c) { // TODO: Replace calls to this by toupper() ? if (c >= 'a') c -= 'a' - 'A'; // = 32 return c; } -void DreamBase::delChar() { +void DreamWebEngine::delChar() { --_curPos; _inputLine[_curPos * 2] = 0; uint8 width = _inputLine[_curPos * 2 + 1]; @@ -254,7 +254,7 @@ void DreamBase::delChar() { multiDump(_monAdX, _monAdY, 8, 8); } -void DreamBase::printCurs() { +void DreamWebEngine::printCurs() { uint16 x = _cursLocX; uint16 y = _cursLocY; uint16 height; @@ -270,7 +270,7 @@ void DreamBase::printCurs() { multiDump(x - 6, y, 12, height); } -void DreamBase::delCurs() { +void DreamWebEngine::delCurs() { uint16 x = _cursLocX; uint16 y = _cursLocY; uint16 width = 6; @@ -284,38 +284,38 @@ void DreamBase::delCurs() { multiDump(x, y, width, height); } -void DreamBase::scrollMonitor() { +void DreamWebEngine::scrollMonitor() { printLogo(); printUnderMon(); workToScreen(); playChannel1(25); } -void DreamBase::showCurrentFile() { +void DreamWebEngine::showCurrentFile() { uint16 x = 178; // TODO: Looks like this hardcoded constant in the asm doesn't match the frame const char *currentFile = _currentFile + 1; while (*currentFile) { char c = *currentFile++; - c = engine->modifyChar(c); + c = modifyChar(c); printChar(_tempCharset, &x, 37, c, 0, NULL, NULL); } } -void DreamBase::accessLightOn() { +void DreamWebEngine::accessLightOn() { showFrame(_tempGraphics, 74, 182, 8, 0); multiDump(74, 182, 12, 8); } -void DreamBase::accessLightOff() { +void DreamWebEngine::accessLightOff() { showFrame(_tempGraphics, 74, 182, 7, 0); multiDump(74, 182, 12, 8); } -void DreamBase::randomAccess(uint16 count) { +void DreamWebEngine::randomAccess(uint16 count) { for (uint16 i = 0; i < count; ++i) { vSync(); vSync(); - uint16 v = engine->randomNumber() & 15; + uint16 v = randomNumber() & 15; if (v < 10) accessLightOff(); else @@ -324,7 +324,7 @@ void DreamBase::randomAccess(uint16 count) { accessLightOff(); } -void DreamBase::monMessage(uint8 index) { +void DreamWebEngine::monMessage(uint8 index) { assert(index > 0); const char *string = _textFile1._text; for (uint8 i = 0; i < index; ++i) { @@ -334,32 +334,32 @@ void DreamBase::monMessage(uint8 index) { monPrint(string); } -void DreamBase::netError() { +void DreamWebEngine::netError() { monMessage(5); scrollMonitor(); } -void DreamBase::powerLightOn() { +void DreamWebEngine::powerLightOn() { showFrame(_tempGraphics, 257+4, 182, 6, 0); multiDump(257+4, 182, 12, 8); } -void DreamBase::powerLightOff() { +void DreamWebEngine::powerLightOff() { showFrame(_tempGraphics, 257+4, 182, 5, 0); multiDump(257+4, 182, 12, 8); } -void DreamBase::lockLightOn() { +void DreamWebEngine::lockLightOn() { showFrame(_tempGraphics, 56, 182, 10, 0); multiDump(58, 182, 12, 8); } -void DreamBase::lockLightOff() { +void DreamWebEngine::lockLightOff() { showFrame(_tempGraphics, 56, 182, 9, 0); multiDump(58, 182, 12, 8); } -void DreamBase::turnOnPower() { +void DreamWebEngine::turnOnPower() { for (size_t i = 0; i < 3; ++i) { powerLightOn(); hangOn(30); @@ -369,21 +369,21 @@ void DreamBase::turnOnPower() { powerLightOn(); } -void DreamBase::printOuterMon() { +void DreamWebEngine::printOuterMon() { showFrame(_tempGraphics, 40, 32, 1, 0); showFrame(_tempGraphics, 264, 32, 2, 0); showFrame(_tempGraphics, 40, 12, 3, 0); showFrame(_tempGraphics, 40, 164, 4, 0); } -void DreamBase::loadPersonal() { +void DreamWebEngine::loadPersonal() { if (_vars._location == 0 || _vars._location == 42) loadTextFile(_textFile1, "DREAMWEB.T01"); // monitor file 1 else loadTextFile(_textFile1, "DREAMWEB.T02"); // monitor file 2 } -void DreamBase::loadNews() { +void DreamWebEngine::loadNews() { // textfile2 holds information accessible by anyone if (_vars._newsItem == 0) loadTextFile(_textFile2, "DREAMWEB.T10"); // monitor file 10 @@ -395,7 +395,7 @@ void DreamBase::loadNews() { loadTextFile(_textFile2, "DREAMWEB.T13"); // monitor file 13 } -void DreamBase::loadCart() { +void DreamWebEngine::loadCart() { byte cartridgeId = 0; uint16 objectIndex = findSetObject("INTF"); uint16 cartridgeIndex = checkInside(objectIndex, 1); @@ -414,7 +414,7 @@ void DreamBase::loadCart() { loadTextFile(_textFile3, "DREAMWEB.T24"); // monitor file 24 } -void DreamBase::showKeys() { +void DreamWebEngine::showKeys() { randomAccess(10); scrollMonitor(); monMessage(18); @@ -427,7 +427,7 @@ void DreamBase::showKeys() { scrollMonitor(); } -const char *DreamBase::getKeyAndLogo(const char *foundString) { +const char *DreamWebEngine::getKeyAndLogo(const char *foundString) { byte newLogo = foundString[1] - 48; byte keyNum = foundString[3] - 48; @@ -443,7 +443,7 @@ const char *DreamBase::getKeyAndLogo(const char *foundString) { } } -const char *DreamBase::searchForString(const char *topic, const char *text) { +const char *DreamWebEngine::searchForString(const char *topic, const char *text) { char delim = *topic; while (true) { @@ -467,7 +467,7 @@ const char *DreamBase::searchForString(const char *topic, const char *text) { } } -void DreamBase::dirCom() { +void DreamWebEngine::dirCom() { randomAccess(30); const char *dirname = parser(); @@ -487,7 +487,7 @@ void DreamBase::dirCom() { scrollMonitor(); } -void DreamBase::dirFile(const char *dirName) { +void DreamWebEngine::dirFile(const char *dirName) { char topic[14]; memcpy(topic, dirName, 14); @@ -532,7 +532,7 @@ void DreamBase::dirFile(const char *dirName) { } } -void DreamBase::read() { +void DreamWebEngine::read() { randomAccess(40); const char *name = parser(); if (name[1] == 0) { @@ -588,7 +588,7 @@ void DreamBase::read() { } } -void DreamBase::signOn() { +void DreamWebEngine::signOn() { const char *name = parser(); int8 foundIndex = -1; @@ -646,7 +646,7 @@ void DreamBase::signOn() { } } -void DreamBase::searchForFiles(const char *filesString) { +void DreamWebEngine::searchForFiles(const char *filesString) { byte curChar; while (true) { @@ -659,7 +659,7 @@ void DreamBase::searchForFiles(const char *filesString) { } } -const char *DreamBase::parser() { +const char *DreamWebEngine::parser() { char *output = _operand1; memset(output, 0, 14); @@ -697,4 +697,4 @@ const char *DreamBase::parser() { return _operand1; } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/newplace.cpp b/engines/dreamweb/newplace.cpp index a460d2879e..6e8abca6ac 100644 --- a/engines/dreamweb/newplace.cpp +++ b/engines/dreamweb/newplace.cpp @@ -22,9 +22,9 @@ #include "dreamweb/dreamweb.h" -namespace DreamGen { +namespace DreamWeb { -void DreamBase::newPlace() { +void DreamWebEngine::newPlace() { if (_vars._needToTravel == 1) { _vars._needToTravel = 0; selectLocation(); @@ -34,7 +34,7 @@ void DreamBase::newPlace() { } } -void DreamBase::selectLocation() { +void DreamWebEngine::selectLocation() { _inMapArea = 0; clearBeforeLoad(); _getBack = 0; @@ -72,13 +72,13 @@ void DreamBase::selectLocation() { if (_getBack == 1) break; - RectWithCallback destList[] = { - { 238,258,4,44,&DreamBase::nextDest }, - { 104,124,4,44,&DreamBase::lastDest }, - { 280,308,4,44,&DreamBase::lookAtPlace }, - { 104,216,138,192,&DreamBase::destSelect }, - { 273,320,157,198,&DreamBase::getBack1 }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback destList[] = { + { 238,258,4,44,&DreamWebEngine::nextDest }, + { 104,124,4,44,&DreamWebEngine::lastDest }, + { 280,308,4,44,&DreamWebEngine::lookAtPlace }, + { 104,216,138,192,&DreamWebEngine::destSelect }, + { 273,320,157,198,&DreamWebEngine::getBack1 }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(destList); @@ -96,13 +96,13 @@ void DreamBase::selectLocation() { _travelText.clear(); } -void DreamBase::showCity() { +void DreamWebEngine::showCity() { clearWork(); showFrame(_tempGraphics, 57, 32, 0, 0); showFrame(_tempGraphics, 120+57, 32, 1, 0); } -void DreamBase::lookAtPlace() { +void DreamWebEngine::lookAtPlace() { if (_commandType != 224) { _commandType = 224; commandOnly(27); @@ -133,15 +133,15 @@ void DreamBase::lookAtPlace() { workToScreenM(); } -void DreamBase::getUnderCentre() { +void DreamWebEngine::getUnderCentre() { multiGet(_mapStore, 58, 72, 254, 110); } -void DreamBase::putUnderCentre() { +void DreamWebEngine::putUnderCentre() { multiPut(_mapStore, 58, 72, 254, 110); } -void DreamBase::locationPic() { +void DreamWebEngine::locationPic() { const int roomPics[] = { 5, 0, 3, 2, 4, 1, 10, 9, 8, 6, 11, 4, 7, 7, 0 }; byte picture = roomPics[_destPos]; @@ -154,16 +154,16 @@ void DreamBase::locationPic() { showFrame(_tempGraphics, 104, 140 + 14, 3, 0); // Currently in this location const uint8 *string = (const uint8 *)_travelText.getString(_destPos); - DreamBase::printDirect(string, 50, 20, 241, 241 & 1); + DreamWebEngine::printDirect(string, 50, 20, 241, 241 & 1); } -void DreamBase::showArrows() { +void DreamWebEngine::showArrows() { showFrame(_tempGraphics, 116 - 12, 16, 0, 0); showFrame(_tempGraphics, 226 + 12, 16, 1, 0); showFrame(_tempGraphics, 280, 14, 2, 0); } -void DreamBase::nextDest() { +void DreamWebEngine::nextDest() { if (_commandType != 218) { _commandType = 218; commandOnly(28); @@ -192,7 +192,7 @@ void DreamBase::nextDest() { delPointer(); } -void DreamBase::lastDest() { +void DreamWebEngine::lastDest() { if (_commandType != 219) { _commandType = 219; commandOnly(29); @@ -221,7 +221,7 @@ void DreamBase::lastDest() { delPointer(); } -void DreamBase::destSelect() { +void DreamWebEngine::destSelect() { if (_commandType != 222) { _commandType = 222; commandOnly(30); @@ -233,19 +233,19 @@ void DreamBase::destSelect() { _newLocation = _destPos; } -uint8 DreamBase::getLocation(uint8 index) { +uint8 DreamWebEngine::getLocation(uint8 index) { return _roomsCanGo[index]; } -void DreamBase::setLocation(uint8 index) { +void DreamWebEngine::setLocation(uint8 index) { _roomsCanGo[index] = 1; } -void DreamBase::clearLocation(uint8 index) { +void DreamWebEngine::clearLocation(uint8 index) { _roomsCanGo[index] = 0; } -void DreamBase::resetLocation(uint8 index) { +void DreamWebEngine::resetLocation(uint8 index) { if (index == 5) { // delete hotel purgeALocation(5); @@ -270,14 +270,14 @@ void DreamBase::resetLocation(uint8 index) { clearLocation(index); } -void DreamBase::readDestIcon() { +void DreamWebEngine::readDestIcon() { loadIntoTemp("DREAMWEB.G05"); loadIntoTemp2("DREAMWEB.G06"); loadIntoTemp3("DREAMWEB.G08"); } -void DreamBase::readCityPic() { +void DreamWebEngine::readCityPic() { loadIntoTemp("DREAMWEB.G04"); } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/object.cpp b/engines/dreamweb/object.cpp index 555125e9e7..a9cbadcc2c 100644 --- a/engines/dreamweb/object.cpp +++ b/engines/dreamweb/object.cpp @@ -22,14 +22,14 @@ #include "dreamweb/dreamweb.h" -namespace DreamGen { +namespace DreamWeb { -void DreamBase::showRyanPage() { +void DreamWebEngine::showRyanPage() { showFrame(_icons1, kInventx + 167, kInventy - 12, 12, 0); showFrame(_icons1, kInventx + 167 + 18 * _vars._ryanPage, kInventy - 12, 13 + _vars._ryanPage, 0); } -void DreamBase::findAllRyan() { +void DreamWebEngine::findAllRyan() { memset(_ryanInvList, 0xff, 60); for (size_t i = 0; i < kNumexobjects; ++i) { const DynObject *extra = getExAd(i); @@ -44,7 +44,7 @@ void DreamBase::findAllRyan() { } } -void DreamBase::fillRyan() { +void DreamWebEngine::fillRyan() { ObjectRef *inv = &_ryanInvList[_vars._ryanPage * 10]; findAllRyan(); for (size_t i = 0; i < 2; ++i) { @@ -56,11 +56,11 @@ void DreamBase::fillRyan() { showRyanPage(); } -bool DreamBase::isItWorn(const DynObject *object) { +bool DreamWebEngine::isItWorn(const DynObject *object) { return (object->id[0] == 'W'-'A') && (object->id[1] == 'E'-'A'); } -void DreamBase::wornError() { +void DreamWebEngine::wornError() { _commandType = 255; delPointer(); printMessage(76, 21, 57, 240, false); @@ -73,12 +73,12 @@ void DreamBase::wornError() { workToScreenM(); } -void DreamBase::makeWorn(DynObject *object) { +void DreamWebEngine::makeWorn(DynObject *object) { object->id[0] = 'W'-'A'; object->id[1] = 'E'-'A'; } -void DreamBase::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { +void DreamWebEngine::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { showFrame(_icons1, x - 2, y - 1, 10, 0); if (index == 0xff) return; @@ -94,7 +94,7 @@ void DreamBase::obToInv(uint8 index, uint8 flag, uint16 x, uint16 y) { showFrame(_icons1, x - 3, y - 2, 7, 0); } -void DreamBase::obPicture() { +void DreamWebEngine::obPicture() { if (_objectType == kSetObjectType1) return; uint8 frame = 3 * _command + 1; @@ -104,7 +104,7 @@ void DreamBase::obPicture() { showFrame(_freeFrames, 160, 68, frame, 0x80); } -void DreamBase::obIcons() { +void DreamWebEngine::obIcons() { uint8 value1, value2; getAnyAd(&value1, &value2); if (value1 != 0xff) { @@ -115,7 +115,7 @@ void DreamBase::obIcons() { showFrame(_icons2, 260, 1, 1, 0); } -void DreamBase::examineOb(bool examineAgain) { +void DreamWebEngine::examineOb(bool examineAgain) { _pointerMode = 0; _timeCount = 0; @@ -155,13 +155,13 @@ void DreamBase::examineOb(bool examineAgain) { switch (_invOpen) { case 0: { - RectWithCallback examList[] = { - { 273,320,157,198,&DreamBase::getBackFromOb }, - { 260,300,0,44,&DreamBase::useObject }, - { 210,254,0,44,&DreamBase::selectOpenOb }, - { 144,176,64,96,&DreamBase::setPickup }, - { 0,50,50,200,&DreamBase::examineInventory }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback examList[] = { + { 273,320,157,198,&DreamWebEngine::getBackFromOb }, + { 260,300,0,44,&DreamWebEngine::useObject }, + { 210,254,0,44,&DreamWebEngine::selectOpenOb }, + { 144,176,64,96,&DreamWebEngine::setPickup }, + { 0,50,50,200,&DreamWebEngine::examineInventory }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(examList); @@ -169,24 +169,24 @@ void DreamBase::examineOb(bool examineAgain) { } case 1: { // Note: This table contains the non-constant _openChangeSize! - RectWithCallback invList1[] = { - { 273,320,157,198,&DreamBase::getBackFromOb }, - { 255,294,0,24,&DreamBase::dropObject }, - { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamBase::incRyanPage }, - { kInventx,_openChangeSize,kInventy+100,kInventy+100+kItempicsize,&DreamBase::useOpened }, - { kInventx,kInventx+(5*kItempicsize),kInventy,kInventy+(2*kItempicsize),&DreamBase::inToInv }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback invList1[] = { + { 273,320,157,198,&DreamWebEngine::getBackFromOb }, + { 255,294,0,24,&DreamWebEngine::dropObject }, + { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamWebEngine::incRyanPage }, + { kInventx,_openChangeSize,kInventy+100,kInventy+100+kItempicsize,&DreamWebEngine::useOpened }, + { kInventx,kInventx+(5*kItempicsize),kInventy,kInventy+(2*kItempicsize),&DreamWebEngine::inToInv }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(invList1); break; } default: { - RectWithCallback withList1[] = { - { 273,320,157,198,&DreamBase::getBackFromOb }, - { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamBase::incRyanPage }, - { kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamBase::selectOb }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback withList1[] = { + { 273,320,157,198,&DreamWebEngine::getBackFromOb }, + { kInventx+167,kInventx+167+(18*3),kInventy-18,kInventy-2,&DreamWebEngine::incRyanPage }, + { kInventx,kInventx+(5*kItempicsize), kInventy,kInventy+(2*kItempicsize),&DreamWebEngine::selectOb }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(withList1); @@ -212,7 +212,7 @@ void DreamBase::examineOb(bool examineAgain) { _openedOb = 255; } -void DreamBase::inventory() { +void DreamWebEngine::inventory() { if (_vars._manDead == 1 || _vars._watchingTime != 0) { blank(); return; @@ -250,7 +250,7 @@ void DreamBase::inventory() { examineOb(false); } -void DreamBase::transferText(uint8 from, uint8 to) { +void DreamWebEngine::transferText(uint8 from, uint8 to) { _exText.setOffset(to, _vars._exTextPos); const char *src = _freeDesc.getString(from); char *dst = _exText._text + _vars._exTextPos; @@ -260,14 +260,14 @@ void DreamBase::transferText(uint8 from, uint8 to) { _vars._exTextPos += len + 1; } -void DreamBase::getBackFromOb() { +void DreamWebEngine::getBackFromOb() { if (_pickUp != 1) getBack1(); else blank(); } -byte DreamBase::getOpenedSlotCount() { +byte DreamWebEngine::getOpenedSlotCount() { byte obj = _openedOb; switch (_openedType) { case 4: @@ -279,7 +279,7 @@ byte DreamBase::getOpenedSlotCount() { } } -byte DreamBase::getOpenedSlotSize() { +byte DreamWebEngine::getOpenedSlotSize() { byte obj = _openedOb; switch (_openedType) { case 4: @@ -291,7 +291,7 @@ byte DreamBase::getOpenedSlotSize() { } } -void DreamBase::openOb() { +void DreamWebEngine::openOb() { uint8 commandLine[64] = "OBJECT NAME ONE "; copyName(_openedType, _openedOb, commandLine); @@ -304,7 +304,7 @@ void DreamBase::openOb() { _openChangeSize = getOpenedSlotCount() * kItempicsize + kInventx; } -void DreamBase::identifyOb() { +void DreamWebEngine::identifyOb() { if (_vars._watchingTime != 0) { blank(); return; @@ -341,7 +341,7 @@ void DreamBase::identifyOb() { blank(); } -ObjectRef DreamBase::findInvPos() { +ObjectRef DreamWebEngine::findInvPos() { uint16 x = _mouseX - kInventx; uint16 y = _mouseY - kInventy; uint8 pos = (x / kItempicsize) + (y / kItempicsize) * 5; @@ -350,7 +350,7 @@ ObjectRef DreamBase::findInvPos() { return _ryanInvList[invPos]; } -void DreamBase::selectOb() { +void DreamWebEngine::selectOb() { ObjectRef objectId = findInvPos(); if (objectId._index == 255) { blank(); @@ -375,7 +375,7 @@ void DreamBase::selectOb() { useRoutine(); } -void DreamBase::setPickup() { +void DreamWebEngine::setPickup() { if (_objectType != kSetObjectType1 && _objectType != kSetObjectType3) { // Object types 1 and 3 are excluded, so the resulting object is a DynObject uint8 dummy; @@ -422,7 +422,7 @@ void DreamBase::setPickup() { workToScreenM(); } -void DreamBase::deleteExFrame(uint8 frameNum) { +void DreamWebEngine::deleteExFrame(uint8 frameNum) { Frame *frame = &_exFrames._frames[frameNum]; uint16 frameSize = frame->width * frame->height; @@ -445,7 +445,7 @@ void DreamBase::deleteExFrame(uint8 frameNum) { } } -void DreamBase::deleteExText(uint8 textNum) { +void DreamWebEngine::deleteExText(uint8 textNum) { uint16 offset = _exText.getOffset(textNum); uint16 startOff = offset; @@ -467,7 +467,7 @@ void DreamBase::deleteExText(uint8 textNum) { } } -void DreamBase::deleteExObject(uint8 index) { +void DreamWebEngine::deleteExObject(uint8 index) { DynObject *obj = getExAd(index); memset(obj, 0xFF, sizeof(DynObject)); @@ -485,7 +485,7 @@ void DreamBase::deleteExObject(uint8 index) { } } -void DreamBase::removeObFromInv() { +void DreamWebEngine::removeObFromInv() { if (_command == 100) return; // object doesn't exist @@ -494,7 +494,7 @@ void DreamBase::removeObFromInv() { deleteExObject(_command); } -void DreamBase::inToInv() { +void DreamWebEngine::inToInv() { if (!_pickUp) { outOfInv(); return; @@ -534,7 +534,7 @@ void DreamBase::inToInv() { delPointer(); } -void DreamBase::outOfInv() { +void DreamWebEngine::outOfInv() { ObjectRef subject = findInvPos(); if (subject._index == 255) { @@ -574,7 +574,7 @@ void DreamBase::outOfInv() { delPointer(); } -void DreamBase::purgeALocation(uint8 index) { +void DreamWebEngine::purgeALocation(uint8 index) { // index == al for (uint8 i = 0; i < kNumexobjects; ++i) { DynObject *t = getExAd(i); @@ -584,7 +584,7 @@ void DreamBase::purgeALocation(uint8 index) { } } -const uint8 *DreamBase::getObTextStart() { +const uint8 *DreamWebEngine::getObTextStart() { const uint16 kSettext = 130*2; const uint16 kFreetext = 82*2; @@ -656,7 +656,7 @@ const uint8 *DreamBase::getObTextStart() { } } -void DreamBase::dropObject() { +void DreamWebEngine::dropObject() { if (_commandType != 223) { _commandType = 223; if (!_pickUp) { @@ -709,7 +709,7 @@ void DreamBase::dropObject() { object->currentLocation = _realLocation; } -bool DreamBase::checkObjectSize() { +bool DreamWebEngine::checkObjectSize() { byte containerSize = getOpenedSlotSize(); DynObject *object = getEitherAdCPP(); // If there is no size defined for the object in the editor, set its size @@ -738,7 +738,7 @@ bool DreamBase::checkObjectSize() { return false; } -void DreamBase::selectOpenOb() { +void DreamWebEngine::selectOpenOb() { uint8 slotSize, slotCount; getAnyAd(&slotSize, &slotCount); if (slotCount == 255) { @@ -771,7 +771,7 @@ void DreamBase::selectOpenOb() { delPointer(); } -void DreamBase::reExFromInv() { +void DreamWebEngine::reExFromInv() { ObjectRef objectId = findInvPos(); _commandType = objectId._type; _command = objectId._index; @@ -779,7 +779,7 @@ void DreamBase::reExFromInv() { _pointerMode = 0; } -void DreamBase::swapWithInv() { +void DreamWebEngine::swapWithInv() { ObjectRef subject; subject._type = _objectType; subject._index = _itemFrame; @@ -819,7 +819,7 @@ void DreamBase::swapWithInv() { delPointer(); } -void DreamBase::useOpened() { +void DreamWebEngine::useOpened() { if (_openedOb == 255) return; // cannot use opened object @@ -883,7 +883,7 @@ void DreamBase::useOpened() { delPointer(); } -void DreamBase::outOfOpen() { +void DreamWebEngine::outOfOpen() { if (_openedOb == 255) return; // cannot use opened object @@ -935,7 +935,7 @@ void DreamBase::outOfOpen() { delPointer(); } -void DreamBase::swapWithOpen() { +void DreamWebEngine::swapWithOpen() { ObjectRef subject; subject._type = _objectType; subject._index = _itemFrame; @@ -1002,14 +1002,14 @@ void DreamBase::swapWithOpen() { delPointer(); } -ObjectRef DreamBase::findOpenPos() { +ObjectRef DreamWebEngine::findOpenPos() { uint8 pos = (_mouseX - kInventx) / kItempicsize; _lastInvPos = pos; return _openInvList[pos]; } -byte DreamBase::transferToEx(uint8 from) { +byte DreamWebEngine::transferToEx(uint8 from) { emergencyPurge(); byte pos = getExPos(); @@ -1037,7 +1037,7 @@ byte DreamBase::transferToEx(uint8 from) { return pos; } -void DreamBase::fillOpen() { +void DreamWebEngine::fillOpen() { delTextLine(); uint8 size = getOpenedSlotCount(); if (size > 4) @@ -1051,7 +1051,7 @@ void DreamBase::fillOpen() { underTextLine(); } -void DreamBase::findAllOpen() { +void DreamWebEngine::findAllOpen() { memset(_openInvList, 0xFF, 32); for (uint8 i = 0; i < kNumexobjects; ++i) { @@ -1080,7 +1080,7 @@ void DreamBase::findAllOpen() { } } -void DreamBase::pickupConts(uint8 from, uint8 containerEx) { +void DreamWebEngine::pickupConts(uint8 from, uint8 containerEx) { const DynObject *obj = getFreeAd(from); if (obj->slotCount == 255) @@ -1112,4 +1112,4 @@ void DreamBase::pickupConts(uint8 from, uint8 containerEx) { } } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp index 908ac001bb..c39070532c 100644 --- a/engines/dreamweb/pathfind.cpp +++ b/engines/dreamweb/pathfind.cpp @@ -22,9 +22,9 @@ #include "dreamweb/dreamweb.h" -namespace DreamGen { +namespace DreamWeb { -void DreamBase::turnPathOn(uint8 param) { +void DreamWebEngine::turnPathOn(uint8 param) { findOrMake(param, 0xff, _roomNum + 100); PathNode *roomsPaths = getRoomsPaths()->nodes; if (param == 0xff) @@ -32,7 +32,7 @@ void DreamBase::turnPathOn(uint8 param) { roomsPaths[param].on = 0xff; } -void DreamBase::turnPathOff(uint8 param) { +void DreamWebEngine::turnPathOff(uint8 param) { findOrMake(param, 0x00, _roomNum + 100); PathNode *roomsPaths = getRoomsPaths()->nodes; if (param == 0xff) @@ -40,28 +40,28 @@ void DreamBase::turnPathOff(uint8 param) { roomsPaths[param].on = 0x00; } -void DreamBase::turnAnyPathOn(uint8 param, uint8 room) { +void DreamWebEngine::turnAnyPathOn(uint8 param, uint8 room) { findOrMake(param, 0xff, room + 100); _pathData[room].nodes[param].on = 0xff; } -void DreamBase::turnAnyPathOff(uint8 param, uint8 room) { +void DreamWebEngine::turnAnyPathOff(uint8 param, uint8 room) { findOrMake(param, 0x00, room + 100); _pathData[room].nodes[param].on = 0x00; } -RoomPaths *DreamBase::getRoomsPaths() { +RoomPaths *DreamWebEngine::getRoomsPaths() { return &_pathData[_roomNum]; } -void DreamBase::faceRightWay() { +void DreamWebEngine::faceRightWay() { PathNode *paths = getRoomsPaths()->nodes; uint8 dir = paths[_mansPath].dir; _turnToFace = dir; _leaveDirection = dir; } -void DreamBase::setWalk() { +void DreamWebEngine::setWalk() { if (_linePointer != 254) { // Already walking _finalDest = _pointersPath; @@ -88,7 +88,7 @@ void DreamBase::setWalk() { } } -void DreamBase::autoSetWalk() { +void DreamWebEngine::autoSetWalk() { if (_finalDest == _mansPath) return; const RoomPaths *roomsPaths = getRoomsPaths(); @@ -106,7 +106,7 @@ void DreamBase::autoSetWalk() { _linePointer = 0; } -void DreamBase::checkDest(const RoomPaths *roomsPaths) { +void DreamWebEngine::checkDest(const RoomPaths *roomsPaths) { const PathSegment *segments = roomsPaths->segments; const uint8 tmp = _mansPath << 4; uint8 destination = _destination; @@ -125,19 +125,19 @@ void DreamBase::checkDest(const RoomPaths *roomsPaths) { _destination = destination; } -void DreamBase::findXYFromPath() { +void DreamWebEngine::findXYFromPath() { const PathNode *roomsPaths = getRoomsPaths()->nodes; _ryanX = roomsPaths[_mansPath].x - 12; _ryanY = roomsPaths[_mansPath].y - 12; } -bool DreamBase::checkIfPathIsOn(uint8 index) { +bool DreamWebEngine::checkIfPathIsOn(uint8 index) { RoomPaths *roomsPaths = getRoomsPaths(); uint8 pathOn = roomsPaths->nodes[index].on; return pathOn == 0xff; } -void DreamBase::bresenhams() { +void DreamWebEngine::bresenhams() { workoutFrames(); Common::Point *lineData = &_lineData[0]; int16 startX = (int16)_lineStartX; @@ -255,7 +255,7 @@ void DreamBase::bresenhams() { } } -void DreamBase::workoutFrames() { +void DreamWebEngine::workoutFrames() { byte tmp; int diffx, diffy; @@ -306,7 +306,7 @@ void DreamBase::workoutFrames() { _turnDirection = 0; } -byte DreamBase::findFirstPath(byte x, byte y) { +byte DreamWebEngine::findFirstPath(byte x, byte y) { PathNode *paths = _pathData[_roomNum].nodes; for (uint8 index = 0; index < 12; index++) { @@ -325,7 +325,7 @@ byte DreamBase::findFirstPath(byte x, byte y) { return 0; } -byte DreamBase::findPathOfPoint(byte x, byte y) { +byte DreamWebEngine::findPathOfPoint(byte x, byte y) { PathNode *paths = _pathData[_roomNum].nodes; for (uint8 index = 0; index < 12; index++) { @@ -347,4 +347,4 @@ byte DreamBase::findPathOfPoint(byte x, byte y) { return 0xff; } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/people.cpp b/engines/dreamweb/people.cpp index cecb6ee9dd..40084a28c4 100644 --- a/engines/dreamweb/people.cpp +++ b/engines/dreamweb/people.cpp @@ -22,38 +22,38 @@ #include "dreamweb/dreamweb.h" -namespace DreamGen { - -static void (DreamBase::*reelCallbacks[57])(ReelRoutine &) = { - &DreamBase::gamer, &DreamBase::sparkyDrip, - &DreamBase::eden, &DreamBase::edenInBath, - &DreamBase::sparky, &DreamBase::smokeBloke, - &DreamBase::manAsleep, &DreamBase::drunk, - &DreamBase::receptionist, &DreamBase::genericPerson /*maleFan*/, - &DreamBase::genericPerson /*femaleFan*/, &DreamBase::louis, - &DreamBase::louisChair, &DreamBase::soldier1, - &DreamBase::bossMan, &DreamBase::interviewer, - &DreamBase::heavy, &DreamBase::manAsleep /*manAsleep2*/, - &DreamBase::genericPerson /*manSatStill*/, &DreamBase::drinker, - &DreamBase::bartender, &DreamBase::genericPerson /*otherSmoker*/, - &DreamBase::genericPerson /*tattooMan*/, &DreamBase::attendant, - &DreamBase::keeper, &DreamBase::candles1, - &DreamBase::smallCandle, &DreamBase::security, - &DreamBase::copper, &DreamBase::poolGuard, - &DreamBase::rockstar, &DreamBase::businessMan, - &DreamBase::train, &DreamBase::genericPerson /*aide*/, - &DreamBase::mugger, &DreamBase::helicopter, - &DreamBase::introMagic1, &DreamBase::introMusic, - &DreamBase::introMagic2, &DreamBase::candles2, - &DreamBase::gates, &DreamBase::introMagic3, - &DreamBase::introMonks1, &DreamBase::candles, - &DreamBase::introMonks2, &DreamBase::handClap, - &DreamBase::monkAndRyan, &DreamBase::endGameSeq, - &DreamBase::priest, &DreamBase::madman, - &DreamBase::madmansTelly, &DreamBase::alleyBarkSound, - &DreamBase::foghornSound, &DreamBase::carParkDrip, - &DreamBase::carParkDrip, &DreamBase::carParkDrip, - &DreamBase::carParkDrip +namespace DreamWeb { + +static void (DreamWebEngine::*reelCallbacks[57])(ReelRoutine &) = { + &DreamWebEngine::gamer, &DreamWebEngine::sparkyDrip, + &DreamWebEngine::eden, &DreamWebEngine::edenInBath, + &DreamWebEngine::sparky, &DreamWebEngine::smokeBloke, + &DreamWebEngine::manAsleep, &DreamWebEngine::drunk, + &DreamWebEngine::receptionist, &DreamWebEngine::genericPerson /*maleFan*/, + &DreamWebEngine::genericPerson /*femaleFan*/, &DreamWebEngine::louis, + &DreamWebEngine::louisChair, &DreamWebEngine::soldier1, + &DreamWebEngine::bossMan, &DreamWebEngine::interviewer, + &DreamWebEngine::heavy, &DreamWebEngine::manAsleep /*manAsleep2*/, + &DreamWebEngine::genericPerson /*manSatStill*/, &DreamWebEngine::drinker, + &DreamWebEngine::bartender, &DreamWebEngine::genericPerson /*otherSmoker*/, + &DreamWebEngine::genericPerson /*tattooMan*/, &DreamWebEngine::attendant, + &DreamWebEngine::keeper, &DreamWebEngine::candles1, + &DreamWebEngine::smallCandle, &DreamWebEngine::security, + &DreamWebEngine::copper, &DreamWebEngine::poolGuard, + &DreamWebEngine::rockstar, &DreamWebEngine::businessMan, + &DreamWebEngine::train, &DreamWebEngine::genericPerson /*aide*/, + &DreamWebEngine::mugger, &DreamWebEngine::helicopter, + &DreamWebEngine::introMagic1, &DreamWebEngine::introMusic, + &DreamWebEngine::introMagic2, &DreamWebEngine::candles2, + &DreamWebEngine::gates, &DreamWebEngine::introMagic3, + &DreamWebEngine::introMonks1, &DreamWebEngine::candles, + &DreamWebEngine::introMonks2, &DreamWebEngine::handClap, + &DreamWebEngine::monkAndRyan, &DreamWebEngine::endGameSeq, + &DreamWebEngine::priest, &DreamWebEngine::madman, + &DreamWebEngine::madmansTelly, &DreamWebEngine::alleyBarkSound, + &DreamWebEngine::foghornSound, &DreamWebEngine::carParkDrip, + &DreamWebEngine::carParkDrip, &DreamWebEngine::carParkDrip, + &DreamWebEngine::carParkDrip }; static const ReelRoutine g_initialReelRoutines[] = { @@ -120,15 +120,15 @@ static const ReelRoutine g_initialReelRoutines[] = { { 255,0,0, 0, 0,0,0 } }; -void DreamBase::setupInitialReelRoutines() { +void DreamWebEngine::setupInitialReelRoutines() { for (unsigned int i = 0; i < kNumReelRoutines + 1; ++i) { _reelRoutines[i] = g_initialReelRoutines[i]; - if (_reelRoutines[i].period == 55 && isCD() && engine->getLanguage() == Common::DE_DEU) + if (_reelRoutines[i].period == 55 && isCD() && getLanguage() == Common::DE_DEU) _reelRoutines[i].period = 65; } } -void DreamBase::updatePeople() { +void DreamWebEngine::updatePeople() { _peopleList.clear(); ++_mainTimer; @@ -142,7 +142,7 @@ void DreamBase::updatePeople() { } } -void DreamBase::madmanText() { +void DreamWebEngine::madmanText() { byte origCount; if (isCD()) { @@ -162,7 +162,7 @@ void DreamBase::madmanText() { setupTimedTemp(47 + origCount, 82, 72, 80, 90, 1); } -void DreamBase::madman(ReelRoutine &routine) { +void DreamWebEngine::madman(ReelRoutine &routine) { _vars._watchingTime = 2; if (checkSpeed(routine)) { uint16 newReelPointer = routine.reelPointer(); @@ -208,7 +208,7 @@ void DreamBase::madman(ReelRoutine &routine) { madMode(); } -void DreamBase::madMode() { +void DreamWebEngine::madMode() { _vars._watchingTime = 2; _pointerMode = 0; if (_vars._combatCount < (isCD() ? 65 : 63)) @@ -218,7 +218,7 @@ void DreamBase::madMode() { _pointerMode = 2; } -void DreamBase::addToPeopleList(ReelRoutine *routine) { +void DreamWebEngine::addToPeopleList(ReelRoutine *routine) { People people; people._reelPointer = routine->reelPointer(); people._routinePointer = routine; @@ -227,7 +227,7 @@ void DreamBase::addToPeopleList(ReelRoutine *routine) { _peopleList.push_back(people); } -bool DreamBase::checkSpeed(ReelRoutine &routine) { +bool DreamWebEngine::checkSpeed(ReelRoutine &routine) { if (_vars._lastWeapon != (uint8)-1) return true; ++routine.counter; @@ -237,21 +237,21 @@ bool DreamBase::checkSpeed(ReelRoutine &routine) { return true; } -void DreamBase::sparkyDrip(ReelRoutine &routine) { +void DreamWebEngine::sparkyDrip(ReelRoutine &routine) { if (checkSpeed(routine)) playChannel0(14, 0); } -void DreamBase::genericPerson(ReelRoutine &routine) { +void DreamWebEngine::genericPerson(ReelRoutine &routine) { showGameReel(&routine); addToPeopleList(&routine); } -void DreamBase::gamer(ReelRoutine &routine) { +void DreamWebEngine::gamer(ReelRoutine &routine) { if (checkSpeed(routine)) { uint8 v; do { - v = 20 + engine->randomNumber() % 5; + v = 20 + randomNumber() % 5; } while (v == routine.reelPointer()); routine.setReelPointer(v); } @@ -260,19 +260,19 @@ void DreamBase::gamer(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamBase::eden(ReelRoutine &routine) { +void DreamWebEngine::eden(ReelRoutine &routine) { if (_vars._generalDead) return; showGameReel(&routine); addToPeopleList(&routine); } -void DreamBase::sparky(ReelRoutine &routine) { +void DreamWebEngine::sparky(ReelRoutine &routine) { if (_vars._card1Money) routine.b7 = 3; if (checkSpeed(routine)) { if (routine.reelPointer() == 34) { - if (engine->randomNumber() < 30) + if (randomNumber() < 30) routine.incReelPointer(); else routine.setReelPointer(27); @@ -289,7 +289,7 @@ void DreamBase::sparky(ReelRoutine &routine) { _vars._talkedToSparky = 1; } -void DreamBase::rockstar(ReelRoutine &routine) { +void DreamWebEngine::rockstar(ReelRoutine &routine) { if ((routine.reelPointer() == 303) || (routine.reelPointer() == 118)) { _newLocation = 45; showGameReel(&routine); @@ -326,7 +326,7 @@ void DreamBase::rockstar(ReelRoutine &routine) { } } -void DreamBase::madmansTelly(ReelRoutine &routine) { +void DreamWebEngine::madmansTelly(ReelRoutine &routine) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 307) nextReelPointer = 300; @@ -335,14 +335,14 @@ void DreamBase::madmansTelly(ReelRoutine &routine) { } -void DreamBase::smokeBloke(ReelRoutine &routine) { +void DreamWebEngine::smokeBloke(ReelRoutine &routine) { if (_vars._rockstarDead == 0) { if (routine.b7 & 128) - DreamBase::setLocation(5); + DreamWebEngine::setLocation(5); } if (checkSpeed(routine)) { if (routine.reelPointer() == 100) { - if (engine->randomNumber() < 30) + if (randomNumber() < 30) routine.incReelPointer(); else routine.setReelPointer(96); @@ -355,20 +355,20 @@ void DreamBase::smokeBloke(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamBase::manAsleep(ReelRoutine &routine) { +void DreamWebEngine::manAsleep(ReelRoutine &routine) { routine.b7 &= 127; showGameReel(&routine); addToPeopleList(&routine); } -void DreamBase::attendant(ReelRoutine &routine) { +void DreamWebEngine::attendant(ReelRoutine &routine) { showGameReel(&routine); addToPeopleList(&routine); if (routine.b7 & 128) _vars._talkedToAttendant = 1; } -void DreamBase::keeper(ReelRoutine &routine) { +void DreamWebEngine::keeper(ReelRoutine &routine) { if (_vars._keeperFlag != 0) { // Not waiting addToPeopleList(&routine); @@ -385,7 +385,7 @@ void DreamBase::keeper(ReelRoutine &routine) { routine.b7 = _vars._dreamNumber; } -void DreamBase::drunk(ReelRoutine &routine) { +void DreamWebEngine::drunk(ReelRoutine &routine) { if (_vars._generalDead) return; routine.b7 &= 127; @@ -393,7 +393,7 @@ void DreamBase::drunk(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamBase::interviewer(ReelRoutine &routine) { +void DreamWebEngine::interviewer(ReelRoutine &routine) { if (_vars._reelToWatch == 68) routine.incReelPointer(); @@ -403,12 +403,12 @@ void DreamBase::interviewer(ReelRoutine &routine) { showGameReel(&routine); } -void DreamBase::drinker(ReelRoutine &routine) { +void DreamWebEngine::drinker(ReelRoutine &routine) { if (checkSpeed(routine)) { routine.incReelPointer(); if ( routine.reelPointer() == 115 || - (routine.reelPointer() == 106 && engine->randomNumber() >= 3)) + (routine.reelPointer() == 106 && randomNumber() >= 3)) routine.setReelPointer(105); } @@ -416,7 +416,7 @@ void DreamBase::drinker(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamBase::alleyBarkSound(ReelRoutine &routine) { +void DreamWebEngine::alleyBarkSound(ReelRoutine &routine) { uint16 prevReelPointer = routine.reelPointer() - 1; if (prevReelPointer == 0) { playChannel1(14); @@ -426,7 +426,7 @@ void DreamBase::alleyBarkSound(ReelRoutine &routine) { } } -void DreamBase::introMagic1(ReelRoutine &routine) { +void DreamWebEngine::introMagic1(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 145) @@ -444,7 +444,7 @@ void DreamBase::introMagic1(ReelRoutine &routine) { showGameReel(&routine); } -void DreamBase::introMagic2(ReelRoutine &routine) { +void DreamWebEngine::introMagic2(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 216) @@ -454,7 +454,7 @@ void DreamBase::introMagic2(ReelRoutine &routine) { showGameReel(&routine); } -void DreamBase::introMagic3(ReelRoutine &routine) { +void DreamWebEngine::introMagic3(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 218) @@ -465,7 +465,7 @@ void DreamBase::introMagic3(ReelRoutine &routine) { routine.mapX = _mapX; } -void DreamBase::candles1(ReelRoutine &routine) { +void DreamWebEngine::candles1(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 44) @@ -475,7 +475,7 @@ void DreamBase::candles1(ReelRoutine &routine) { showGameReel(&routine); } -void DreamBase::candles2(ReelRoutine &routine) { +void DreamWebEngine::candles2(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 238) @@ -485,7 +485,7 @@ void DreamBase::candles2(ReelRoutine &routine) { showGameReel(&routine); } -void DreamBase::smallCandle(ReelRoutine &routine) { +void DreamWebEngine::smallCandle(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 37) @@ -495,10 +495,10 @@ void DreamBase::smallCandle(ReelRoutine &routine) { showGameReel(&routine); } -void DreamBase::introMusic(ReelRoutine &routine) { +void DreamWebEngine::introMusic(ReelRoutine &routine) { } -void DreamBase::candles(ReelRoutine &routine) { +void DreamWebEngine::candles(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 167) @@ -508,7 +508,7 @@ void DreamBase::candles(ReelRoutine &routine) { showGameReel(&routine); } -void DreamBase::gates(ReelRoutine &routine) { +void DreamWebEngine::gates(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 116) @@ -525,7 +525,7 @@ void DreamBase::gates(ReelRoutine &routine) { showGameReel(&routine); } -void DreamBase::security(ReelRoutine &routine) { +void DreamWebEngine::security(ReelRoutine &routine) { if (routine.reelPointer() == 32) { if (_vars._lastWeapon == 1) { _vars._watchingTime = 10; @@ -545,7 +545,7 @@ void DreamBase::security(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamBase::edenInBath(ReelRoutine &routine) { +void DreamWebEngine::edenInBath(ReelRoutine &routine) { if (_vars._generalDead == 0 || _vars._sartainDead != 0) return; @@ -553,7 +553,7 @@ void DreamBase::edenInBath(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamBase::louis(ReelRoutine &routine) { +void DreamWebEngine::louis(ReelRoutine &routine) { if (_vars._rockstarDead != 0) return; @@ -561,26 +561,26 @@ void DreamBase::louis(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamBase::handClap(ReelRoutine &routine) { +void DreamWebEngine::handClap(ReelRoutine &routine) { } -void DreamBase::carParkDrip(ReelRoutine &routine) { +void DreamWebEngine::carParkDrip(ReelRoutine &routine) { if (!checkSpeed(routine)) return; // cantdrip2 playChannel1(14); } -void DreamBase::foghornSound(ReelRoutine &routine) { - if (engine->randomNumber() == 198) +void DreamWebEngine::foghornSound(ReelRoutine &routine) { + if (randomNumber() == 198) playChannel1(13); } -void DreamBase::train(ReelRoutine &routine) { +void DreamWebEngine::train(ReelRoutine &routine) { // The original code has logic for this, but it is disabled } -void DreamBase::louisChair(ReelRoutine &routine) { +void DreamWebEngine::louisChair(ReelRoutine &routine) { if (_vars._rockstarDead == 0) return; // notlouis2 @@ -591,7 +591,7 @@ void DreamBase::louisChair(ReelRoutine &routine) { } else if (nextReelPointer != 185) { routine.setReelPointer(nextReelPointer); } else { - if (engine->randomNumber() < 245) + if (randomNumber() < 245) routine.setReelPointer(182); // Restart Louis else routine.setReelPointer(nextReelPointer); @@ -602,12 +602,12 @@ void DreamBase::louisChair(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamBase::bossMan(ReelRoutine &routine) { +void DreamWebEngine::bossMan(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 4) { - if (_vars._gunPassFlag != 1 && engine->randomNumber() >= 10) + if (_vars._gunPassFlag != 1 && randomNumber() >= 10) nextReelPointer = 0; } else if (nextReelPointer == 20) { if (_vars._gunPassFlag != 1) @@ -628,7 +628,7 @@ void DreamBase::bossMan(ReelRoutine &routine) { _vars._talkedToBoss = 1; } -void DreamBase::priest(ReelRoutine &routine) { +void DreamWebEngine::priest(ReelRoutine &routine) { if (routine.reelPointer() == 8) return; // priestspoken @@ -641,7 +641,7 @@ void DreamBase::priest(ReelRoutine &routine) { } } -void DreamBase::priestText(ReelRoutine &routine) { +void DreamWebEngine::priestText(ReelRoutine &routine) { uint16 reel = routine.reelPointer(); if (reel < 2 || reel >= 7 || (reel & 1)) return; // nopriesttext @@ -649,7 +649,7 @@ void DreamBase::priestText(ReelRoutine &routine) { setupTimedUse((reel >> 1) + 50, 54, 1, 72, 80); } -void DreamBase::monkAndRyan(ReelRoutine &routine) { +void DreamWebEngine::monkAndRyan(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 83) { @@ -669,14 +669,14 @@ void DreamBase::monkAndRyan(ReelRoutine &routine) { showGameReel(&routine); } -void DreamBase::copper(ReelRoutine &routine) { +void DreamWebEngine::copper(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 94) { nextReelPointer = 64; } else if (nextReelPointer == 81 || nextReelPointer == 66) { // Might wait - if (engine->randomNumber() >= 7) + if (randomNumber() >= 7) nextReelPointer--; } @@ -687,7 +687,7 @@ void DreamBase::copper(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamBase::introMonks1(ReelRoutine &routine) { +void DreamWebEngine::introMonks1(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; @@ -717,7 +717,7 @@ void DreamBase::introMonks1(ReelRoutine &routine) { routine.mapY = _mapY; } -void DreamBase::introMonks2(ReelRoutine &routine) { +void DreamWebEngine::introMonks2(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 87) { @@ -750,7 +750,7 @@ void DreamBase::introMonks2(ReelRoutine &routine) { showGameReel(&routine); } -void DreamBase::soldier1(ReelRoutine &routine) { +void DreamWebEngine::soldier1(ReelRoutine &routine) { if (routine.reelPointer() != 0) { _vars._watchingTime = 10; if (routine.reelPointer() == 30) { @@ -773,7 +773,7 @@ void DreamBase::soldier1(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamBase::receptionist(ReelRoutine &routine) { +void DreamWebEngine::receptionist(ReelRoutine &routine) { if (checkSpeed(routine)) { if (_vars._cardPassFlag == 1) { // Set card @@ -790,10 +790,10 @@ void DreamBase::receptionist(ReelRoutine &routine) { routine.incReelPointer(); // not end card else routine.setReelPointer(53); - } else if (engine->randomNumber() >= 240) { + } else if (randomNumber() >= 240) { routine.setReelPointer(53); } - } else if (engine->randomNumber() >= 30) { + } else if (randomNumber() >= 30) { routine.setReelPointer(55); } else { // notdes2 @@ -810,10 +810,10 @@ void DreamBase::receptionist(ReelRoutine &routine) { _vars._talkedToRecep = 1; } -void DreamBase::bartender(ReelRoutine &routine) { +void DreamWebEngine::bartender(ReelRoutine &routine) { if (checkSpeed(routine)) { if (routine.reelPointer() == 86) { - if (engine->randomNumber() >= 18) + if (randomNumber() >= 18) routine.setReelPointer(81); else routine.incReelPointer(); // notsmoket2 @@ -831,7 +831,7 @@ void DreamBase::bartender(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamBase::heavy(ReelRoutine &routine) { +void DreamWebEngine::heavy(ReelRoutine &routine) { routine.b7 &= 127; if (routine.reelPointer() != 43) { _vars._watchingTime = 10; @@ -855,7 +855,7 @@ void DreamBase::heavy(ReelRoutine &routine) { addToPeopleList(&routine); } -void DreamBase::helicopter(ReelRoutine &routine) { +void DreamWebEngine::helicopter(ReelRoutine &routine) { if (routine.reelPointer() == 203) { // Won helicopter _pointerMode = 0; @@ -900,7 +900,7 @@ void DreamBase::helicopter(ReelRoutine &routine) { } } -void DreamBase::mugger(ReelRoutine &routine) { +void DreamWebEngine::mugger(ReelRoutine &routine) { if (routine.reelPointer() != 138) { if (routine.reelPointer() == 176) return; // endmugger2 @@ -934,18 +934,18 @@ void DreamBase::mugger(ReelRoutine &routine) { _objectType = kExObjectType; removeObFromInv(); makeMainScreen(); - DreamBase::setupTimedUse(48, 70, 10, 68 - 32, 54 + 64); + DreamWebEngine::setupTimedUse(48, 70, 10, 68 - 32, 54 + 64); _vars._beenMugged = 1; } } // Exiting the elevator of Sartain's industries, Sartain (the businessman) and // two bodyguards are expecting Ryan. -void DreamBase::businessMan(ReelRoutine &routine) { +void DreamWebEngine::businessMan(ReelRoutine &routine) { _pointerMode = 0; _vars._watchingTime = 2; if (routine.reelPointer() == 2) - DreamBase::setupTimedUse(49, 30, 1, 68, 174); // First + DreamWebEngine::setupTimedUse(49, 30, 1, 68, 174); // First if (routine.reelPointer() == 95) { // Businessman combat won - end @@ -1002,7 +1002,7 @@ void DreamBase::businessMan(ReelRoutine &routine) { } } -void DreamBase::endGameSeq(ReelRoutine &routine) { +void DreamWebEngine::endGameSeq(ReelRoutine &routine) { if (checkSpeed(routine)) { uint16 nextReelPointer = routine.reelPointer() + 1; if (nextReelPointer == 51 && _introCount != 140) { @@ -1033,7 +1033,7 @@ void DreamBase::endGameSeq(ReelRoutine &routine) { } } -void DreamBase::poolGuard(ReelRoutine &routine) { +void DreamWebEngine::poolGuard(ReelRoutine &routine) { if (routine.reelPointer() == 214 || routine.reelPointer() == 258) { // Combat over 2 showGameReel(&routine); @@ -1107,4 +1107,4 @@ void DreamBase::poolGuard(ReelRoutine &routine) { } } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp index 04e7a22ef8..a293aa74f9 100644 --- a/engines/dreamweb/print.cpp +++ b/engines/dreamweb/print.cpp @@ -22,9 +22,9 @@ #include "dreamweb/dreamweb.h" -namespace DreamGen { +namespace DreamWeb { -void DreamBase::printBoth(const GraphicsFile &charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar) { +void DreamWebEngine::printBoth(const GraphicsFile &charSet, uint16 *x, uint16 y, uint8 c, uint8 nextChar) { uint16 newX = *x; uint8 width, height; printChar(charSet, &newX, y, c, nextChar, &width, &height); @@ -32,7 +32,7 @@ void DreamBase::printBoth(const GraphicsFile &charSet, uint16 *x, uint16 y, uint *x = newX; } -uint8 DreamBase::getNextWord(const GraphicsFile &charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount) { +uint8 DreamWebEngine::getNextWord(const GraphicsFile &charSet, const uint8 *string, uint8 *totalWidth, uint8 *charCount) { *totalWidth = 0; *charCount = 0; while (true) { @@ -47,7 +47,7 @@ uint8 DreamBase::getNextWord(const GraphicsFile &charSet, const uint8 *string, u *totalWidth += 6; return 0; } - firstChar = engine->modifyChar(firstChar); + firstChar = modifyChar(firstChar); if (firstChar != 255) { uint8 secondChar = *string; uint8 width = charSet._frames[firstChar - 32 + _charShift].width; @@ -57,7 +57,7 @@ uint8 DreamBase::getNextWord(const GraphicsFile &charSet, const uint8 *string, u } } -void DreamBase::printChar(const GraphicsFile &charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) { +void DreamWebEngine::printChar(const GraphicsFile &charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) { if (c == 255) return; @@ -75,11 +75,11 @@ void DreamBase::printChar(const GraphicsFile &charSet, uint16* x, uint16 y, uint (*x) += *width; } -void DreamBase::printChar(const GraphicsFile &charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) { +void DreamWebEngine::printChar(const GraphicsFile &charSet, uint16 x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) { printChar(charSet, &x, y, c, nextChar, width, height); } -uint8 DreamBase::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered) { +uint8 DreamWebEngine::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWidth, bool centered) { _pointerFrame = 1; _pointerMode = 3; do { @@ -89,13 +89,13 @@ uint8 DreamBase::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWid uint8 c0 = string[0]; uint8 c1 = string[1]; uint8 c2 = string[2]; - c0 = engine->modifyChar(c0); + c0 = modifyChar(c0); printBoth(_charset1, &offset, y, c0, c1); if ((c1 == 0) || (c1 == ':')) { return 0; } if (charCount != 1) { - c1 = engine->modifyChar(c1); + c1 = modifyChar(c1); _charShift = 91; uint16 offset2 = offset; printBoth(_charset1, &offset2, y, c1, c2); @@ -119,11 +119,11 @@ uint8 DreamBase::printSlow(const uint8 *string, uint16 x, uint16 y, uint8 maxWid } while (true); } -uint8 DreamBase::printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) { +uint8 DreamWebEngine::printDirect(const uint8* string, uint16 x, uint16 y, uint8 maxWidth, bool centered) { return printDirect(&string, x, &y, maxWidth, centered); } -uint8 DreamBase::printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered) { +uint8 DreamWebEngine::printDirect(const uint8** string, uint16 x, uint16 *y, uint8 maxWidth, bool centered) { _lastXPos = x; const GraphicsFile &charSet = *_currentCharset; while (true) { @@ -137,7 +137,7 @@ uint8 DreamBase::printDirect(const uint8** string, uint16 x, uint16 *y, uint8 ma if ((c == 0) || (c == ':')) { return c; } - c = engine->modifyChar(c); + c = modifyChar(c); uint8 width, height; printChar(charSet, &i, *y, c, nextChar, &width, &height); _lastXPos = i; @@ -147,7 +147,7 @@ uint8 DreamBase::printDirect(const uint8** string, uint16 x, uint16 *y, uint8 ma } } -uint8 DreamBase::getNumber(const GraphicsFile &charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16* offset) { +uint8 DreamWebEngine::getNumber(const GraphicsFile &charSet, const uint8 *string, uint16 maxWidth, bool centered, uint16* offset) { uint8 totalWidth = 0; uint8 charCount = 0; while (true) { @@ -186,7 +186,7 @@ uint8 DreamBase::getNumber(const GraphicsFile &charSet, const uint8 *string, uin } } -uint8 DreamBase::kernChars(uint8 firstChar, uint8 secondChar, uint8 width) { +uint8 DreamWebEngine::kernChars(uint8 firstChar, uint8 secondChar, uint8 width) { if ((firstChar == 'a') || (firstChar == 'u')) { if ((secondChar == 'n') || (secondChar == 't') || (secondChar == 'r') || (secondChar == 'i') || (secondChar == 'l')) return width-1; @@ -194,7 +194,7 @@ uint8 DreamBase::kernChars(uint8 firstChar, uint8 secondChar, uint8 width) { return width; } -uint16 DreamBase::waitFrames() { +uint16 DreamWebEngine::waitFrames() { readMouse(); showPointer(); vSync(); @@ -203,7 +203,7 @@ uint16 DreamBase::waitFrames() { return _mouseButton; } -const char *DreamBase::monPrint(const char *string) { +const char *DreamWebEngine::monPrint(const char *string) { _kerning = 1; uint16 x = _monAdX; const char *iterator = string; @@ -225,7 +225,7 @@ const char *DreamBase::monPrint(const char *string) { done = true; break; } - c = engine->modifyChar(c); + c = modifyChar(c); printChar(_tempCharset, &x, _monAdY, c, 0, NULL, NULL); _cursLocX = x; _cursLocY = _monAdY; @@ -245,7 +245,7 @@ const char *DreamBase::monPrint(const char *string) { return iterator; } -void DreamBase::rollEndCreditsGameWon() { +void DreamWebEngine::rollEndCreditsGameWon() { playChannel0(16, 255); _volume = 7; _volumeTo = 0; @@ -269,7 +269,7 @@ void DreamBase::rollEndCreditsGameWon() { uint16 y = 10 - j; const uint8 *tmp_str = string; for (int k = 0; k < 18; ++k) { - DreamBase::printDirect(&tmp_str, 75, &y, 160 + 1, true); + DreamWebEngine::printDirect(&tmp_str, 75, &y, 160 + 1, true); y += linespacing; } @@ -289,7 +289,7 @@ void DreamBase::rollEndCreditsGameWon() { fadeScreenUpHalf(); } -void DreamBase::rollEndCreditsGameLost() { +void DreamWebEngine::rollEndCreditsGameLost() { multiGet(_mapStore, 25, 20, 160, 160); const uint8 *string = getTextInFile1(49); @@ -308,7 +308,7 @@ void DreamBase::rollEndCreditsGameLost() { uint16 y = 10 - j; const uint8 *tmp_str = string; for (int k = 0; k < 18; ++k) { - DreamBase::printDirect(&tmp_str, 25, &y, 160 + 1, true); + DreamWebEngine::printDirect(&tmp_str, 25, &y, 160 + 1, true); y += linespacing; } @@ -332,4 +332,4 @@ void DreamBase::rollEndCreditsGameLost() { hangOne(120); } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/runtime.h b/engines/dreamweb/runtime.h deleted file mode 100644 index 0bbef5028e..0000000000 --- a/engines/dreamweb/runtime.h +++ /dev/null @@ -1,46 +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. - * - */ - -#ifndef DREAMGEN_RUNTIME_H -#define DREAMGEN_RUNTIME_H - -#include -#include "common/scummsys.h" -#include "common/array.h" -#include "common/debug.h" - -#include "dreamweb/segment.h" - -namespace DreamGen { - -class Context { -public: - MutableSegmentRef ds; - - Context(SegmentManager *segMan): ds(segMan, segMan->data) { - - } -}; - -} // End of namespace DreamGen - -#endif diff --git a/engines/dreamweb/saveload.cpp b/engines/dreamweb/saveload.cpp index 95f1b3694d..76770f060e 100644 --- a/engines/dreamweb/saveload.cpp +++ b/engines/dreamweb/saveload.cpp @@ -28,7 +28,7 @@ #include "common/translation.h" #include "common/serializer.h" -namespace DreamGen { +namespace DreamWeb { // Temporary storage for loading the room from a savegame Room g_madeUpRoomDat; @@ -106,7 +106,7 @@ void syncGameVars(Common::Serializer &s, GameVars &vars) { s.syncAsByte(vars._shakeCounter); } -void DreamBase::loadGame() { +void DreamWebEngine::loadGame() { if (_commandType != 246) { _commandType = 246; commandOnly(41); @@ -119,7 +119,7 @@ void DreamBase::loadGame() { // if -1, open menu to ask for slot to load // if >= 0, directly load from that slot -void DreamBase::doLoad(int savegameId) { +void DreamWebEngine::doLoad(int savegameId) { _loadingOrSave = 1; if (ConfMan.getBool("dreamweb_originalsaveload") && savegameId == -1) { @@ -142,11 +142,11 @@ void DreamBase::doLoad(int savegameId) { vSync(); dumpPointer(); dumpTextLine(); - RectWithCallback loadlist[] = { - { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamBase::getBackToOps }, - { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamBase::actualLoad }, - { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamBase::selectSlot }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback loadlist[] = { + { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamWebEngine::getBackToOps }, + { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamWebEngine::actualLoad }, + { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamWebEngine::selectSlot }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(loadlist); @@ -198,7 +198,7 @@ void DreamBase::doLoad(int savegameId) { } -void DreamBase::saveGame() { +void DreamWebEngine::saveGame() { if (_vars._manDead == 2) { blank(); return; @@ -236,11 +236,11 @@ void DreamBase::saveGame() { dumpPointer(); dumpTextLine(); - RectWithCallback savelist[] = { - { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamBase::getBackToOps }, - { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamBase::actualSave }, - { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamBase::selectSlot }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback savelist[] = { + { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamWebEngine::getBackToOps }, + { kOpsx+128,kOpsx+190,kOpsy+12,kOpsy+100,&DreamWebEngine::actualSave }, + { kOpsx+2,kOpsx+92,kOpsy+4,kOpsy+81,&DreamWebEngine::selectSlot }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(savelist); @@ -291,15 +291,15 @@ void DreamBase::saveGame() { } } -void DreamBase::namesToOld() { +void DreamWebEngine::namesToOld() { memcpy(_saveNamesOld, _saveNames, 17*7); } -void DreamBase::oldToNames() { +void DreamWebEngine::oldToNames() { memcpy(_saveNames, _saveNamesOld, 17*7); } -void DreamBase::saveLoad() { +void DreamWebEngine::saveLoad() { if (_vars._watchingTime || (_pointerMode == 2)) { blank(); return; @@ -312,7 +312,7 @@ void DreamBase::saveLoad() { doSaveLoad(); } -void DreamBase::doSaveLoad() { +void DreamWebEngine::doSaveLoad() { _pointerFrame = 0; _textAddressX = 70; _textAddressY = 182-8; @@ -327,11 +327,11 @@ void DreamBase::doSaveLoad() { showMainOps(); workToScreen(); - RectWithCallback opsList[] = { - { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamBase::getBackFromOps }, - { kOpsx+10,kOpsx+77,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn }, - { kOpsx+128,kOpsx+190,kOpsy+16,kOpsy+100,&DreamBase::discOps }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback opsList[] = { + { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamWebEngine::getBackFromOps }, + { kOpsx+10,kOpsx+77,kOpsy+10,kOpsy+59,&DreamWebEngine::DOSReturn }, + { kOpsx+128,kOpsx+190,kOpsy+16,kOpsy+100,&DreamWebEngine::discOps }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; @@ -376,14 +376,14 @@ void DreamBase::doSaveLoad() { _manIsOffScreen = 0; } -void DreamBase::getBackFromOps() { +void DreamWebEngine::getBackFromOps() { if (_vars._manDead == 2) blank(); else getBack1(); } -void DreamBase::getBackToOps() { +void DreamWebEngine::getBackToOps() { if (_commandType != 201) { _commandType = 201; commandOnly(42); @@ -397,20 +397,20 @@ void DreamBase::getBackToOps() { } } -void DreamBase::showMainOps() { +void DreamWebEngine::showMainOps() { showFrame(_tempGraphics, kOpsx+10, kOpsy+10, 8, 0); showFrame(_tempGraphics, kOpsx+59, kOpsy+30, 7, 0); showFrame(_tempGraphics, kOpsx+128+4, kOpsy+12, 1, 0); } -void DreamBase::showDiscOps() { +void DreamWebEngine::showDiscOps() { showFrame(_tempGraphics, kOpsx+128+4, kOpsy+12, 1, 0); showFrame(_tempGraphics, kOpsx+10, kOpsy+10, 9, 0); showFrame(_tempGraphics, kOpsx+59, kOpsy+30, 10, 0); showFrame(_tempGraphics, kOpsx+176+2, kOpsy+60-4, 5, 0); } -void DreamBase::discOps() { +void DreamWebEngine::discOps() { if (_commandType != 249) { _commandType = 249; commandOnly(43); @@ -427,11 +427,11 @@ void DreamBase::discOps() { workToScreenM(); _getBack = 0; - RectWithCallback discOpsList[] = { - { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamBase::loadGame }, - { kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamBase::saveGame }, - { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamBase::getBackToOps }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback discOpsList[] = { + { kOpsx+59,kOpsx+114,kOpsy+30,kOpsy+76,&DreamWebEngine::loadGame }, + { kOpsx+10,kOpsx+79,kOpsy+10,kOpsy+59,&DreamWebEngine::saveGame }, + { kOpsx+176,kOpsx+192,kOpsy+60,kOpsy+76,&DreamWebEngine::getBackToOps }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; @@ -449,7 +449,7 @@ void DreamBase::discOps() { } while (!_getBack); } -void DreamBase::actualSave() { +void DreamWebEngine::actualSave() { if (_commandType != 222) { _commandType = 222; commandOnly(44); @@ -476,7 +476,7 @@ void DreamBase::actualSave() { _getBack = 4; } -void DreamBase::actualLoad() { +void DreamWebEngine::actualLoad() { if (_commandType != 221) { _commandType = 221; commandOnly(41); @@ -495,7 +495,7 @@ void DreamBase::actualLoad() { _getBack = 1; } -void DreamBase::savePosition(unsigned int slot, const char *descbuf) { +void DreamWebEngine::savePosition(unsigned int slot, const char *descbuf) { const Room ¤tRoom = g_roomData[_vars._location]; @@ -508,9 +508,9 @@ void DreamBase::savePosition(unsigned int slot, const char *descbuf) { madeUpRoom.facing = _facing; madeUpRoom.b27 = 255; - Common::String filename = engine->getSavegameFilename(slot); + Common::String filename = getSavegameFilename(slot); debug(1, "savePosition: slot %d filename %s", slot, filename.c_str()); - Common::OutSaveFile *outSaveFile = engine->getSaveFileManager()->openForSaving(filename); + Common::OutSaveFile *outSaveFile = getSaveFileManager()->openForSaving(filename); if (!outSaveFile) // TODO: Do proper error handling! error("save could not be opened for writing"); @@ -582,13 +582,13 @@ void DreamBase::savePosition(unsigned int slot, const char *descbuf) { delete outSaveFile; } -void DreamBase::loadPosition(unsigned int slot) { +void DreamWebEngine::loadPosition(unsigned int slot) { _timeCount = 0; clearChanges(); - Common::String filename = engine->getSavegameFilename(slot); + Common::String filename = getSavegameFilename(slot); debug(1, "loadPosition: slot %d filename %s", slot, filename.c_str()); - Common::InSaveFile *inSaveFile = engine->getSaveFileManager()->openForLoading(filename); + Common::InSaveFile *inSaveFile = getSaveFileManager()->openForLoading(filename); if (!inSaveFile) // TODO: Do proper error handling! error("save could not be opened for reading"); @@ -664,13 +664,13 @@ void DreamBase::loadPosition(unsigned int slot) { } // Count number of save files, and load their descriptions into _saveNames -uint DreamBase::scanForNames() { +uint DreamWebEngine::scanForNames() { // Initialize the first 7 slots (like the original code expects) for (unsigned int slot = 0; slot < 7; ++slot) { _saveNames[17 * slot + 0] = 2; _saveNames[17 * slot + 1] = 0; for (int i = 2; i < 17; ++i) - _saveNames[17 * slot + i] = 1; // initialize with 1's + _saveNames[17 * slot + i] = 1; // initialize with 1'sdrea } Common::SaveFileManager *saveFileMan = g_system->getSavefileManager(); @@ -701,7 +701,7 @@ uint DreamBase::scanForNames() { return saveList.size(); } -void DreamBase::loadOld() { +void DreamWebEngine::loadOld() { if (_commandType != 252) { _commandType = 252; commandOnly(48); @@ -720,19 +720,19 @@ void DreamBase::loadOld() { _getBack = 0; } -void DreamBase::showDecisions() { +void DreamWebEngine::showDecisions() { createPanel2(); showOpBox(); showFrame(_tempGraphics, kOpsx + 17, kOpsy + 13, 6, 0); underTextLine(); } -void DreamBase::loadSaveBox() { +void DreamWebEngine::loadSaveBox() { loadIntoTemp("DREAMWEB.G08"); } // show savegame names (original interface), and set kCursorpos -void DreamBase::showNames() { +void DreamWebEngine::showNames() { for (int slot = 0; slot < 7; ++slot) { // The first character of the savegame name is unused Common::String name(&_saveNames[17*slot + 1]); @@ -755,7 +755,7 @@ void DreamBase::showNames() { } } -void DreamBase::checkInput() { +void DreamWebEngine::checkInput() { if (_loadingOrSave == 3) return; @@ -792,7 +792,7 @@ void DreamBase::checkInput() { workToScreenM(); } -void DreamBase::selectSlot() { +void DreamWebEngine::selectSlot() { if (_commandType != 244) { _commandType = 244; commandOnly(45); @@ -824,7 +824,7 @@ void DreamBase::selectSlot() { delPointer(); } -void DreamBase::showSlots() { +void DreamWebEngine::showSlots() { showFrame(_tempGraphics, kOpsx + 7, kOpsy + 8, 2, 0); uint16 y = kOpsy + 11; @@ -837,7 +837,7 @@ void DreamBase::showSlots() { } } -void DreamBase::showOpBox() { +void DreamWebEngine::showOpBox() { showFrame(_tempGraphics, kOpsx, kOpsy, 0, 0); // CHECKME: There seem to be versions of dreamweb in which this call @@ -845,16 +845,16 @@ void DreamBase::showOpBox() { showFrame(_tempGraphics, kOpsx, kOpsy + 55, 4, 0); } -void DreamBase::showLoadOps() { +void DreamWebEngine::showLoadOps() { showFrame(_tempGraphics, kOpsx + 128 + 4, kOpsy + 12, 1, 0); showFrame(_tempGraphics, kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0); printMessage(kOpsx + 104, kOpsy + 14, 55, 101, (101 & 1)); } -void DreamBase::showSaveOps() { +void DreamWebEngine::showSaveOps() { showFrame(_tempGraphics, kOpsx + 128 + 4, kOpsy + 12, 1, 0); showFrame(_tempGraphics, kOpsx + 176 + 2, kOpsy + 60 - 4, 5, 0); printMessage(kOpsx + 104, kOpsy + 14, 54, 101, (101 & 1)); } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/segment.h b/engines/dreamweb/segment.h deleted file mode 100644 index 65bc2335ea..0000000000 --- a/engines/dreamweb/segment.h +++ /dev/null @@ -1,232 +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. - * - */ - -#ifndef DREAMGEN_SEGMENT_H -#define DREAMGEN_SEGMENT_H - -#include "common/array.h" -#include "common/ptr.h" -#include "common/hashmap.h" -#include "common/list.h" - -namespace DreamGen { - -class WordRef { - uint8 *_data; - unsigned _index; - uint16 _value; - -public: - inline WordRef(Common::Array &data, unsigned index) : _data(data.begin() + index), _index(index) { - assert(index + 1 < data.size()); - _value = _data[0] | (_data[1] << 8); - } - - inline WordRef& operator=(const WordRef &ref) { - _value = ref._value; - return *this; - } - - inline WordRef& operator=(uint16 v) { - _value = v; - return *this; - } - - inline operator uint16&() { - return _value; - } - - inline ~WordRef() { - // FIXME: This is _too late_ to write back the - // value. Example: in the call - // printDirect(data.word(kLastxpos), .....) - // the destructor isn't called until after printDirect returns. This - // destroys the modifications to lastXPos that printDirect makes. - _data[0] = _value & 0xff; - _data[1] = _value >> 8; - _value = _data[0] | (_data[1] << 8); - } -}; - -class Segment { - Common::Array data; - -public: - Segment(uint size = 0) { - if (size > 0) - data.resize(size); - } - - inline void assign(const uint8 *b, const uint8 *e) { - data.assign(b, e); - } - - inline uint8 &byte(unsigned index) { - assert(index < data.size()); - return data[index]; - } - - inline WordRef word(unsigned index) { - return WordRef(data, index); - } - - inline uint8 *ptr(unsigned index, unsigned size) { - assert(index + size <= data.size()); - return data.begin() + index; - } -}; - -typedef Common::SharedPtr SegmentPtr; - -class SegmentRef { - uint16 _value; - SegmentPtr _segment; - -public: - SegmentRef(uint16 value = 0, SegmentPtr segment = SegmentPtr()) - : _value(value), _segment(segment) { - } - - inline operator uint16() const { - return _value; - } - - SegmentPtr getSegmentPtr() const { - return _segment; - } - - inline uint8 &byte(unsigned index) { - assert(_segment != 0); - return _segment->byte(index); - } - - inline WordRef word(unsigned index) { - //debug(1, "getting word ref for %04x:%d", _value, index); - assert(_segment != 0); - return _segment->word(index); - } - - inline void assign(const uint8 *b, const uint8 *e) { - assert(_segment != 0); - _segment->assign(b, e); - } - - inline uint8 *ptr(unsigned index, unsigned size) { - assert(_segment != 0); - return _segment->ptr(index, size); - } - -protected: - SegmentRef &operator=(const SegmentRef &seg) { - _value = seg._value; - _segment = seg._segment; - return *this; - } - -}; - -class SegmentManager; - -class MutableSegmentRef : public SegmentRef { -protected: - SegmentManager *_segMan; - -public: - MutableSegmentRef(SegmentManager *segMan, uint16 value = 0, SegmentPtr segment = SegmentPtr()) - : _segMan(segMan), SegmentRef(value, segment) { - } - - MutableSegmentRef(SegmentManager *segMan, SegmentRef seg) - : _segMan(segMan), SegmentRef(seg) { - } - - inline MutableSegmentRef& operator=(const uint16 id); - -}; - - -class SegmentManager { -private: - typedef Common::HashMap SegmentMap; - SegmentMap _segments; - - typedef Common::List FreeSegmentList; - FreeSegmentList _freeSegments; - - enum { kDefaultDataSegment = 0x1000 }; - -public: - - SegmentPtr _realData; ///< the primary data segment, points to a huge blob of binary data - SegmentRef data; ///< fake segment register always pointing to data segment - -public: - SegmentManager() : - _realData(new Segment()), - data(kDefaultDataSegment, _realData) { - - _segments[kDefaultDataSegment] = data.getSegmentPtr(); - } - - SegmentRef getSegment(uint16 value) { - SegmentMap::iterator i = _segments.find(value); - if (i != _segments.end()) - return SegmentRef(value, i->_value); - else - return SegmentRef(value); - } - - SegmentRef allocateSegment(uint size) { - unsigned id; - if (_freeSegments.empty()) - id = kDefaultDataSegment + _segments.size(); - else { - id = _freeSegments.front(); - _freeSegments.pop_front(); - } - assert(!_segments.contains(id)); - SegmentPtr seg(new Segment(size)); - _segments[id] = seg; - return SegmentRef(id, seg); - } - - void deallocateSegment(uint16 id) { - SegmentMap::iterator i = _segments.find(id); - if(i != _segments.end()) { - _segments.erase(i); - _freeSegments.push_back(id); - } else { - debug("Deallocating non existent segment! Client code should be fixed."); - } - } - -}; - - -inline MutableSegmentRef& MutableSegmentRef::operator=(const uint16 id) { - SegmentRef::operator=(_segMan->getSegment(id)); - return *this; -} - -} // End of namespace DreamGen - -#endif diff --git a/engines/dreamweb/sound.cpp b/engines/dreamweb/sound.cpp index 774f22a0b9..8e125cc0e1 100644 --- a/engines/dreamweb/sound.cpp +++ b/engines/dreamweb/sound.cpp @@ -21,28 +21,27 @@ */ #include "dreamweb/dreamweb.h" -#include "dreamweb/dreamgen.h" #include "audio/mixer.h" #include "audio/decoders/raw.h" #include "common/config-manager.h" -namespace DreamGen { +namespace DreamWeb { -bool DreamBase::loadSpeech(byte type1, int idx1, byte type2, int idx2) { +bool DreamWebEngine::loadSpeech(byte type1, int idx1, byte type2, int idx2) { cancelCh1(); Common::String name = Common::String::format("%c%02d%c%04d.RAW", type1, idx1, type2, idx2); //debug("name = %s", name.c_str()); - bool result = engine->loadSpeech(name); + bool result = loadSpeech(name); _speechLoaded = result; return result; } -void DreamBase::volumeAdjust() { +void DreamWebEngine::volumeAdjust() { if (_volumeDirection == 0) return; if (_volume != _volumeTo) { @@ -55,7 +54,7 @@ void DreamBase::volumeAdjust() { } } -void DreamBase::playChannel0(uint8 index, uint8 repeat) { +void DreamWebEngine::playChannel0(uint8 index, uint8 repeat) { _channel0Playing = index; if (index >= 12) index -= 12; @@ -63,7 +62,7 @@ void DreamBase::playChannel0(uint8 index, uint8 repeat) { _channel0Repeat = repeat; } -void DreamBase::playChannel1(uint8 index) { +void DreamWebEngine::playChannel1(uint8 index) { if (_channel1Playing == 7) return; @@ -72,18 +71,18 @@ void DreamBase::playChannel1(uint8 index) { index -= 12; } -void DreamBase::cancelCh0() { +void DreamWebEngine::cancelCh0() { _channel0Repeat = 0; _channel0Playing = 255; - engine->stopSound(0); + stopSound(0); } -void DreamBase::cancelCh1() { +void DreamWebEngine::cancelCh1() { _channel1Playing = 255; - engine->stopSound(1); + stopSound(1); } -void DreamBase::loadRoomsSample() { +void DreamWebEngine::loadRoomsSample() { uint8 sample = _roomsSample; if (sample == 255 || _currentSample == sample) @@ -99,10 +98,10 @@ void DreamBase::loadRoomsSample() { uint8 ch1 = _channel1Playing; if (ch1 >= 12) cancelCh1(); - engine->loadSounds(1, sampleName.c_str()); + loadSounds(1, sampleName.c_str()); } -} // End of namespace DreamGen +} // End of namespace DreamWeb namespace DreamWeb { @@ -191,10 +190,10 @@ bool DreamWebEngine::loadSpeech(const Common::String &filename) { } void DreamWebEngine::soundHandler() { - _base._subtitles = ConfMan.getBool("subtitles"); - _base.volumeAdjust(); + _subtitles = ConfMan.getBool("subtitles"); + volumeAdjust(); - uint volume = _base._volume; + uint volume = _volume; //.vol file loaded into soundbuf:0x4000 //volume table at (volume * 0x100 + 0x3f00) //volume value could be from 1 to 7 @@ -210,13 +209,13 @@ void DreamWebEngine::soundHandler() { volume = (8 - volume) * Audio::Mixer::kMaxChannelVolume / 8; _mixer->setChannelVolume(_channelHandle[0], volume); - uint8 ch0 = _base._channel0Playing; + uint8 ch0 = _channel0Playing; if (ch0 == 255) ch0 = 0; - uint8 ch1 = _base._channel1Playing; + uint8 ch1 = _channel1Playing; if (ch1 == 255) ch1 = 0; - uint8 ch0loop = _base._channel0Repeat; + uint8 ch0loop = _channel0Repeat; if (_channel0 != ch0) { _channel0 = ch0; @@ -231,11 +230,11 @@ void DreamWebEngine::soundHandler() { } } if (!_mixer->isSoundHandleActive(_channelHandle[0])) { - _base._channel0Playing = 255; + _channel0Playing = 255; _channel0 = 0; } if (!_mixer->isSoundHandleActive(_channelHandle[1])) { - _base._channel1Playing = 255; + _channel1Playing = 255; _channel1 = 0; } diff --git a/engines/dreamweb/sprite.cpp b/engines/dreamweb/sprite.cpp index a04f877f2c..33dbc0f18b 100644 --- a/engines/dreamweb/sprite.cpp +++ b/engines/dreamweb/sprite.cpp @@ -22,9 +22,9 @@ #include "dreamweb/dreamweb.h" -namespace DreamGen { +namespace DreamWeb { -void DreamBase::printSprites() { +void DreamWebEngine::printSprites() { for (size_t priority = 0; priority < 7; ++priority) { Common::List::const_iterator i; for (i = _spriteTable.begin(); i != _spriteTable.end(); ++i) { @@ -39,7 +39,7 @@ void DreamBase::printSprites() { } } -void DreamBase::printASprite(const Sprite *sprite) { +void DreamWebEngine::printASprite(const Sprite *sprite) { uint16 x, y; if (sprite->y >= 220) { y = _mapAdY - (256 - sprite->y); @@ -61,11 +61,11 @@ void DreamBase::printASprite(const Sprite *sprite) { showFrame(*sprite->_frameData, x, y, sprite->frameNumber, c); } -void DreamBase::clearSprites() { +void DreamWebEngine::clearSprites() { _spriteTable.clear(); } -Sprite *DreamBase::makeSprite(uint8 x, uint8 y, uint16 updateCallback, const GraphicsFile *frameData, uint16 somethingInDi) { +Sprite *DreamWebEngine::makeSprite(uint8 x, uint8 y, uint16 updateCallback, const GraphicsFile *frameData, uint16 somethingInDi) { // Note: the original didn't append sprites here, but filled up the // first unused entry. This can change the order of entries, but since they // are drawn based on the priority field, this shouldn't matter. @@ -86,7 +86,7 @@ Sprite *DreamBase::makeSprite(uint8 x, uint8 y, uint16 updateCallback, const Gra return sprite; } -void DreamBase::spriteUpdate() { +void DreamWebEngine::spriteUpdate() { // During the intro the sprite table can be empty if (!_spriteTable.empty()) _spriteTable.front().hidden = _vars._ryanOn; @@ -109,14 +109,14 @@ void DreamBase::spriteUpdate() { } } -void DreamBase::initMan() { +void DreamWebEngine::initMan() { Sprite *sprite = makeSprite(_ryanX, _ryanY, addr_mainman, &_mainSprites, 0); sprite->priority = 4; sprite->speed = 0; sprite->walkFrame = 0; } -void DreamBase::mainMan(Sprite *sprite) { +void DreamWebEngine::mainMan(Sprite *sprite) { if (_resetManXY == 1) { _resetManXY = 0; sprite->x = _ryanX; @@ -166,7 +166,7 @@ void DreamBase::mainMan(Sprite *sprite) { _ryanY = sprite->y; } -void DreamBase::walking(Sprite *sprite) { +void DreamWebEngine::walking(Sprite *sprite) { uint8 comp; if (_lineDirection != 0) { --_linePointer; @@ -191,7 +191,7 @@ void DreamBase::walking(Sprite *sprite) { autoSetWalk(); } -void DreamBase::aboutTurn(Sprite *sprite) { +void DreamWebEngine::aboutTurn(Sprite *sprite) { bool incdir = true; if (_turnDirection == 1) @@ -225,7 +225,7 @@ void DreamBase::aboutTurn(Sprite *sprite) { } } -void DreamBase::backObject(Sprite *sprite) { +void DreamWebEngine::backObject(Sprite *sprite) { SetObject *objData = sprite->_objData; if (sprite->delay != 0) { @@ -250,7 +250,7 @@ void DreamBase::backObject(Sprite *sprite) { steady(sprite, objData); } -void DreamBase::constant(Sprite *sprite, SetObject *objData) { +void DreamWebEngine::constant(Sprite *sprite, SetObject *objData) { ++sprite->animFrame; if (objData->frames[sprite->animFrame] == 255) { sprite->animFrame = 0; @@ -260,22 +260,22 @@ void DreamBase::constant(Sprite *sprite, SetObject *objData) { sprite->frameNumber = frame; } -void DreamBase::randomSprite(Sprite *sprite, SetObject *objData) { - uint8 r = engine->randomNumber(); +void DreamWebEngine::randomSprite(Sprite *sprite, SetObject *objData) { + uint8 r = randomNumber(); sprite->frameNumber = objData->frames[r&7]; } -void DreamBase::doorway(Sprite *sprite, SetObject *objData) { +void DreamWebEngine::doorway(Sprite *sprite, SetObject *objData) { Common::Rect check(-24, -30, 10, 10); doDoor(sprite, objData, check); } -void DreamBase::wideDoor(Sprite *sprite, SetObject *objData) { +void DreamWebEngine::wideDoor(Sprite *sprite, SetObject *objData) { Common::Rect check(-24, -30, 24, 24); doDoor(sprite, objData, check); } -void DreamBase::doDoor(Sprite *sprite, SetObject *objData, Common::Rect check) { +void DreamWebEngine::doDoor(Sprite *sprite, SetObject *objData, Common::Rect check) { int ryanx = _ryanX; int ryany = _ryanY; @@ -324,13 +324,13 @@ void DreamBase::doDoor(Sprite *sprite, SetObject *objData, Common::Rect check) { } } -void DreamBase::steady(Sprite *sprite, SetObject *objData) { +void DreamWebEngine::steady(Sprite *sprite, SetObject *objData) { uint8 frame = objData->frames[0]; objData->index = frame; sprite->frameNumber = frame; } -void DreamBase::lockedDoorway(Sprite *sprite, SetObject *objData) { +void DreamWebEngine::lockedDoorway(Sprite *sprite, SetObject *objData) { int ryanx = _ryanX; int ryany = _ryanY; @@ -381,7 +381,7 @@ void DreamBase::lockedDoorway(Sprite *sprite, SetObject *objData) { } } -void DreamBase::liftSprite(Sprite *sprite, SetObject *objData) { +void DreamWebEngine::liftSprite(Sprite *sprite, SetObject *objData) { uint8 liftFlag = _vars._liftFlag; if (liftFlag == 0) { //liftclosed turnPathOff(_vars._liftPath); @@ -429,14 +429,14 @@ void DreamBase::liftSprite(Sprite *sprite, SetObject *objData) { } } -Reel *DreamBase::getReelStart(uint16 reelPointer) { +Reel *DreamWebEngine::getReelStart(uint16 reelPointer) { Reel *reel = &_reelList[reelPointer * 8]; return reel; } // Locate the reel segment (reel1, reel2, reel3) this frame is stored in, // and adjust the frame number relative to this segment. -const GraphicsFile *DreamBase::findSource(uint16 &frame) { +const GraphicsFile *DreamWebEngine::findSource(uint16 &frame) { if (frame < 160) { return &_reel1; } else if (frame < 320) { @@ -448,7 +448,7 @@ const GraphicsFile *DreamBase::findSource(uint16 &frame) { } } -void DreamBase::showReelFrame(Reel *reel) { +void DreamWebEngine::showReelFrame(Reel *reel) { uint16 x = reel->x + _mapAdX; uint16 y = reel->y + _mapAdY; uint16 frame = reel->frame(); @@ -456,7 +456,7 @@ void DreamBase::showReelFrame(Reel *reel) { showFrame(*base, x, y, frame, 8); } -void DreamBase::showGameReel(ReelRoutine *routine) { +void DreamWebEngine::showGameReel(ReelRoutine *routine) { uint16 reelPointer = routine->reelPointer(); if (reelPointer >= 512) return; @@ -464,12 +464,12 @@ void DreamBase::showGameReel(ReelRoutine *routine) { routine->setReelPointer(reelPointer); } -const Frame *DreamBase::getReelFrameAX(uint16 frame) { +const Frame *DreamWebEngine::getReelFrameAX(uint16 frame) { const GraphicsFile *base = findSource(frame); return &base->_frames[frame]; } -void DreamBase::showRain() { +void DreamWebEngine::showRain() { Common::List::iterator i; // Do nothing if there's no rain at all @@ -502,7 +502,7 @@ void DreamBase::showRain() { if (_realLocation == 55) return; - if (engine->randomNumber() >= 1) // play thunder with 1 in 256 chance + if (randomNumber() >= 1) // play thunder with 1 in 256 chance return; uint8 soundIndex; @@ -513,7 +513,7 @@ void DreamBase::showRain() { playChannel1(soundIndex); } -void DreamBase::moveMap(uint8 param) { +void DreamWebEngine::moveMap(uint8 param) { switch (param) { case 32: _mapY -= 20; @@ -534,7 +534,7 @@ void DreamBase::moveMap(uint8 param) { _nowInNewRoom = 1; } -void DreamBase::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) { +void DreamWebEngine::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *type, uint8 *flagX, uint8 *flagY) { *flagX = x / 16; *flagY = y / 16; const MapFlag &tileData = _mapFlags[*flagY * 11 + *flagX]; @@ -543,7 +543,7 @@ void DreamBase::checkOne(uint8 x, uint8 y, uint8 *flag, uint8 *flagEx, uint8 *ty *type = tileData._type; } -uint8 DreamBase::getBlockOfPixel(uint8 x, uint8 y) { +uint8 DreamWebEngine::getBlockOfPixel(uint8 x, uint8 y) { uint8 flag, flagEx, type, flagX, flagY; checkOne(x + _mapXStart, y + _mapYStart, &flag, &flagEx, &type, &flagX, &flagY); if (flag & 1) @@ -552,7 +552,7 @@ uint8 DreamBase::getBlockOfPixel(uint8 x, uint8 y) { return type; } -void DreamBase::splitIntoLines(uint8 x, uint8 y) { +void DreamWebEngine::splitIntoLines(uint8 x, uint8 y) { do { Rain rain; @@ -579,8 +579,8 @@ void DreamBase::splitIntoLines(uint8 x, uint8 y) { } rain.size = length; - rain.w3 = (engine->randomNumber() << 8) | engine->randomNumber(); - rain.b5 = (engine->randomNumber() & 3) + 4; + rain.w3 = (randomNumber() << 8) | randomNumber(); + rain.b5 = (randomNumber() & 3) + 4; _rainList.push_back(rain); } while (x > 0 && y < _mapYSize); } @@ -622,7 +622,7 @@ static const RainLocation rainLocationList[] = { { 255,0,0,0 } }; -void DreamBase::initRain() { +void DreamWebEngine::initRain() { const RainLocation *r = rainLocationList; _rainList.clear(); @@ -647,7 +647,7 @@ void DreamBase::initRain() { do { uint8 delta; do { - delta = (engine->randomNumber() & 31) + 3; + delta = (randomNumber() & 31) + 3; } while (delta >= rainSpacing); x += delta; @@ -662,7 +662,7 @@ void DreamBase::initRain() { do { uint8 delta; do { - delta = (engine->randomNumber() & 31) + 3; + delta = (randomNumber() & 31) + 3; } while (delta >= rainSpacing); y += delta; @@ -673,7 +673,7 @@ void DreamBase::initRain() { } while (true); } -void DreamBase::intro1Text() { +void DreamWebEngine::intro1Text() { if (_introCount != 2 && _introCount != 4 && _introCount != 6) return; @@ -689,22 +689,22 @@ void DreamBase::intro1Text() { } } -void DreamBase::intro2Text(uint16 nextReelPointer) { +void DreamWebEngine::intro2Text(uint16 nextReelPointer) { if (nextReelPointer == 5) setupTimedTemp(43, 82, 34, 40, 90, 1); else if (nextReelPointer == 15) setupTimedTemp(44, 82, 34, 40, 90, 1); } -void DreamBase::intro3Text(uint16 nextReelPointer) { +void DreamWebEngine::intro3Text(uint16 nextReelPointer) { if (nextReelPointer == 107) setupTimedTemp(45, 82, 36, 56, 100, 1); else if (nextReelPointer == (isCD() ? 108 : 109)) setupTimedTemp(46, 82, 36, 56, 100, 1); } -void DreamBase::monks2text() { - bool isGermanCD = isCD() && engine->getLanguage() == Common::DE_DEU; +void DreamWebEngine::monks2text() { + bool isGermanCD = isCD() && getLanguage() == Common::DE_DEU; if (_introCount == 1) setupTimedTemp(8, 82, 36, 160, 120, 1); @@ -740,7 +740,7 @@ void DreamBase::monks2text() { setupTimedTemp(18, 82, 36, 160, 120, 1); } -void DreamBase::textForEnd() { +void DreamWebEngine::textForEnd() { if (_introCount == 20) setupTimedTemp(0, 83, 34, 20, 60, 1); else if (_introCount == (isCD() ? 50 : 65)) @@ -749,14 +749,14 @@ void DreamBase::textForEnd() { setupTimedTemp(2, 83, 34, 20, 60, 1); } -void DreamBase::textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) { +void DreamWebEngine::textForMonkHelper(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) { if (isCD() && _channel1Playing != 255) _introCount--; else setupTimedTemp(textIndex, voiceIndex, x, y, countToTimed, timeCount); } -void DreamBase::textForMonk() { +void DreamWebEngine::textForMonk() { if (_introCount == 1) textForMonkHelper(19, 82, 68, 154, 120, 1); else if (_introCount == 5) @@ -792,7 +792,7 @@ void DreamBase::textForMonk() { } } -void DreamBase::reelsOnScreen() { +void DreamWebEngine::reelsOnScreen() { reconstruct(); updatePeople(); watchReel(); @@ -800,7 +800,7 @@ void DreamBase::reelsOnScreen() { useTimedText(); } -void DreamBase::reconstruct() { +void DreamWebEngine::reconstruct() { if (_haveDoneObs == 0) return; _vars._newObs = 1; @@ -1064,10 +1064,10 @@ static const ReelSound *g_roomByRoom[] = { }; -void DreamBase::soundOnReels(uint16 reelPointer) { +void DreamWebEngine::soundOnReels(uint16 reelPointer) { const ReelSound *r = g_roomByRoom[_realLocation]; - if (engine->getLanguage() == Common::DE_DEU && r == g_roomSound29) + if (getLanguage() == Common::DE_DEU && r == g_roomSound29) r = g_roomSound29_German; for (; r->_sample != 255; ++r) { @@ -1091,7 +1091,7 @@ void DreamBase::soundOnReels(uint16 reelPointer) { _lastSoundReel = (uint16)-1; } -void DreamBase::clearBeforeLoad() { +void DreamWebEngine::clearBeforeLoad() { if (_roomLoaded != 1) return; // noclear @@ -1114,25 +1114,25 @@ void DreamBase::clearBeforeLoad() { _roomLoaded = 0; } -void DreamBase::clearReels() { +void DreamWebEngine::clearReels() { _reel1.clear(); _reel2.clear(); _reel3.clear(); } -void DreamBase::getRidOfReels() { +void DreamWebEngine::getRidOfReels() { if (_roomLoaded) clearReels(); } -void DreamBase::liftNoise(uint8 index) { +void DreamWebEngine::liftNoise(uint8 index) { if (_realLocation == 5 || _realLocation == 21) playChannel1(13); // hiss noise else playChannel1(index); } -void DreamBase::checkForExit(Sprite *sprite) { +void DreamWebEngine::checkForExit(Sprite *sprite) { uint8 flag, flagEx, type, flagX, flagY; checkOne(_ryanX + 12, _ryanY + 12, &flag, &flagEx, &type, &flagX, &flagY); _lastFlag = flag; @@ -1189,4 +1189,4 @@ void DreamBase::checkForExit(Sprite *sprite) { _vars._needToTravel = 1; } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/structs.h b/engines/dreamweb/structs.h index defc6850d0..08aa9048b4 100644 --- a/engines/dreamweb/structs.h +++ b/engines/dreamweb/structs.h @@ -26,7 +26,7 @@ #include "common/endian.h" #include "common/rect.h" -namespace DreamGen { +namespace DreamWeb { struct GraphicsFile; struct SetObject; @@ -57,9 +57,7 @@ struct Sprite { uint8 hidden; }; -class DreamGenContext; - -template +template struct RectWithCallback { uint16 _xMin, _xMax; uint16 _yMin, _yMax; diff --git a/engines/dreamweb/stubs.cpp b/engines/dreamweb/stubs.cpp index b0b4e621c8..6067b20a22 100644 --- a/engines/dreamweb/stubs.cpp +++ b/engines/dreamweb/stubs.cpp @@ -23,7 +23,7 @@ #include "dreamweb/dreamweb.h" #include "common/config-manager.h" -namespace DreamGen { +namespace DreamWeb { // Keyboard buffer. _bufferIn and _bufferOut are indexes // into this, making it a ring buffer @@ -456,8 +456,8 @@ static const Atmosphere g_atmosphereList[] = { }; -void DreamBase::dreamweb() { - switch(engine->getLanguage()) { +void DreamWebEngine::dreamweb() { + switch(getLanguage()) { case Common::EN_ANY: case Common::EN_GRB: case Common::EN_USA: @@ -484,7 +484,7 @@ void DreamBase::dreamweb() { readSetData(); _wonGame = false; - engine->loadSounds(0, "DREAMWEB.V99"); // basic sample + loadSounds(0, "DREAMWEB.V99"); // basic sample bool firstLoop = true; @@ -672,7 +672,7 @@ done: // The engine will need some cleaner finalization, let's put it here for n _commandText.clear(); } -void DreamBase::loadTextFile(TextFile &file, const char *fileName) +void DreamWebEngine::loadTextFile(TextFile &file, const char *fileName) { FileHeader header; @@ -689,7 +689,7 @@ void DreamBase::loadTextFile(TextFile &file, const char *fileName) f.read(file._text, sizeInBytes - 2*66); } -void DreamBase::screenUpdate() { +void DreamWebEngine::screenUpdate() { newPlace(); mainScreen(); if (_quitRequested) @@ -745,7 +745,7 @@ void DreamBase::screenUpdate() { delPointer(); } -void DreamBase::startup() { +void DreamWebEngine::startup() { _currentKey = 0; _mainMode = 0; createPanel(); @@ -760,7 +760,7 @@ void DreamBase::startup() { atmospheres(); } -void DreamBase::startup1() { +void DreamWebEngine::startup1() { clearPalette(); _vars._throughDoor = 0; @@ -770,15 +770,15 @@ void DreamBase::startup1() { fadeScreenUp(); } -void DreamBase::switchRyanOn() { +void DreamWebEngine::switchRyanOn() { _vars._ryanOn = 255; } -void DreamBase::switchRyanOff() { +void DreamWebEngine::switchRyanOff() { _vars._ryanOn = 1; } -void DreamBase::loadGraphicsFile(GraphicsFile &file, const char *fileName) { +void DreamWebEngine::loadGraphicsFile(GraphicsFile &file, const char *fileName) { FileHeader header; Common::File f; @@ -794,40 +794,40 @@ void DreamBase::loadGraphicsFile(GraphicsFile &file, const char *fileName) { f.read(file._data, sizeInBytes - 2080); } -void DreamBase::loadGraphicsSegment(GraphicsFile &file, unsigned int len) { +void DreamWebEngine::loadGraphicsSegment(GraphicsFile &file, unsigned int len) { assert(len >= 2080); delete[] file._data; file._data = new uint8[len - 2080]; - engine->readFromFile((uint8 *)file._frames, 2080); - engine->readFromFile(file._data, len - 2080); + readFromFile((uint8 *)file._frames, 2080); + readFromFile(file._data, len - 2080); } -void DreamBase::loadTextSegment(TextFile &file, unsigned int len) { +void DreamWebEngine::loadTextSegment(TextFile &file, unsigned int len) { unsigned int headerSize = 2 * file._size; assert(len >= headerSize); delete[] file._text; file._text = new char[len - headerSize]; - engine->readFromFile((uint8 *)file._offsetsLE, headerSize); - engine->readFromFile((uint8 *)file._text, len - headerSize); + readFromFile((uint8 *)file._offsetsLE, headerSize); + readFromFile((uint8 *)file._text, len - headerSize); } -void DreamBase::loadIntoTemp(const char *fileName) { +void DreamWebEngine::loadIntoTemp(const char *fileName) { loadGraphicsFile(_tempGraphics, fileName); } -void DreamBase::loadIntoTemp2(const char *fileName) { +void DreamWebEngine::loadIntoTemp2(const char *fileName) { loadGraphicsFile(_tempGraphics2, fileName); } -void DreamBase::loadIntoTemp3(const char *fileName) { +void DreamWebEngine::loadIntoTemp3(const char *fileName) { loadGraphicsFile(_tempGraphics3, fileName); } -void DreamBase::loadTempCharset(const char *fileName) { +void DreamWebEngine::loadTempCharset(const char *fileName) { loadGraphicsFile(_tempCharset, fileName); } -void DreamBase::hangOnCurs(uint16 frameCount) { +void DreamWebEngine::hangOnCurs(uint16 frameCount) { for (uint16 i = 0; i < frameCount; ++i) { printCurs(); vSync(); @@ -835,35 +835,35 @@ void DreamBase::hangOnCurs(uint16 frameCount) { } } -void DreamBase::seeCommandTail() { +void DreamWebEngine::seeCommandTail() { _brightness = 1; } -void DreamBase::quickQuit() { - engine->quit(); +void DreamWebEngine::quickQuit() { + quit(); } -void DreamBase::quickQuit2() { - engine->quit(); +void DreamWebEngine::quickQuit2() { + quit(); } -void DreamBase::readMouse() { +void DreamWebEngine::readMouse() { _oldButton = _mouseButton; uint16 state = readMouseState(); _mouseButton = state; } -uint16 DreamBase::readMouseState() { +uint16 DreamWebEngine::readMouseState() { _oldX = _mouseX; _oldY = _mouseY; uint16 x, y, state; - engine->mouseCall(&x, &y, &state); + mouseCall(&x, &y, &state); _mouseX = x; _mouseY = y; return state; } -void DreamBase::dumpTextLine() { +void DreamWebEngine::dumpTextLine() { if (_newTextLine != 1) return; _newTextLine = 0; @@ -874,21 +874,21 @@ void DreamBase::dumpTextLine() { multiDump(x, y, 228, 13); } -void DreamBase::getUnderTimed() { +void DreamWebEngine::getUnderTimed() { if (_foreignRelease) multiGet(_underTimedText, _timedX, _timedY - 3, 240, kUnderTimedTextSizeY_f); else multiGet(_underTimedText, _timedX, _timedY, 240, kUnderTimedTextSizeY); } -void DreamBase::putUnderTimed() { +void DreamWebEngine::putUnderTimed() { if (_foreignRelease) multiPut(_underTimedText, _timedX, _timedY - 3, 240, kUnderTimedTextSizeY_f); else multiPut(_underTimedText, _timedX, _timedY, 240, kUnderTimedTextSizeY); } -void DreamBase::triggerMessage(uint16 index) { +void DreamWebEngine::triggerMessage(uint16 index) { multiGet(_mapStore, 174, 153, 200, 63); const uint8 *string = (const uint8 *)_puzzleText.getString(index); uint16 y = 156; @@ -901,7 +901,7 @@ void DreamBase::triggerMessage(uint16 index) { _vars._lastTrigger = 0; } -void DreamBase::processTrigger() { +void DreamWebEngine::processTrigger() { if (_vars._lastTrigger == '1') { setLocation(8); triggerMessage(45); @@ -914,7 +914,7 @@ void DreamBase::processTrigger() { } } -void DreamBase::useTimedText() { +void DreamWebEngine::useTimedText() { if (_timeCount == 0) return; --_timeCount; @@ -934,7 +934,7 @@ void DreamBase::useTimedText() { _needToDumpTimed = 1; } -void DreamBase::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) { +void DreamWebEngine::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 y, uint16 countToTimed, uint16 timeCount) { #if 1 // if cd if (voiceIndex != 0) { if (loadSpeech('T', voiceIndex, 'T', textIndex)) { @@ -959,7 +959,7 @@ void DreamBase::setupTimedTemp(uint8 textIndex, uint8 voiceIndex, uint8 x, uint8 debug(1, "setupTimedTemp: (%d, %d) => '%s'", textIndex, voiceIndex, _timedString); } -void DreamBase::dumpTimedText() { +void DreamWebEngine::dumpTimedText() { const uint16 kUndertimedysize = 30; if (_needToDumpTimed != 1) return; @@ -971,7 +971,7 @@ void DreamBase::dumpTimedText() { _needToDumpTimed = 0; } -void DreamBase::getTime() { +void DreamWebEngine::getTime() { TimeDate t; g_system->getTimeAndDate(t); debug(1, "\tgettime: %02d:%02d:%02d", t.tm_hour, t.tm_min, t.tm_sec); @@ -980,21 +980,7 @@ void DreamBase::getTime() { _vars._hourCount = t.tm_hour; } -uint16 DreamBase::allocateMem(uint16 paragraphs) { - uint size = (paragraphs + 2) * 16; - debug(1, "allocate mem, %u bytes", size); - SegmentRef seg = allocateSegment(size); - uint16 result = (uint16)seg; - debug(1, "\tsegment address -> %04x", result); - return result; -} - -void DreamBase::deallocateMem(uint16 segment) { - debug(1, "deallocating segment %04x", segment); - deallocateSegment(segment); -} - -void DreamBase::DOSReturn() { +void DreamWebEngine::DOSReturn() { if (_commandType != 250) { _commandType = 250; commandOnly(46); @@ -1002,11 +988,11 @@ void DreamBase::DOSReturn() { if (_mouseButton & 1) { _mouseButton = 0; - engine->quit(); + quit(); } } -void DreamBase::eraseOldObs() { +void DreamWebEngine::eraseOldObs() { if (_vars._newObs == 0) return; @@ -1024,7 +1010,7 @@ void DreamBase::eraseOldObs() { } } -void DreamBase::lockMon() { +void DreamWebEngine::lockMon() { // Pressing space pauses text output in the monitor. We use the "hard" // key because calling readkey() drains characters from the input // buffer, we we want the user to be able to type ahead while the text @@ -1037,8 +1023,8 @@ void DreamBase::lockMon() { } while (_currentKey != 0); lockLightOn(); - while (!engine->shouldQuit()) { - engine->waitForVSync(); + while (!shouldQuit()) { + waitForVSync(); readKey(); if (_currentKey == ' ') break; @@ -1050,14 +1036,14 @@ void DreamBase::lockMon() { } } -void DreamBase::clearAndLoad(uint8 *buf, uint8 c, +void DreamWebEngine::clearAndLoad(uint8 *buf, uint8 c, unsigned int size, unsigned int maxSize) { assert(size <= maxSize); memset(buf, c, maxSize); - engine->readFromFile(buf, size); + readFromFile(buf, size); } -void DreamBase::startLoading(const Room &room) { +void DreamWebEngine::startLoading(const Room &room) { _vars._combatCount = 0; _roomsSample = room.roomsSample; _mapX = room.mapX; @@ -1093,7 +1079,7 @@ void DreamBase::startLoading(const Room &room) { findXYFromPath(); } -void DreamBase::dealWithSpecial(uint8 firstParam, uint8 secondParam) { +void DreamWebEngine::dealWithSpecial(uint8 firstParam, uint8 secondParam) { uint8 type = firstParam - 220; if (type == 0) { placeSetObject(secondParam); @@ -1120,7 +1106,7 @@ void DreamBase::dealWithSpecial(uint8 firstParam, uint8 secondParam) { } } -void DreamBase::plotReel(uint16 &reelPointer) { +void DreamWebEngine::plotReel(uint16 &reelPointer) { Reel *reel = getReelStart(reelPointer); while (reel->x >= 220 && reel->x != 255) { dealWithSpecial(reel->x, reel->y); @@ -1136,21 +1122,21 @@ void DreamBase::plotReel(uint16 &reelPointer) { soundOnReels(reelPointer); } -void DreamBase::delTextLine() { +void DreamWebEngine::delTextLine() { if (_foreignRelease) multiPut(_textUnder, _textAddressX, _textAddressY - 3, kUnderTextSizeX_f, kUnderTextSizeY_f); else multiPut(_textUnder, _textAddressX, _textAddressY, kUnderTextSizeX, kUnderTextSizeY); } -void DreamBase::commandOnly(uint8 command) { +void DreamWebEngine::commandOnly(uint8 command) { delTextLine(); const uint8 *string = (const uint8 *)_commandText.getString(command); printDirect(string, _textAddressX, _textAddressY, _textLen, (bool)(_textLen & 1)); _newTextLine = 1; } -bool DreamBase::checkIfPerson(uint8 x, uint8 y) { +bool DreamWebEngine::checkIfPerson(uint8 x, uint8 y) { Common::List::iterator i; for (i = _peopleList.begin(); i != _peopleList.end(); ++i) { People &people = *i; @@ -1177,7 +1163,7 @@ bool DreamBase::checkIfPerson(uint8 x, uint8 y) { return false; } -bool DreamBase::checkIfFree(uint8 x, uint8 y) { +bool DreamWebEngine::checkIfFree(uint8 x, uint8 y) { Common::List::const_iterator i; for (i = _freeList.reverse_begin(); i != _freeList.end(); --i) { const ObjPos &pos = *i; @@ -1190,7 +1176,7 @@ bool DreamBase::checkIfFree(uint8 x, uint8 y) { return false; } -bool DreamBase::checkIfEx(uint8 x, uint8 y) { +bool DreamWebEngine::checkIfEx(uint8 x, uint8 y) { Common::List::const_iterator i; for (i = _exList.reverse_begin(); i != _exList.end(); --i) { const ObjPos &pos = *i; @@ -1203,7 +1189,7 @@ bool DreamBase::checkIfEx(uint8 x, uint8 y) { return false; } -const uint8 *DreamBase::findObName(uint8 type, uint8 index) { +const uint8 *DreamWebEngine::findObName(uint8 type, uint8 index) { if (type == 5) { uint16 i = 64 * (index & 127); return (const uint8 *)_personText.getString(i); @@ -1218,7 +1204,7 @@ const uint8 *DreamBase::findObName(uint8 type, uint8 index) { } } -void DreamBase::copyName(uint8 type, uint8 index, uint8 *dst) { +void DreamWebEngine::copyName(uint8 type, uint8 index, uint8 *dst) { const uint8 *src = findObName(type, index); size_t i; for (i = 0; i < 28; ++i) { @@ -1232,7 +1218,7 @@ void DreamBase::copyName(uint8 type, uint8 index, uint8 *dst) { dst[i] = 0; } -void DreamBase::commandWithOb(uint8 command, uint8 type, uint8 index) { +void DreamWebEngine::commandWithOb(uint8 command, uint8 type, uint8 index) { uint8 commandLine[64] = "OBJECT NAME ONE "; delTextLine(); uint8 textLen = _textLen; @@ -1248,23 +1234,23 @@ void DreamBase::commandWithOb(uint8 command, uint8 type, uint8 index) { _newTextLine = 1; } -void DreamBase::examineObText() { +void DreamWebEngine::examineObText() { commandWithOb(1, _commandType, _command); } -void DreamBase::blockNameText() { +void DreamWebEngine::blockNameText() { commandWithOb(0, _commandType, _command); } -void DreamBase::personNameText() { +void DreamWebEngine::personNameText() { commandWithOb(2, _commandType, _command & 127); } -void DreamBase::walkToText() { +void DreamWebEngine::walkToText() { commandWithOb(3, _commandType, _command); } -void DreamBase::findOrMake(uint8 index, uint8 value, uint8 type) { +void DreamWebEngine::findOrMake(uint8 index, uint8 value, uint8 type) { Change *change = _listOfChanges; for (; change->index != 0xff; ++change) { if (index == change->index && _realLocation == change->location && type == change->type) { @@ -1279,29 +1265,29 @@ void DreamBase::findOrMake(uint8 index, uint8 value, uint8 type) { change->type = type; } -void DreamBase::setAllChanges() { +void DreamWebEngine::setAllChanges() { Change *change = _listOfChanges; for (; change->index != 0xff; ++change) if (change->location == _realLocation) doChange(change->index, change->value, change->type); } -DynObject *DreamBase::getFreeAd(uint8 index) { +DynObject *DreamWebEngine::getFreeAd(uint8 index) { return &_freeDat[index]; } -DynObject *DreamBase::getExAd(uint8 index) { +DynObject *DreamWebEngine::getExAd(uint8 index) { return &_exData[index]; } -DynObject *DreamBase::getEitherAdCPP() { +DynObject *DreamWebEngine::getEitherAdCPP() { if (_objectType == kExObjectType) return getExAd(_itemFrame); else return getFreeAd(_itemFrame); } -void *DreamBase::getAnyAd(uint8 *slotSize, uint8 *slotCount) { +void *DreamWebEngine::getAnyAd(uint8 *slotSize, uint8 *slotCount) { if (_objectType == kExObjectType) { DynObject *exObject = getExAd(_command); *slotSize = exObject->slotSize; @@ -1324,7 +1310,7 @@ void *DreamBase::getAnyAd(uint8 *slotSize, uint8 *slotCount) { } } -void *DreamBase::getAnyAdDir(uint8 index, uint8 flag) { +void *DreamWebEngine::getAnyAdDir(uint8 index, uint8 flag) { if (flag == 4) return getExAd(index); else if (flag == 2) @@ -1333,11 +1319,11 @@ void *DreamBase::getAnyAdDir(uint8 index, uint8 flag) { return getSetAd(index); } -SetObject *DreamBase::getSetAd(uint8 index) { +SetObject *DreamWebEngine::getSetAd(uint8 index) { return &_setDat[index]; } -void DreamBase::doChange(uint8 index, uint8 value, uint8 type) { +void DreamWebEngine::doChange(uint8 index, uint8 value, uint8 type) { if (type == 0) { //object getSetAd(index)->mapad[0] = value; } else if (type == 1) { //freeObject @@ -1349,7 +1335,7 @@ void DreamBase::doChange(uint8 index, uint8 value, uint8 type) { } } -void DreamBase::deleteTaken() { +void DreamWebEngine::deleteTaken() { for (size_t i = 0; i < kNumexobjects; ++i) { uint8 location = _exData[i].initialLocation; if (location == _realLocation) { @@ -1359,7 +1345,7 @@ void DreamBase::deleteTaken() { } } -uint8 DreamBase::getExPos() { +uint8 DreamWebEngine::getExPos() { DynObject *objects = _exData; for (size_t i = 0; i < kNumexobjects; ++i) { if (objects[i].mapad[0] == 0xff) @@ -1368,27 +1354,27 @@ uint8 DreamBase::getExPos() { error("Out of Ex object positions"); } -void DreamBase::placeSetObject(uint8 index) { +void DreamWebEngine::placeSetObject(uint8 index) { findOrMake(index, 0, 0); getSetAd(index)->mapad[0] = 0; } -void DreamBase::removeSetObject(uint8 index) { +void DreamWebEngine::removeSetObject(uint8 index) { findOrMake(index, 0xff, 0); getSetAd(index)->mapad[0] = 0xff; } -bool DreamBase::finishedWalking() { +bool DreamWebEngine::finishedWalking() { return (_linePointer == 254) && (_facing == _turnToFace); } -void DreamBase::getFlagUnderP(uint8 *flag, uint8 *flagEx) { +void DreamWebEngine::getFlagUnderP(uint8 *flag, uint8 *flagEx) { uint8 type, flagX, flagY; checkOne(_mouseX - _mapAdX, _mouseY - _mapAdY, flag, flagEx, &type, &flagX, &flagY); _lastFlag = *flag; } -void DreamBase::walkAndExamine() { +void DreamWebEngine::walkAndExamine() { if (!finishedWalking()) return; _commandType = _walkExamType; @@ -1398,7 +1384,7 @@ void DreamBase::walkAndExamine() { examineOb(); } -void DreamBase::obName(uint8 command, uint8 commandType) { +void DreamWebEngine::obName(uint8 command, uint8 commandType) { if (_reAssesChanges == 0) { if ((commandType == _commandType) && (command == _command)) { if (_walkAndExam == 1) { @@ -1470,7 +1456,7 @@ void DreamBase::obName(uint8 command, uint8 commandType) { } } -void DreamBase::delPointer() { +void DreamWebEngine::delPointer() { if (_oldPointerX == 0xffff) return; _delHereX = _oldPointerX; @@ -1480,7 +1466,7 @@ void DreamBase::delPointer() { multiPut(_pointerBack, _delHereX, _delHereY, _pointerXS, _pointerYS); } -void DreamBase::showBlink() { +void DreamWebEngine::showBlink() { if (_manIsOffScreen == 1) return; ++_blinkCount; @@ -1501,7 +1487,7 @@ void DreamBase::showBlink() { showFrame(_icons1, 44, 32, blinkTab[blinkFrame], 0, &width, &height); } -void DreamBase::dumpBlink() { +void DreamWebEngine::dumpBlink() { if (_vars._shadesOn != 0) return; if (_blinkCount != 0) @@ -1511,14 +1497,14 @@ void DreamBase::dumpBlink() { multiDump(44, 32, 16, 12); } -void DreamBase::dumpPointer() { +void DreamWebEngine::dumpPointer() { dumpBlink(); multiDump(_delHereX, _delHereY, _delXS, _delYS); if ((_oldPointerX != _delHereX) || (_oldPointerY != _delHereY)) multiDump(_oldPointerX, _oldPointerY, _pointerXS, _pointerYS); } -void DreamBase::showPointer() { +void DreamWebEngine::showPointer() { showBlink(); uint16 x = _mouseX; _oldPointerX = _mouseX; @@ -1562,7 +1548,7 @@ void DreamBase::showPointer() { } } -void DreamBase::animPointer() { +void DreamWebEngine::animPointer() { if (_pointerMode == 2) { _pointerFrame = 0; @@ -1616,12 +1602,12 @@ void DreamBase::animPointer() { _pointerFrame = 8; } -void DreamBase::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) { +void DreamWebEngine::printMessage(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered) { const uint8 *string = (const uint8 *)_commandText.getString(index); printDirect(string, x, y, maxWidth, centered); } -void DreamBase::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) { +void DreamWebEngine::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, bool centered, uint8 count) { const uint8 *string = (const uint8 *)_commandText.getString(index); while (count--) { findNextColon(&string); @@ -1629,7 +1615,7 @@ void DreamBase::printMessage2(uint16 x, uint16 y, uint8 index, uint8 maxWidth, b printDirect(string, x, y, maxWidth, centered); } -bool DreamBase::objectMatches(void *object, const char *id) { +bool DreamWebEngine::objectMatches(void *object, const char *id) { const char *objId = (const char *)object + 12; // whether it is a DynObject or a SetObject for (size_t i = 0; i < 4; ++i) { if (id[i] != objId[i] + 'A') @@ -1638,11 +1624,11 @@ bool DreamBase::objectMatches(void *object, const char *id) { return true; } -bool DreamBase::compare(uint8 index, uint8 flag, const char id[4]) { +bool DreamWebEngine::compare(uint8 index, uint8 flag, const char id[4]) { return objectMatches(getAnyAdDir(index, flag), id); } -uint16 DreamBase::findSetObject(const char *id) { +uint16 DreamWebEngine::findSetObject(const char *id) { for (uint16 index = 0; index < 128; index++) { if (objectMatches(getSetAd(index), id)) return index; @@ -1651,7 +1637,7 @@ uint16 DreamBase::findSetObject(const char *id) { return 128; } -uint16 DreamBase::findExObject(const char *id) { +uint16 DreamWebEngine::findExObject(const char *id) { for (uint16 index = 0; index < kNumexobjects; index++) { if (objectMatches(getExAd(index), id)) return index; @@ -1660,7 +1646,7 @@ uint16 DreamBase::findExObject(const char *id) { return kNumexobjects; } -bool DreamBase::isRyanHolding(const char *id) { +bool DreamWebEngine::isRyanHolding(const char *id) { for (uint16 index = 0; index < kNumexobjects; index++) { DynObject *object = getExAd(index); if (object->mapad[0] == 4 && objectMatches(object, id)) @@ -1670,12 +1656,12 @@ bool DreamBase::isRyanHolding(const char *id) { return false; } -bool DreamBase::isItDescribed(const ObjPos *pos) { +bool DreamWebEngine::isItDescribed(const ObjPos *pos) { const char *string = _setDesc.getString(pos->index); return string[0] != 0; } -bool DreamBase::isCD() { +bool DreamWebEngine::isCD() { // The original sources has two codepaths depending if the game is 'if cd' or not // This is a hack to guess which version to use with the assumption that if we have a cd version // we managed to load the speech. At least it is isolated in this function and can be changed. @@ -1683,7 +1669,7 @@ bool DreamBase::isCD() { return (_speechLoaded); } -void DreamBase::showIcon() { +void DreamWebEngine::showIcon() { if (_realLocation < 50) { showPanel(); showMan(); @@ -1711,7 +1697,7 @@ void DreamBase::showIcon() { } } -bool DreamBase::checkIfSet(uint8 x, uint8 y) { +bool DreamWebEngine::checkIfSet(uint8 x, uint8 y) { Common::List::const_iterator i; for (i = _setList.reverse_begin(); i != _setList.end(); --i) { const ObjPos &pos = *i; @@ -1728,7 +1714,7 @@ bool DreamBase::checkIfSet(uint8 x, uint8 y) { return false; } -void DreamBase::hangOn(uint16 frameCount) { +void DreamWebEngine::hangOn(uint16 frameCount) { while (frameCount) { vSync(); --frameCount; @@ -1737,7 +1723,7 @@ void DreamBase::hangOn(uint16 frameCount) { } } -void DreamBase::hangOnW(uint16 frameCount) { +void DreamWebEngine::hangOnW(uint16 frameCount) { while (frameCount) { delPointer(); readMouse(); @@ -1751,7 +1737,7 @@ void DreamBase::hangOnW(uint16 frameCount) { } } -void DreamBase::hangOnP(uint16 count) { +void DreamWebEngine::hangOnP(uint16 count) { _mainTimer = 0; uint8 pointerFrame = _pointerFrame; uint8 pickup = _pickUp; @@ -1784,7 +1770,7 @@ void DreamBase::hangOnP(uint16 count) { _pointerMode = 0; } -uint8 DreamBase::findNextColon(const uint8 **string) { +uint8 DreamWebEngine::findNextColon(const uint8 **string) { uint8 c; do { c = **string; @@ -1793,7 +1779,7 @@ uint8 DreamBase::findNextColon(const uint8 **string) { return c; } -void DreamBase::enterSymbol() { +void DreamWebEngine::enterSymbol() { _manIsOffScreen = 1; getRidOfReels(); loadIntoTemp("DREAMWEB.G12"); // symbol graphics @@ -1817,13 +1803,13 @@ void DreamBase::enterSymbol() { dumpPointer(); dumpTextLine(); dumpSymbol(); - RectWithCallback symbolList[] = { - { kSymbolx+40,kSymbolx+64,kSymboly+2,kSymboly+16,&DreamBase::quitSymbol }, - { kSymbolx,kSymbolx+52,kSymboly+20,kSymboly+50,&DreamBase::setTopLeft }, - { kSymbolx+52,kSymbolx+104,kSymboly+20,kSymboly+50,&DreamBase::setTopRight }, - { kSymbolx,kSymbolx+52,kSymboly+50,kSymboly+80,&DreamBase::setBotLeft }, - { kSymbolx+52,kSymbolx+104,kSymboly+50,kSymboly+80,&DreamBase::setBotRight }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback symbolList[] = { + { kSymbolx+40,kSymbolx+64,kSymboly+2,kSymboly+16,&DreamWebEngine::quitSymbol }, + { kSymbolx,kSymbolx+52,kSymboly+20,kSymboly+50,&DreamWebEngine::setTopLeft }, + { kSymbolx+52,kSymbolx+104,kSymboly+20,kSymboly+50,&DreamWebEngine::setTopRight }, + { kSymbolx,kSymbolx+52,kSymboly+50,kSymboly+80,&DreamWebEngine::setBotLeft }, + { kSymbolx+52,kSymbolx+104,kSymboly+50,kSymboly+80,&DreamWebEngine::setBotRight }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(symbolList); @@ -1850,7 +1836,7 @@ void DreamBase::enterSymbol() { } } -void DreamBase::zoomOnOff() { +void DreamWebEngine::zoomOnOff() { if (_vars._watchingTime != 0 || _pointerMode == 2) { blank(); return; @@ -1878,7 +1864,7 @@ void DreamBase::zoomOnOff() { workToScreenM(); } -void DreamBase::sortOutMap() { +void DreamWebEngine::sortOutMap() { const uint8 *src = workspace(); uint8 *dst = _mapData; for (uint16 y = 0; y < kMapHeight; ++y) { @@ -1888,27 +1874,27 @@ void DreamBase::sortOutMap() { } } -void DreamBase::mainScreen() { +void DreamWebEngine::mainScreen() { _inMapArea = 0; if (_vars._watchOn == 1) { - RectWithCallback mainList[] = { - { 44,70,32,46,&DreamBase::look }, - { 0,50,0,180,&DreamBase::inventory }, - { 226,244,10,26,&DreamBase::zoomOnOff }, - { 226,244,26,40,&DreamBase::saveLoad }, - { 240,260,100,124,&DreamBase::madmanRun }, - { 0,320,0,200,&DreamBase::identifyOb }, + RectWithCallback mainList[] = { + { 44,70,32,46,&DreamWebEngine::look }, + { 0,50,0,180,&DreamWebEngine::inventory }, + { 226,244,10,26,&DreamWebEngine::zoomOnOff }, + { 226,244,26,40,&DreamWebEngine::saveLoad }, + { 240,260,100,124,&DreamWebEngine::madmanRun }, + { 0,320,0,200,&DreamWebEngine::identifyOb }, { 0xFFFF,0,0,0,0 } }; checkCoords(mainList); } else { - RectWithCallback mainList2[] = { - { 44,70,32,46,&DreamBase::look }, - { 0,50,0,180,&DreamBase::inventory }, - { 226+48,244+48,10,26,&DreamBase::zoomOnOff }, - { 226+48,244+48,26,40,&DreamBase::saveLoad }, - { 240,260,100,124,&DreamBase::madmanRun }, - { 0,320,0,200,&DreamBase::identifyOb }, + RectWithCallback mainList2[] = { + { 44,70,32,46,&DreamWebEngine::look }, + { 0,50,0,180,&DreamWebEngine::inventory }, + { 226+48,244+48,10,26,&DreamWebEngine::zoomOnOff }, + { 226+48,244+48,26,40,&DreamWebEngine::saveLoad }, + { 240,260,100,124,&DreamWebEngine::madmanRun }, + { 0,320,0,200,&DreamWebEngine::identifyOb }, { 0xFFFF,0,0,0,0 } }; checkCoords(mainList2); @@ -1918,21 +1904,21 @@ void DreamBase::mainScreen() { walkAndExamine(); } -void DreamBase::showWatch() { +void DreamWebEngine::showWatch() { if (_vars._watchOn) { showFrame(_icons1, 250, 1, 6, 0); showTime(); } } -void DreamBase::dumpWatch() { +void DreamWebEngine::dumpWatch() { if (_watchDump != 1) return; multiDump(256, 21, 40, 12); _watchDump = 0; } -void DreamBase::showTime() { +void DreamWebEngine::showTime() { if (_vars._watchOn == 0) return; @@ -1952,7 +1938,7 @@ void DreamBase::showTime() { showFrame(_charset1, 267+5, 21, 91*3+20, 0); } -void DreamBase::watchCount() { +void DreamWebEngine::watchCount() { if (_vars._watchOn == 0) return; ++_timerCount; @@ -1977,7 +1963,7 @@ void DreamBase::watchCount() { } } -void DreamBase::roomName() { +void DreamWebEngine::roomName() { printMessage(88, 18, 53, 240, false); uint16 textIndex = _roomNum; if (textIndex >= 32) @@ -1990,7 +1976,7 @@ void DreamBase::roomName() { useCharset1(); } -void DreamBase::loadRoom() { +void DreamWebEngine::loadRoom() { _roomLoaded = 1; _timeCount = 0; _mainTimer = 0; @@ -2011,7 +1997,7 @@ void DreamBase::loadRoom() { getDimension(&mapXstart, &mapYstart, &mapXsize, &mapYsize); } -void DreamBase::readSetData() { +void DreamWebEngine::readSetData() { loadGraphicsFile(_charset1, "DREAMWEB.C00"); loadGraphicsFile(_icons1, "DREAMWEB.G00"); loadGraphicsFile(_icons2, "DREAMWEB.G01"); @@ -2021,20 +2007,20 @@ void DreamBase::readSetData() { useCharset1(); // FIXME: Why is this commented out? - //engine->openFile("DREAMWEB.VOL"); + //openFile("DREAMWEB.VOL"); //uint8 *volumeTab = getSegment(data.word(kSoundbuffer)).ptr(16384, 0); - //engine->readFromFile(volumeTab, 2048-256); - //engine->closeFile(); + //readFromFile(volumeTab, 2048-256); + //closeFile(); } -void DreamBase::findRoomInLoc() { +void DreamWebEngine::findRoomInLoc() { uint8 x = _mapX / 11; uint8 y = _mapY / 10; uint8 roomNum = y * 6 + x; _roomNum = roomNum; } -void DreamBase::autoLook() { +void DreamWebEngine::autoLook() { if ((_mouseX != _oldX) || (_mouseY != _oldY)) { _lookCounter = 1000; return; @@ -2048,7 +2034,7 @@ void DreamBase::autoLook() { doLook(); } -void DreamBase::look() { +void DreamWebEngine::look() { if (_vars._watchingTime || (_pointerMode == 2)) { blank(); return; @@ -2061,7 +2047,7 @@ void DreamBase::look() { doLook(); } -void DreamBase::doLook() { +void DreamWebEngine::doLook() { createPanel(); showIcon(); underTextLine(); @@ -2085,35 +2071,35 @@ void DreamBase::doLook() { workToScreenM(); } -void DreamBase::useCharset1() { +void DreamWebEngine::useCharset1() { _currentCharset = &_charset1; } -void DreamBase::useTempCharset() { +void DreamWebEngine::useTempCharset() { _currentCharset = &_tempCharset; } -void DreamBase::getRidOfTemp() { +void DreamWebEngine::getRidOfTemp() { _tempGraphics.clear(); } -void DreamBase::getRidOfTempText() { +void DreamWebEngine::getRidOfTempText() { _textFile1.clear(); } -void DreamBase::getRidOfTemp2() { +void DreamWebEngine::getRidOfTemp2() { _tempGraphics2.clear(); } -void DreamBase::getRidOfTemp3() { +void DreamWebEngine::getRidOfTemp3() { _tempGraphics3.clear(); } -void DreamBase::getRidOfTempCharset() { +void DreamWebEngine::getRidOfTempCharset() { _tempCharset.clear(); } -void DreamBase::getRidOfAll() { +void DreamWebEngine::getRidOfAll() { delete[] _backdropBlocks; _backdropBlocks = 0; @@ -2132,14 +2118,14 @@ void DreamBase::getRidOfAll() { } // if skipDat, skip clearing and loading Setdat and Freedat -void DreamBase::loadRoomData(const Room &room, bool skipDat) { +void DreamWebEngine::loadRoomData(const Room &room, bool skipDat) { const uint16 kSetdatlen = 64*128; const uint16 kFreedatlen = 16*80; - engine->openFile(room.name); + openFile(room.name); FileHeader header; - engine->readFromFile((uint8 *)&header, sizeof(FileHeader)); + readFromFile((uint8 *)&header, sizeof(FileHeader)); // read segment lengths from room file header int len[15]; @@ -2148,8 +2134,8 @@ void DreamBase::loadRoomData(const Room &room, bool skipDat) { assert(len[0] >= 192); _backdropBlocks = new uint8[len[0] - 192]; - engine->readFromFile((uint8 *)_backdropFlags, 192); - engine->readFromFile(_backdropBlocks, len[0] - 192); + readFromFile((uint8 *)_backdropFlags, 192); + readFromFile(_backdropBlocks, len[0] - 192); clearAndLoad(workspace(), 0, len[1], 132*66); // 132*66 = maplen sortOutMap(); @@ -2158,7 +2144,7 @@ void DreamBase::loadRoomData(const Room &room, bool skipDat) { if (!skipDat) clearAndLoad((uint8 *)_setDat, 255, len[3], kSetdatlen); else - engine->skipBytes(len[3]); + skipBytes(len[3]); // NB: The skipDat version of this function as called by restoreall // had a 'call bloc' instead of 'call loadseg' for reel1, // but 'bloc' was not defined. @@ -2167,15 +2153,15 @@ void DreamBase::loadRoomData(const Room &room, bool skipDat) { loadGraphicsSegment(_reel3, len[6]); // segment 7 consists of 36*38 pathNodes followed by 'reelList' - engine->readFromFile((uint8 *)_pathData, 36*sizeof(RoomPaths)); + readFromFile((uint8 *)_pathData, 36*sizeof(RoomPaths)); unsigned int reelLen = len[7] - 36*sizeof(RoomPaths); unsigned int reelCount = (reelLen + sizeof(Reel) - 1) / sizeof(Reel); delete[] _reelList; _reelList = new Reel[reelCount]; - engine->readFromFile((uint8 *)_reelList, reelLen); + readFromFile((uint8 *)_reelList, reelLen); // segment 8 consists of 12 personFrames followed by a TextFile - engine->readFromFile((uint8 *)_personFramesLE, 24); + readFromFile((uint8 *)_personFramesLE, 24); loadTextSegment(_personText, len[8] - 24); loadTextSegment(_setDesc, len[9]); @@ -2185,46 +2171,46 @@ void DreamBase::loadRoomData(const Room &room, bool skipDat) { if (!skipDat) clearAndLoad((uint8 *)_freeDat, 255, len[13], kFreedatlen); else - engine->skipBytes(len[13]); + skipBytes(len[13]); loadTextSegment(_freeDesc, len[14]); - engine->closeFile(); + closeFile(); } -void DreamBase::restoreAll() { +void DreamWebEngine::restoreAll() { const Room &room = g_roomData[_vars._location]; loadRoomData(room, true); setAllChanges(); } -void DreamBase::restoreReels() { +void DreamWebEngine::restoreReels() { if (_roomLoaded == 0) return; const Room &room = g_roomData[_realLocation]; - engine->openFile(room.name); + openFile(room.name); FileHeader header; - engine->readFromFile((uint8 *)&header, sizeof(FileHeader)); + readFromFile((uint8 *)&header, sizeof(FileHeader)); // read segment lengths from room file header int len[15]; for (int i = 0; i < 15; ++i) len[i] = header.len(i); - engine->skipBytes(len[0]); - engine->skipBytes(len[1]); - engine->skipBytes(len[2]); - engine->skipBytes(len[3]); + skipBytes(len[0]); + skipBytes(len[1]); + skipBytes(len[2]); + skipBytes(len[3]); loadGraphicsSegment(_reel1, len[4]); loadGraphicsSegment(_reel2, len[5]); loadGraphicsSegment(_reel3, len[6]); - engine->closeFile(); + closeFile(); } -void DreamBase::loadFolder() { +void DreamWebEngine::loadFolder() { loadIntoTemp("DREAMWEB.G09"); // folder graphics 1 loadIntoTemp2("DREAMWEB.G10"); // folder graphics 2 loadIntoTemp3("DREAMWEB.G11"); // folder graphics 3 @@ -2232,7 +2218,7 @@ void DreamBase::loadFolder() { loadTempText("DREAMWEB.T50"); // folder text } -void DreamBase::showFolder() { +void DreamWebEngine::showFolder() { _commandType = 255; if (_folderPage) { useTempCharset(); @@ -2257,7 +2243,7 @@ void DreamBase::showFolder() { } } -void DreamBase::showLeftPage() { +void DreamWebEngine::showLeftPage() { showFrame(_tempGraphics2, 0, 12, 3, 0); uint16 y = 12+5; for (size_t i = 0; i < 9; ++i) { @@ -2290,7 +2276,7 @@ void DreamBase::showLeftPage() { } } -void DreamBase::showRightPage() { +void DreamWebEngine::showRightPage() { showFrame(_tempGraphics2, 143, 12, 0, 0); uint16 y = 12+37; for (size_t i = 0; i < 7; ++i) { @@ -2315,18 +2301,18 @@ void DreamBase::showRightPage() { _lineSpacing = 10; } -void DreamBase::showExit() { +void DreamWebEngine::showExit() { showFrame(_icons1, 274, 154, 11, 0); } -void DreamBase::showMan() { +void DreamWebEngine::showMan() { showFrame(_icons1, 0, 0, 0, 0); showFrame(_icons1, 0, 114, 1, 0); if (_vars._shadesOn) showFrame(_icons1, 28, 25, 2, 0); } -void DreamBase::panelIcons1() { +void DreamWebEngine::panelIcons1() { uint16 x; if (_vars._watchOn != 1) x = 48; @@ -2338,26 +2324,26 @@ void DreamBase::panelIcons1() { showWatch(); } -void DreamBase::examIcon() { +void DreamWebEngine::examIcon() { showFrame(_icons2, 254, 5, 3, 0); } -const uint8 *DreamBase::getTextInFile1(uint16 index) { +const uint8 *DreamWebEngine::getTextInFile1(uint16 index) { return (const uint8 *)_textFile1.getString(index); } -void DreamBase::checkFolderCoords() { - RectWithCallback folderList[] = { - { 280,320,160,200, &DreamBase::quitKey }, - { 143,300,6,194, &DreamBase::nextFolder }, - { 0,143,6,194, &DreamBase::lastFolder }, - { 0,320,0,200, &DreamBase::blank }, +void DreamWebEngine::checkFolderCoords() { + RectWithCallback folderList[] = { + { 280,320,160,200, &DreamWebEngine::quitKey }, + { 143,300,6,194, &DreamWebEngine::nextFolder }, + { 0,143,6,194, &DreamWebEngine::lastFolder }, + { 0,320,0,200, &DreamWebEngine::blank }, { 0xFFFF,0,0,0, 0 } }; checkCoords(folderList); } -void DreamBase::nextFolder() { +void DreamWebEngine::nextFolder() { if (_folderPage == 12) { blank(); return; @@ -2377,7 +2363,7 @@ void DreamBase::nextFolder() { } } -void DreamBase::lastFolder() { +void DreamWebEngine::lastFolder() { if (_folderPage == 0) { blank(); return; @@ -2397,7 +2383,7 @@ void DreamBase::lastFolder() { } } -void DreamBase::folderHints() { +void DreamWebEngine::folderHints() { if (_folderPage == 5) { if ((_vars._aideDead != 1) && (getLocation(13) != 1)) { setLocation(13); @@ -2419,19 +2405,19 @@ void DreamBase::folderHints() { } } -void DreamBase::folderExit() { +void DreamWebEngine::folderExit() { showFrame(_tempGraphics2, 296, 178, 6, 0); } -void DreamBase::loadTravelText() { +void DreamWebEngine::loadTravelText() { loadTextFile(_travelText, "DREAMWEB.T81"); // location descs } -void DreamBase::loadTempText(const char *fileName) { +void DreamWebEngine::loadTempText(const char *fileName) { loadTextFile(_textFile1, fileName); } -void DreamBase::drawFloor() { +void DreamWebEngine::drawFloor() { eraseOldObs(); drawFlags(); calcMapAd(); @@ -2444,14 +2430,14 @@ void DreamBase::drawFloor() { _vars._newObs = 0; } -void DreamBase::allocateBuffers() { +void DreamWebEngine::allocateBuffers() { _exFrames.clear(); _exFrames._data = new uint8[kExframeslen]; _exText.clear(); _exText._text = new char[kExtextlen]; } -void DreamBase::workToScreenM() { +void DreamWebEngine::workToScreenM() { animPointer(); readMouse(); showPointer(); @@ -2460,23 +2446,23 @@ void DreamBase::workToScreenM() { delPointer(); } -void DreamBase::loadMenu() { +void DreamWebEngine::loadMenu() { loadIntoTemp("DREAMWEB.S02"); // sprite name 3 loadIntoTemp2("DREAMWEB.G07"); // mon. graphics 2 } -void DreamBase::showMenu() { +void DreamWebEngine::showMenu() { ++_menuCount; if (_menuCount == 37*2) _menuCount = 0; showFrame(_tempGraphics, kMenux, kMenuy, _menuCount / 2, 0); } -void DreamBase::dumpMenu() { +void DreamWebEngine::dumpMenu() { multiDump(kMenux, kMenuy, 48, 48); } -void DreamBase::useMenu() { +void DreamWebEngine::useMenu() { getRidOfReels(); loadMenu(); createPanel(); @@ -2500,9 +2486,9 @@ void DreamBase::useMenu() { dumpPointer(); dumpMenu(); dumpTextLine(); - RectWithCallback menuList[] = { - { kMenux+54,kMenux+68,kMenuy+72,kMenuy+88,&DreamBase::quitKey }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback menuList[] = { + { kMenux+54,kMenux+68,kMenuy+72,kMenuy+88,&DreamWebEngine::quitKey }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; checkCoords(menuList); @@ -2515,7 +2501,7 @@ void DreamBase::useMenu() { workToScreenM(); } -void DreamBase::atmospheres() { +void DreamWebEngine::atmospheres() { const Atmosphere *a = &g_atmosphereList[0]; @@ -2577,7 +2563,7 @@ void DreamBase::atmospheres() { cancelCh0(); } -uint8 DreamBase::nextSymbol(uint8 symbol) { +uint8 DreamWebEngine::nextSymbol(uint8 symbol) { uint8 result = symbol + 1; if (result == 6) return 0; @@ -2586,7 +2572,7 @@ uint8 DreamBase::nextSymbol(uint8 symbol) { return result; } -void DreamBase::showSymbol() { +void DreamWebEngine::showSymbol() { showFrame(_tempGraphics, kSymbolx, kSymboly, 12, 0); showFrame(_tempGraphics, _symbolTopX + kSymbolx-44, kSymboly+20, _symbolTopNum, 32); @@ -2602,7 +2588,7 @@ void DreamBase::showSymbol() { showFrame(_tempGraphics, _symbolBotX + kSymbolx+54, kSymboly+49, 6 + nextNextBotSymbol, 32); } -void DreamBase::readKey() { +void DreamWebEngine::readKey() { uint16 bufOut = _bufferOut; if (bufOut == _bufferIn) { @@ -2616,7 +2602,7 @@ void DreamBase::readKey() { _bufferOut = bufOut; } -void DreamBase::setTopLeft() { +void DreamWebEngine::setTopLeft() { if (_symbolTopDir != 0) { blank(); return; @@ -2631,7 +2617,7 @@ void DreamBase::setTopLeft() { _symbolTopDir = 0xFF; } -void DreamBase::setTopRight() { +void DreamWebEngine::setTopRight() { if (_symbolTopDir != 0) { blank(); return; @@ -2646,7 +2632,7 @@ void DreamBase::setTopRight() { _symbolTopDir = 1; } -void DreamBase::setBotLeft() { +void DreamWebEngine::setBotLeft() { if (_symbolBotDir != 0) { blank(); return; @@ -2661,7 +2647,7 @@ void DreamBase::setBotLeft() { _symbolBotDir = 0xFF; } -void DreamBase::setBotRight() { +void DreamWebEngine::setBotRight() { if (_symbolBotDir != 0) { blank(); return; @@ -2676,7 +2662,7 @@ void DreamBase::setBotRight() { _symbolBotDir = 1; } -void DreamBase::newGame() { +void DreamWebEngine::newGame() { if (_commandType != 251) { _commandType = 251; commandOnly(47); @@ -2686,7 +2672,7 @@ void DreamBase::newGame() { _getBack = 3; } -void DreamBase::pickupOb(uint8 command, uint8 pos) { +void DreamWebEngine::pickupOb(uint8 command, uint8 pos) { _lastInvPos = pos; _objectType = kFreeObjectType; _itemFrame = command; @@ -2696,7 +2682,7 @@ void DreamBase::pickupOb(uint8 command, uint8 pos) { transferToEx(command); } -void DreamBase::initialInv() { +void DreamWebEngine::initialInv() { if (_realLocation != 24) return; @@ -2716,7 +2702,7 @@ void DreamBase::initialInv() { switchRyanOff(); } -void DreamBase::walkIntoRoom() { +void DreamWebEngine::walkIntoRoom() { if (_vars._location == 14 && _mapX == 22) { _destination = 1; _finalDest = 1; @@ -2724,7 +2710,7 @@ void DreamBase::walkIntoRoom() { } } -void DreamBase::afterIntroRoom() { +void DreamWebEngine::afterIntroRoom() { if (_nowInNewRoom == 0) return; // notnewintro @@ -2739,7 +2725,7 @@ void DreamBase::afterIntroRoom() { _nowInNewRoom = 0; } -void DreamBase::redrawMainScrn() { +void DreamWebEngine::redrawMainScrn() { _timeCount = 0; createPanel(); _vars._newObs = 0; @@ -2753,20 +2739,20 @@ void DreamBase::redrawMainScrn() { _commandType = 255; } -void DreamBase::blank() { +void DreamWebEngine::blank() { if (_commandType != 199) { _commandType = 199; commandOnly(0); } } -void DreamBase::allPointer() { +void DreamWebEngine::allPointer() { readMouse(); showPointer(); dumpPointer(); } -void DreamBase::makeMainScreen() { +void DreamWebEngine::makeMainScreen() { createPanel(); _vars._newObs = 1; drawFloor(); @@ -2783,14 +2769,14 @@ void DreamBase::makeMainScreen() { _manIsOffScreen = 0; } -void DreamBase::openInv() { +void DreamWebEngine::openInv() { _invOpen = 1; printMessage(80, 58 - 10, 61, 240, (240 & 1)); fillRyan(); _commandType = 255; } -void DreamBase::obsThatDoThings() { +void DreamWebEngine::obsThatDoThings() { if (!compare(_command, _objectType, "MEMB")) return; // notlouiscard @@ -2800,7 +2786,7 @@ void DreamBase::obsThatDoThings() { } } -void DreamBase::describeOb() { +void DreamWebEngine::describeOb() { const uint8 *obText = getObTextStart(); uint16 y = 92; if (_foreignRelease && _objectType == kSetObjectType1) @@ -2826,7 +2812,7 @@ void DreamBase::describeOb() { } } -void DreamBase::delEverything() { +void DreamWebEngine::delEverything() { if (_mapYSize + _mapOffsetY < 182) { mapToPanel(); } else { @@ -2837,7 +2823,7 @@ void DreamBase::delEverything() { } } -void DreamBase::errorMessage1() { +void DreamWebEngine::errorMessage1() { delPointer(); printMessage(76, 21, 58, 240, (240 & 1)); readMouse(); @@ -2855,7 +2841,7 @@ void DreamBase::errorMessage1() { delPointer(); } -void DreamBase::errorMessage2() { +void DreamWebEngine::errorMessage2() { _commandType = 255; delPointer(); printMessage(76, 21, 59, 240, (240 & 1)); @@ -2874,7 +2860,7 @@ void DreamBase::errorMessage2() { delPointer(); } -void DreamBase::errorMessage3() { +void DreamWebEngine::errorMessage3() { delPointer(); printMessage(76, 21, 60, 240, (240 & 1)); workToScreenM(); @@ -2889,11 +2875,11 @@ void DreamBase::errorMessage3() { delPointer(); } -void DreamBase::reExFromOpen() { +void DreamWebEngine::reExFromOpen() { } -void DreamBase::putBackObStuff() { +void DreamWebEngine::putBackObStuff() { createPanel(); showPanel(); showMan(); @@ -2909,11 +2895,11 @@ void DreamBase::putBackObStuff() { delPointer(); } -bool DreamBase::isSetObOnMap(uint8 index) { +bool DreamWebEngine::isSetObOnMap(uint8 index) { return (getSetAd(index)->mapad[0] == 0); } -void DreamBase::examineInventory() { +void DreamWebEngine::examineInventory() { if (_commandType != 249) { _commandType = 249; commandOnly(32); @@ -2933,22 +2919,22 @@ void DreamBase::examineInventory() { workToScreenM(); } -void DreamBase::middlePanel() { +void DreamWebEngine::middlePanel() { } -void DreamBase::showDiary() { +void DreamWebEngine::showDiary() { showFrame(_tempGraphics, kDiaryx, kDiaryy + 37, 1, 0); showFrame(_tempGraphics, kDiaryx + 176, kDiaryy + 108, 2, 0); } -void DreamBase::underTextLine() { +void DreamWebEngine::underTextLine() { if (_foreignRelease) multiGet(_textUnder, _textAddressX, _textAddressY - 3, kUnderTextSizeX_f, kUnderTextSizeY_f); else multiGet(_textUnder, _textAddressX, _textAddressY, kUnderTextSizeX, kUnderTextSizeY); } -void DreamBase::showWatchReel() { +void DreamWebEngine::showWatchReel() { uint16 reelPointer = _vars._reelToWatch; plotReel(reelPointer); _vars._reelToWatch = reelPointer; @@ -2958,7 +2944,7 @@ void DreamBase::showWatchReel() { _vars._shakeCounter = 0xFF; } -void DreamBase::watchReel() { +void DreamWebEngine::watchReel() { if (_vars._reelToWatch != 0xFFFF) { if (_mansPath != _finalDest) return; // Wait until stopped walking @@ -3005,7 +2991,7 @@ void DreamBase::watchReel() { plotReel(reelPointer); } -void DreamBase::afterNewRoom() { +void DreamWebEngine::afterNewRoom() { if (_nowInNewRoom == 0) return; // notnew @@ -3036,7 +3022,7 @@ void DreamBase::afterNewRoom() { atmospheres(); } -void DreamBase::madmanRun() { +void DreamWebEngine::madmanRun() { if (_vars._location != 14 || _mapX != 22 || _pointerMode != 2 || @@ -3056,7 +3042,7 @@ void DreamBase::madmanRun() { } -void DreamBase::decide() { +void DreamWebEngine::decide() { setMode(); loadPalFromIFF(); clearPalette(); @@ -3073,11 +3059,11 @@ void DreamBase::decide() { fadeScreenUp(); _getBack = 0; - RectWithCallback decideList[] = { - { kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamBase::newGame }, - { kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamBase::DOSReturn }, - { kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamBase::loadOld }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback decideList[] = { + { kOpsx+69,kOpsx+124,kOpsy+30,kOpsy+76,&DreamWebEngine::newGame }, + { kOpsx+20,kOpsx+87,kOpsy+10,kOpsy+59,&DreamWebEngine::DOSReturn }, + { kOpsx+123,kOpsx+190,kOpsy+10,kOpsy+59,&DreamWebEngine::loadOld }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; @@ -3102,7 +3088,7 @@ void DreamBase::decide() { _textLen = 240; } -void DreamBase::showGun() { +void DreamWebEngine::showGun() { _addToRed = 0; _addToGreen = 0; _addToBlue = 0; @@ -3138,7 +3124,7 @@ void DreamBase::showGun() { getRidOfTempText(); } -void DreamBase::diaryKeyP() { +void DreamWebEngine::diaryKeyP() { if (_commandType != 214) { _commandType = 214; commandOnly(23); @@ -3158,7 +3144,7 @@ void DreamBase::diaryKeyP() { _diaryPage = 11; } -void DreamBase::diaryKeyN() { +void DreamWebEngine::diaryKeyN() { if (_commandType != 213) { _commandType = 213; commandOnly(23); @@ -3178,7 +3164,7 @@ void DreamBase::diaryKeyN() { _diaryPage = 0; } -void DreamBase::dropError() { +void DreamWebEngine::dropError() { _commandType = 255; delPointer(); printMessage(76, 21, 56, 240, 240 & 1); @@ -3191,7 +3177,7 @@ void DreamBase::dropError() { workToScreenM(); } -void DreamBase::cantDrop() { +void DreamWebEngine::cantDrop() { _commandType = 255; delPointer(); printMessage(76, 21, 24, 240, 240 & 1); @@ -3204,7 +3190,7 @@ void DreamBase::cantDrop() { workToScreenM(); } -void DreamBase::getBack1() { +void DreamWebEngine::getBack1() { if (_pickUp != 0) { blank(); return; @@ -3226,7 +3212,7 @@ void DreamBase::getBack1() { } } -void DreamBase::autoAppear() { +void DreamWebEngine::autoAppear() { if (_vars._location == 32) { // In alley resetLocation(5); @@ -3269,7 +3255,7 @@ void DreamBase::autoAppear() { } } -void DreamBase::quitKey() { +void DreamWebEngine::quitKey() { if (_commandType != 222) { _commandType = 222; commandOnly(4); @@ -3279,7 +3265,7 @@ void DreamBase::quitKey() { _getBack = 1; } -void DreamBase::setupTimedUse(uint16 textIndex, uint16 countToTimed, uint16 timeCount, byte x, byte y) { +void DreamWebEngine::setupTimedUse(uint16 textIndex, uint16 countToTimed, uint16 timeCount, byte x, byte y) { if (_timeCount != 0) return; // can't setup @@ -3291,7 +3277,7 @@ void DreamBase::setupTimedUse(uint16 textIndex, uint16 countToTimed, uint16 time debug(1, "setupTimedUse: %d => '%s'", textIndex, _timedString); } -void DreamBase::entryTexts() { +void DreamWebEngine::entryTexts() { switch (_vars._location) { case 21: setupTimedUse(28, 60, 11, 68, 64); @@ -3319,7 +3305,7 @@ void DreamBase::entryTexts() { } } -void DreamBase::entryAnims() { +void DreamWebEngine::entryAnims() { _vars._reelToWatch = 0xFFFF; _vars._watchMode = (byte)-1; @@ -3396,7 +3382,7 @@ void DreamBase::entryAnims() { } } -void DreamBase::updateSymbolTop() { +void DreamWebEngine::updateSymbolTop() { if (!_symbolTopDir) return; // topfinished @@ -3433,7 +3419,7 @@ void DreamBase::updateSymbolTop() { } } -void DreamBase::updateSymbolBot() { +void DreamWebEngine::updateSymbolBot() { if (!_symbolBotDir) return; // botfinished @@ -3470,7 +3456,7 @@ void DreamBase::updateSymbolBot() { } } -void DreamBase::showDiaryPage() { +void DreamWebEngine::showDiaryPage() { showFrame(_tempGraphics, kDiaryx, kDiaryy, 0, 0); _kerning = 1; useTempCharset(); @@ -3487,7 +3473,7 @@ void DreamBase::showDiaryPage() { useCharset1(); } -void DreamBase::dumpDiaryKeys() { +void DreamWebEngine::dumpDiaryKeys() { if (_pressCount == 1) { if (_vars._sartainDead != 1 && _diaryPage == 5 && getLocation(6) != 1) { // Add Sartain Industries note @@ -3513,7 +3499,7 @@ void DreamBase::dumpDiaryKeys() { multiDump(kDiaryx + 151, kDiaryy + 71, 16, 16); } -void DreamBase::lookAtCard() { +void DreamWebEngine::lookAtCard() { _manIsOffScreen = 1; getRidOfReels(); loadKeypad(); @@ -3538,11 +3524,11 @@ void DreamBase::lookAtCard() { putBackObStuff(); } -void DreamBase::clearBuffers() { +void DreamWebEngine::clearBuffers() { clearChanges(); } -void DreamBase::clearChanges() { +void DreamWebEngine::clearChanges() { memset(_listOfChanges, 0xFF, 4*kNumChanges); setupInitialReelRoutines(); @@ -3563,7 +3549,7 @@ void DreamBase::clearChanges() { memcpy(_roomsCanGo, initialRoomsCanGo, 16); } -void DreamBase::setupInitialVars() { +void DreamWebEngine::setupInitialVars() { _vars._startVars = 0; _vars._progressPoints = 0; _vars._watchOn = 0; @@ -3625,7 +3611,7 @@ void DreamBase::setupInitialVars() { _vars._shakeCounter = 48; } -void DreamBase::showDiaryKeys() { +void DreamWebEngine::showDiaryKeys() { if (!_pressCount) return; // nokeyatall @@ -3646,7 +3632,7 @@ void DreamBase::showDiaryKeys() { showDiaryPage(); } -void DreamBase::edensFlatReminders() { +void DreamWebEngine::edensFlatReminders() { if (_realLocation != 24 || _mapX != 44) return; // not in Eden's lift @@ -3674,7 +3660,7 @@ void DreamBase::edensFlatReminders() { _vars._progressPoints++; // got card } -void DreamBase::incRyanPage() { +void DreamWebEngine::incRyanPage() { if (_commandType != 222) { _commandType = 222; commandOnly(31); @@ -3694,7 +3680,7 @@ void DreamBase::incRyanPage() { } -void DreamBase::emergencyPurge() { +void DreamWebEngine::emergencyPurge() { while (true) { if (_vars._exFramePos + 4000 < kExframeslen) { // Not near frame end @@ -3706,7 +3692,7 @@ void DreamBase::emergencyPurge() { } } -void DreamBase::purgeAnItem() { +void DreamWebEngine::purgeAnItem() { const DynObject *extraObjects = _exData; for (size_t i = 0; i < kNumexobjects; ++i) { @@ -3725,4 +3711,4 @@ void DreamBase::purgeAnItem() { } } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/talk.cpp b/engines/dreamweb/talk.cpp index a1bbbe51da..2ff2aa7881 100644 --- a/engines/dreamweb/talk.cpp +++ b/engines/dreamweb/talk.cpp @@ -22,9 +22,9 @@ #include "dreamweb/dreamweb.h" -namespace DreamGen { +namespace DreamWeb { -void DreamBase::talk() { +void DreamWebEngine::talk() { _talkPos = 0; _inMapArea = 0; _character = _command; @@ -40,10 +40,10 @@ void DreamBase::talk() { showPointer(); workToScreen(); - RectWithCallback talkList[] = { - { 273,320,157,198,&DreamBase::getBack1 }, - { 240,290,2,44,&DreamBase::moreTalk }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback talkList[] = { + { 273,320,157,198,&DreamWebEngine::getBack1 }, + { 240,290,2,44,&DreamWebEngine::moreTalk }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; @@ -73,18 +73,18 @@ void DreamBase::talk() { } } -void DreamBase::convIcons() { +void DreamWebEngine::convIcons() { uint8 index = _character & 127; uint16 frame = getPersFrame(index); const GraphicsFile *base = findSource(frame); showFrame(*base, 234, 2, frame, 0); } -uint16 DreamBase::getPersFrame(uint8 index) { +uint16 DreamWebEngine::getPersFrame(uint8 index) { return READ_LE_UINT16(&_personFramesLE[index]); } -void DreamBase::startTalk() { +void DreamWebEngine::startTalk() { _talkMode = 0; const uint8 *str = getPersonText(_character & 0x7F, 0); @@ -107,11 +107,11 @@ void DreamBase::startTalk() { } } -const uint8 *DreamBase::getPersonText(uint8 index, uint8 talkPos) { +const uint8 *DreamWebEngine::getPersonText(uint8 index, uint8 talkPos) { return (const uint8 *)_personText.getString(index*64 + talkPos); } -void DreamBase::moreTalk() { +void DreamWebEngine::moreTalk() { if (_talkMode != 0) { redes(); return; @@ -136,7 +136,7 @@ void DreamBase::moreTalk() { doSomeTalk(); } -void DreamBase::doSomeTalk() { +void DreamWebEngine::doSomeTalk() { while (true) { const uint8 *str = getPersonText(_character & 0x7F, _talkPos); @@ -194,12 +194,12 @@ void DreamBase::doSomeTalk() { } } -bool DreamBase::hangOnPQ() { +bool DreamWebEngine::hangOnPQ() { _getBack = 0; - RectWithCallback quitList[] = { - { 273,320,157,198,&DreamBase::getBack1 }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback quitList[] = { + { 273,320,157,198,&DreamWebEngine::getBack1 }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; @@ -235,7 +235,7 @@ bool DreamBase::hangOnPQ() { return false; } -void DreamBase::redes() { +void DreamWebEngine::redes() { if (_channel1Playing != 255 || _talkMode != 2) { blank(); return; @@ -262,4 +262,4 @@ void DreamBase::redes() { delPointer(); } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/titles.cpp b/engines/dreamweb/titles.cpp index 37cdd70e9a..56e3f9583f 100644 --- a/engines/dreamweb/titles.cpp +++ b/engines/dreamweb/titles.cpp @@ -23,9 +23,9 @@ #include "dreamweb/dreamweb.h" #include "engines/util.h" -namespace DreamGen { +namespace DreamWeb { -void DreamBase::endGame() { +void DreamWebEngine::endGame() { loadTempText("DREAMWEB.T83"); monkSpeaking(); gettingShot(); @@ -35,7 +35,7 @@ void DreamBase::endGame() { hangOn(200); } -void DreamBase::monkSpeaking() { +void DreamWebEngine::monkSpeaking() { // FIXME: This is the CD version only. _roomsSample = 35; @@ -57,7 +57,7 @@ void DreamBase::monkSpeaking() { playChannel1(50 + 12); do { - engine->waitForVSync(); + waitForVSync(); } while (_channel1Playing != 255); } @@ -68,7 +68,7 @@ void DreamBase::monkSpeaking() { getRidOfTemp(); } -void DreamBase::gettingShot() { +void DreamWebEngine::gettingShot() { _newLocation = 55; clearPalette(); loadIntroRoom(); @@ -79,7 +79,7 @@ void DreamBase::gettingShot() { clearBeforeLoad(); } -void DreamBase::bibleQuote() { +void DreamWebEngine::bibleQuote() { initGraphics(640, 480, true); showPCX("DREAMWEB.I00"); @@ -110,7 +110,7 @@ void DreamBase::bibleQuote() { _lastHardKey = 0; } -void DreamBase::hangOne(uint16 delay) { +void DreamWebEngine::hangOne(uint16 delay) { do { vSync(); if (_lastHardKey == 1) @@ -118,7 +118,7 @@ void DreamBase::hangOne(uint16 delay) { } while (--delay); } -void DreamBase::intro() { +void DreamWebEngine::intro() { loadTempText("DREAMWEB.T82"); loadPalFromIFF(); setMode(); @@ -174,7 +174,7 @@ void DreamBase::intro() { _lastHardKey = 0; } -void DreamBase::runIntroSeq() { +void DreamWebEngine::runIntroSeq() { _getBack = 0; do { @@ -220,7 +220,7 @@ void DreamBase::runIntroSeq() { //clearBeforeLoad(); } -void DreamBase::runEndSeq() { +void DreamWebEngine::runEndSeq() { atmospheres(); _getBack = 0; @@ -240,7 +240,7 @@ void DreamBase::runEndSeq() { } while (_getBack != 1); } -void DreamBase::loadIntroRoom() { +void DreamWebEngine::loadIntroRoom() { _introCount = 0; _vars._location = 255; loadRoom(); @@ -259,10 +259,10 @@ void DreamBase::loadIntroRoom() { workToScreen(); } -void DreamBase::set16ColPalette() { +void DreamWebEngine::set16ColPalette() { } -void DreamBase::realCredits() { +void DreamWebEngine::realCredits() { _roomsSample = 33; loadRoomsSample(); _volume = 0; @@ -419,4 +419,4 @@ void DreamBase::realCredits() { _lastHardKey = 0; } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/use.cpp b/engines/dreamweb/use.cpp index ebebc45ad5..6ab8422075 100644 --- a/engines/dreamweb/use.cpp +++ b/engines/dreamweb/use.cpp @@ -22,10 +22,10 @@ #include "dreamweb/dreamweb.h" -namespace DreamGen { +namespace DreamWeb { -typedef void (DreamBase::*UseCallback)(void); +typedef void (DreamWebEngine::*UseCallback)(void); // Note: The callback pointer has been placed before the // ID to keep MSVC happy (otherwise, it throws warnings @@ -35,90 +35,90 @@ struct UseListEntry { const char *id; }; -void DreamBase::useRoutine() { +void DreamWebEngine::useRoutine() { static const UseListEntry kUseList[] = { - { &DreamBase::useMon, "NETW" }, - { &DreamBase::useElevator1, "ELVA" }, - { &DreamBase::useElevator2, "ELVB" }, - { &DreamBase::useElevator3, "ELVC" }, - { &DreamBase::useElevator4, "ELVE" }, - { &DreamBase::useElevator5, "ELVF" }, - { &DreamBase::useChurchGate, "CGAT" }, - { &DreamBase::useStereo, "REMO" }, - { &DreamBase::useButtonA, "BUTA" }, - { &DreamBase::useWinch, "CBOX" }, - { &DreamBase::useLighter, "LITE" }, - { &DreamBase::usePlate, "PLAT" }, - { &DreamBase::useControl, "LIFT" }, - { &DreamBase::useWire, "WIRE" }, - { &DreamBase::useHandle, "HNDL" }, - { &DreamBase::useHatch, "HACH" }, - { &DreamBase::useElvDoor, "DOOR" }, - { &DreamBase::useCashCard, "CSHR" }, - { &DreamBase::useGun, "GUNA" }, - { &DreamBase::useCardReader1, "CRAA" }, - { &DreamBase::useCardReader2, "CRBB" }, - { &DreamBase::useCardReader3, "CRCC" }, - { &DreamBase::sitDownInBar, "SEAT" }, - { &DreamBase::useMenu, "MENU" }, - { &DreamBase::useCooker, "COOK" }, - { &DreamBase::callHotelLift, "ELCA" }, - { &DreamBase::callEdensLift, "EDCA" }, - { &DreamBase::callEdensDLift, "DDCA" }, - { &DreamBase::useAltar, "ALTR" }, - { &DreamBase::openHotelDoor, "LOKA" }, - { &DreamBase::openHotelDoor2, "LOKB" }, - { &DreamBase::openLouis, "ENTA" }, - { &DreamBase::openRyan, "ENTB" }, - { &DreamBase::openPoolBoss, "ENTE" }, - { &DreamBase::openYourNeighbour, "ENTC" }, - { &DreamBase::openEden, "ENTD" }, - { &DreamBase::openSarters, "ENTH" }, - { &DreamBase::wearWatch, "WWAT" }, - { &DreamBase::usePoolReader, "POOL" }, - { &DreamBase::wearShades, "WSHD" }, - { &DreamBase::grafittiDoor, "GRAF" }, - { &DreamBase::trapDoor, "TRAP" }, - { &DreamBase::edensCDPlayer, "CDPE" }, - { &DreamBase::openTVDoor, "DLOK" }, - { &DreamBase::useHole, "HOLE" }, - { &DreamBase::useDryer, "DRYR" }, - { &DreamBase::useChurchHole, "HOLY" }, - { &DreamBase::useWall, "WALL" }, - { &DreamBase::useDiary, "BOOK" }, - { &DreamBase::useAxe, "AXED" }, - { &DreamBase::useShield, "SHLD" }, - { &DreamBase::useRailing, "BCNY" }, - { &DreamBase::useCoveredBox, "LIDC" }, - { &DreamBase::useClearBox, "LIDU" }, - { &DreamBase::useOpenBox, "LIDO" }, - { &DreamBase::usePipe, "PIPE" }, - { &DreamBase::useBalcony, "BALC" }, - { &DreamBase::useWindow, "WIND" }, - { &DreamBase::viewFolder, "PAPR" }, - { &DreamBase::useTrainer, "UWTA" }, - { &DreamBase::useTrainer, "UWTB" }, - { &DreamBase::enterSymbol, "STAT" }, - { &DreamBase::openTomb, "TLID" }, - { &DreamBase::useSlab, "SLAB" }, - { &DreamBase::useCart, "CART" }, - { &DreamBase::useFullCart, "FCAR" }, - { &DreamBase::slabDoorA, "SLBA" }, - { &DreamBase::slabDoorB, "SLBB" }, - { &DreamBase::slabDoorC, "SLBC" }, - { &DreamBase::slabDoorD, "SLBD" }, - { &DreamBase::slabDoorE, "SLBE" }, - { &DreamBase::slabDoorF, "SLBF" }, - { &DreamBase::usePlinth, "PLIN" }, - { &DreamBase::useLadder, "LADD" }, - { &DreamBase::useLadderB, "LADB" }, - { &DreamBase::chewy, "GUMA" }, - { &DreamBase::wheelSound, "SQEE" }, - { &DreamBase::runTap, "TAPP" }, - { &DreamBase::playGuitar, "GUIT" }, - { &DreamBase::hotelControl, "CONT" }, - { &DreamBase::hotelBell, "BELL" }, + { &DreamWebEngine::useMon, "NETW" }, + { &DreamWebEngine::useElevator1, "ELVA" }, + { &DreamWebEngine::useElevator2, "ELVB" }, + { &DreamWebEngine::useElevator3, "ELVC" }, + { &DreamWebEngine::useElevator4, "ELVE" }, + { &DreamWebEngine::useElevator5, "ELVF" }, + { &DreamWebEngine::useChurchGate, "CGAT" }, + { &DreamWebEngine::useStereo, "REMO" }, + { &DreamWebEngine::useButtonA, "BUTA" }, + { &DreamWebEngine::useWinch, "CBOX" }, + { &DreamWebEngine::useLighter, "LITE" }, + { &DreamWebEngine::usePlate, "PLAT" }, + { &DreamWebEngine::useControl, "LIFT" }, + { &DreamWebEngine::useWire, "WIRE" }, + { &DreamWebEngine::useHandle, "HNDL" }, + { &DreamWebEngine::useHatch, "HACH" }, + { &DreamWebEngine::useElvDoor, "DOOR" }, + { &DreamWebEngine::useCashCard, "CSHR" }, + { &DreamWebEngine::useGun, "GUNA" }, + { &DreamWebEngine::useCardReader1, "CRAA" }, + { &DreamWebEngine::useCardReader2, "CRBB" }, + { &DreamWebEngine::useCardReader3, "CRCC" }, + { &DreamWebEngine::sitDownInBar, "SEAT" }, + { &DreamWebEngine::useMenu, "MENU" }, + { &DreamWebEngine::useCooker, "COOK" }, + { &DreamWebEngine::callHotelLift, "ELCA" }, + { &DreamWebEngine::callEdensLift, "EDCA" }, + { &DreamWebEngine::callEdensDLift, "DDCA" }, + { &DreamWebEngine::useAltar, "ALTR" }, + { &DreamWebEngine::openHotelDoor, "LOKA" }, + { &DreamWebEngine::openHotelDoor2, "LOKB" }, + { &DreamWebEngine::openLouis, "ENTA" }, + { &DreamWebEngine::openRyan, "ENTB" }, + { &DreamWebEngine::openPoolBoss, "ENTE" }, + { &DreamWebEngine::openYourNeighbour, "ENTC" }, + { &DreamWebEngine::openEden, "ENTD" }, + { &DreamWebEngine::openSarters, "ENTH" }, + { &DreamWebEngine::wearWatch, "WWAT" }, + { &DreamWebEngine::usePoolReader, "POOL" }, + { &DreamWebEngine::wearShades, "WSHD" }, + { &DreamWebEngine::grafittiDoor, "GRAF" }, + { &DreamWebEngine::trapDoor, "TRAP" }, + { &DreamWebEngine::edensCDPlayer, "CDPE" }, + { &DreamWebEngine::openTVDoor, "DLOK" }, + { &DreamWebEngine::useHole, "HOLE" }, + { &DreamWebEngine::useDryer, "DRYR" }, + { &DreamWebEngine::useChurchHole, "HOLY" }, + { &DreamWebEngine::useWall, "WALL" }, + { &DreamWebEngine::useDiary, "BOOK" }, + { &DreamWebEngine::useAxe, "AXED" }, + { &DreamWebEngine::useShield, "SHLD" }, + { &DreamWebEngine::useRailing, "BCNY" }, + { &DreamWebEngine::useCoveredBox, "LIDC" }, + { &DreamWebEngine::useClearBox, "LIDU" }, + { &DreamWebEngine::useOpenBox, "LIDO" }, + { &DreamWebEngine::usePipe, "PIPE" }, + { &DreamWebEngine::useBalcony, "BALC" }, + { &DreamWebEngine::useWindow, "WIND" }, + { &DreamWebEngine::viewFolder, "PAPR" }, + { &DreamWebEngine::useTrainer, "UWTA" }, + { &DreamWebEngine::useTrainer, "UWTB" }, + { &DreamWebEngine::enterSymbol, "STAT" }, + { &DreamWebEngine::openTomb, "TLID" }, + { &DreamWebEngine::useSlab, "SLAB" }, + { &DreamWebEngine::useCart, "CART" }, + { &DreamWebEngine::useFullCart, "FCAR" }, + { &DreamWebEngine::slabDoorA, "SLBA" }, + { &DreamWebEngine::slabDoorB, "SLBB" }, + { &DreamWebEngine::slabDoorC, "SLBC" }, + { &DreamWebEngine::slabDoorD, "SLBD" }, + { &DreamWebEngine::slabDoorE, "SLBE" }, + { &DreamWebEngine::slabDoorF, "SLBF" }, + { &DreamWebEngine::usePlinth, "PLIN" }, + { &DreamWebEngine::useLadder, "LADD" }, + { &DreamWebEngine::useLadderB, "LADB" }, + { &DreamWebEngine::chewy, "GUMA" }, + { &DreamWebEngine::wheelSound, "SQEE" }, + { &DreamWebEngine::runTap, "TAPP" }, + { &DreamWebEngine::playGuitar, "GUIT" }, + { &DreamWebEngine::hotelControl, "CONT" }, + { &DreamWebEngine::hotelBell, "BELL" }, }; if (_realLocation >= 50) { @@ -163,7 +163,7 @@ void DreamBase::useRoutine() { _commandType = 255; } -void DreamBase::useText(const uint8 *string) { +void DreamWebEngine::useText(const uint8 *string) { createPanel(); showPanel(); showMan(); @@ -173,7 +173,7 @@ void DreamBase::useText(const uint8 *string) { workToScreenM(); } -void DreamBase::showFirstUse() { +void DreamWebEngine::showFirstUse() { const uint8 *obText = getObTextStart(); findNextColon(&obText); findNextColon(&obText); @@ -181,7 +181,7 @@ void DreamBase::showFirstUse() { hangOnP(400); } -void DreamBase::showSecondUse() { +void DreamWebEngine::showSecondUse() { const uint8 *obText = getObTextStart(); findNextColon(&obText); findNextColon(&obText); @@ -190,7 +190,7 @@ void DreamBase::showSecondUse() { hangOnP(400); } -void DreamBase::viewFolder() { +void DreamWebEngine::viewFolder() { _manIsOffScreen = 1; getRidOfAll(); loadFolder(); @@ -219,7 +219,7 @@ void DreamBase::viewFolder() { workToScreenM(); } -void DreamBase::edensCDPlayer() { +void DreamWebEngine::edensCDPlayer() { showFirstUse(); _vars._watchingTime = 18 * 2; _vars._reelToWatch = 25; @@ -229,25 +229,25 @@ void DreamBase::edensCDPlayer() { _getBack = 1; } -void DreamBase::hotelBell() { +void DreamWebEngine::hotelBell() { playChannel1(12); showFirstUse(); putBackObStuff(); } -void DreamBase::playGuitar() { +void DreamWebEngine::playGuitar() { playChannel1(14); showFirstUse(); putBackObStuff(); } -void DreamBase::useElevator1() { +void DreamWebEngine::useElevator1() { showFirstUse(); selectLocation(); _getBack = 1; } -void DreamBase::useElevator2() { +void DreamWebEngine::useElevator2() { showFirstUse(); if (_vars._location == 23) // In pool hall @@ -261,7 +261,7 @@ void DreamBase::useElevator2() { _getBack = 1; } -void DreamBase::useElevator3() { +void DreamWebEngine::useElevator3() { showFirstUse(); _vars._countToClose = 20; _newLocation = 34; @@ -273,7 +273,7 @@ void DreamBase::useElevator3() { _getBack = 1; } -void DreamBase::useElevator4() { +void DreamWebEngine::useElevator4() { showFirstUse(); _vars._reelToWatch = 0; _vars._endWatchReel = 11; @@ -285,7 +285,7 @@ void DreamBase::useElevator4() { _newLocation = 24; } -void DreamBase::useElevator5() { +void DreamWebEngine::useElevator5() { placeSetObject(4); removeSetObject(0); _newLocation = 20; @@ -295,19 +295,19 @@ void DreamBase::useElevator5() { _getBack = 1; } -void DreamBase::useHatch() { +void DreamWebEngine::useHatch() { showFirstUse(); _newLocation = 40; _getBack = 1; } -void DreamBase::wheelSound() { +void DreamWebEngine::wheelSound() { playChannel1(17); showFirstUse(); putBackObStuff(); } -void DreamBase::callHotelLift() { +void DreamWebEngine::callHotelLift() { playChannel1(12); showFirstUse(); _vars._countToOpen = 8; @@ -318,7 +318,7 @@ void DreamBase::callHotelLift() { turnPathOn(4); } -void DreamBase::useShield() { +void DreamWebEngine::useShield() { if (_realLocation != 20 || _vars._combatCount == 0) { // Not in Sart room showFirstUse(); @@ -332,7 +332,7 @@ void DreamBase::useShield() { } } -void DreamBase::useCoveredBox() { +void DreamWebEngine::useCoveredBox() { _vars._progressPoints++; showFirstUse(); _vars._watchingTime = 50; @@ -343,7 +343,7 @@ void DreamBase::useCoveredBox() { _getBack = 1; } -void DreamBase::useRailing() { +void DreamWebEngine::useRailing() { showFirstUse(); _vars._watchingTime = 80; _vars._reelToWatch = 0; @@ -354,7 +354,7 @@ void DreamBase::useRailing() { _vars._manDead = 4; } -void DreamBase::wearWatch() { +void DreamWebEngine::wearWatch() { if (_vars._watchOn == 1) { // Already wearing watch showSecondUse(); @@ -368,7 +368,7 @@ void DreamBase::wearWatch() { } } -void DreamBase::wearShades() { +void DreamWebEngine::wearShades() { if (_vars._shadesOn == 1) { // Already wearing shades showSecondUse(); @@ -382,7 +382,7 @@ void DreamBase::wearShades() { } } -void DreamBase::useChurchHole() { +void DreamWebEngine::useChurchHole() { showFirstUse(); _getBack = 1; _vars._watchingTime = 28; @@ -392,7 +392,7 @@ void DreamBase::useChurchHole() { _vars._speedCount = 1; } -void DreamBase::sitDownInBar() { +void DreamWebEngine::sitDownInBar() { if (_vars._watchMode != 0xFF) { // Sat down showSecondUse(); @@ -410,13 +410,13 @@ void DreamBase::sitDownInBar() { } } -void DreamBase::useDryer() { +void DreamWebEngine::useDryer() { playChannel1(12); showFirstUse(); _getBack = 1; } -void DreamBase::useBalcony() { +void DreamWebEngine::useBalcony() { showFirstUse(); turnPathOn(6); turnPathOff(0); @@ -440,7 +440,7 @@ void DreamBase::useBalcony() { _getBack = 1; } -void DreamBase::useWindow() { +void DreamWebEngine::useWindow() { if (_mansPath != 6) { // Not on balcony showSecondUse(); @@ -453,7 +453,7 @@ void DreamBase::useWindow() { } } -void DreamBase::trapDoor() { +void DreamWebEngine::trapDoor() { _vars._progressPoints++; showFirstUse(); switchRyanOff(); @@ -466,14 +466,14 @@ void DreamBase::trapDoor() { _getBack = 1; } -void DreamBase::callEdensLift() { +void DreamWebEngine::callEdensLift() { showFirstUse(); _vars._countToOpen = 8; _getBack = 1; turnPathOn(2); } -void DreamBase::callEdensDLift() { +void DreamWebEngine::callEdensDLift() { if (_vars._liftFlag == 1) { // Eden's D here showSecondUse(); @@ -486,38 +486,38 @@ void DreamBase::callEdensDLift() { } } -void DreamBase::openYourNeighbour() { +void DreamWebEngine::openYourNeighbour() { enterCode(255, 255, 255, 255); _getBack = 1; } -void DreamBase::openRyan() { +void DreamWebEngine::openRyan() { enterCode(5, 1, 0, 6); _getBack = 1; } -void DreamBase::openPoolBoss() { +void DreamWebEngine::openPoolBoss() { enterCode(5, 2, 2, 2); _getBack = 1; } -void DreamBase::openEden() { +void DreamWebEngine::openEden() { enterCode(2, 8, 6, 5); _getBack = 1; } -void DreamBase::openSarters() { +void DreamWebEngine::openSarters() { enterCode(7, 8, 3, 3); _getBack = 1; } -void DreamBase::openLouis() { +void DreamWebEngine::openLouis() { enterCode(5, 2, 3, 8); _getBack = 1; } -void DreamBase::useWall() { +void DreamWebEngine::useWall() { showFirstUse(); if (_mansPath != 3) { @@ -560,7 +560,7 @@ void DreamBase::useWall() { } } -void DreamBase::useLadder() { +void DreamWebEngine::useLadder() { showFirstUse(); _mapX = _mapX - 11; findRoomInLoc(); @@ -574,7 +574,7 @@ void DreamBase::useLadder() { _getBack = 1; } -void DreamBase::useLadderB() { +void DreamWebEngine::useLadderB() { showFirstUse(); _mapX = _mapX + 11; findRoomInLoc(); @@ -588,7 +588,7 @@ void DreamBase::useLadderB() { _getBack = 1; } -void DreamBase::slabDoorA() { +void DreamWebEngine::slabDoorA() { showFirstUse(); _getBack = 1; _vars._watchSpeed = 1; @@ -608,7 +608,7 @@ void DreamBase::slabDoorA() { } } -void DreamBase::slabDoorB() { +void DreamWebEngine::slabDoorB() { if (_vars._dreamNumber != 1) { // Wrong showFirstUse(); @@ -640,7 +640,7 @@ void DreamBase::slabDoorB() { } } -void DreamBase::slabDoorC() { +void DreamWebEngine::slabDoorC() { showFirstUse(); _getBack = 1; _vars._watchSpeed = 1; @@ -660,7 +660,7 @@ void DreamBase::slabDoorC() { } } -void DreamBase::slabDoorD() { +void DreamWebEngine::slabDoorD() { showFirstUse(); _getBack = 1; _vars._watchSpeed = 1; @@ -680,7 +680,7 @@ void DreamBase::slabDoorD() { } } -void DreamBase::slabDoorE() { +void DreamWebEngine::slabDoorE() { showFirstUse(); _getBack = 1; _vars._watchSpeed = 1; @@ -700,7 +700,7 @@ void DreamBase::slabDoorE() { } } -void DreamBase::slabDoorF() { +void DreamWebEngine::slabDoorF() { showFirstUse(); _getBack = 1; _vars._watchSpeed = 1; @@ -720,7 +720,7 @@ void DreamBase::slabDoorF() { } } -bool DreamBase::defaultUseHandler(const char *id) { +bool DreamWebEngine::defaultUseHandler(const char *id) { if (_withObject == 255) { withWhat(); return true; // event handled @@ -736,7 +736,7 @@ bool DreamBase::defaultUseHandler(const char *id) { return false; // continue with the original event } -void DreamBase::useChurchGate() { +void DreamWebEngine::useChurchGate() { if (defaultUseHandler("CUTT")) return; @@ -754,7 +754,7 @@ void DreamBase::useChurchGate() { turnPathOn(2); // Open church } -void DreamBase::useGun() { +void DreamWebEngine::useGun() { if (_objectType != kExObjectType) { // gun is not taken @@ -865,7 +865,7 @@ void DreamBase::useGun() { } } -void DreamBase::useFullCart() { +void DreamWebEngine::useFullCart() { _vars._progressPoints++; turnAnyPathOn(2, _roomNum + 6); _mansPath = 4; @@ -883,7 +883,7 @@ void DreamBase::useFullCart() { _getBack = 1; } -void DreamBase::useClearBox() { +void DreamWebEngine::useClearBox() { if (defaultUseHandler("RAIL")) return; @@ -898,7 +898,7 @@ void DreamBase::useClearBox() { _getBack = 1; } -void DreamBase::openTVDoor() { +void DreamWebEngine::openTVDoor() { if (defaultUseHandler("ULOK")) return; @@ -908,7 +908,7 @@ void DreamBase::openTVDoor() { _getBack = 1; } -void DreamBase::usePlate() { +void DreamWebEngine::usePlate() { if (_withObject == 255) { withWhat(); return; @@ -935,7 +935,7 @@ void DreamBase::usePlate() { } } -void DreamBase::usePlinth() { +void DreamWebEngine::usePlinth() { if (_withObject == 255) { withWhat(); return; @@ -958,7 +958,7 @@ void DreamBase::usePlinth() { } } -void DreamBase::useElvDoor() { +void DreamWebEngine::useElvDoor() { if (defaultUseHandler("AXED")) return; @@ -973,7 +973,7 @@ void DreamBase::useElvDoor() { _getBack = 1; } -void DreamBase::useObject() { +void DreamWebEngine::useObject() { _withObject = 255; if (_commandType != 229) { @@ -988,7 +988,7 @@ void DreamBase::useObject() { useRoutine(); } -void DreamBase::useWinch() { +void DreamWebEngine::useWinch() { uint16 contentIndex = checkInside(40, 1); if (contentIndex == kNumexobjects || !compare(contentIndex, kExObjectType, "FUSE")) { // No winch @@ -1012,7 +1012,7 @@ void DreamBase::useWinch() { _vars._progressPoints++; } -void DreamBase::useCart() { +void DreamWebEngine::useCart() { if (defaultUseHandler("ROCK")) return; @@ -1026,7 +1026,7 @@ void DreamBase::useCart() { _getBack = 1; } -void DreamBase::useTrainer() { +void DreamWebEngine::useTrainer() { uint8 dummy; DynObject *object = (DynObject *)getAnyAd(&dummy, &dummy); if (object->mapad[0] != 4) { @@ -1039,7 +1039,7 @@ void DreamBase::useTrainer() { } } -void DreamBase::chewy() { +void DreamWebEngine::chewy() { // Chewing a gum showFirstUse(); uint8 dummy; @@ -1048,7 +1048,7 @@ void DreamBase::chewy() { _getBack = 1; } -void DreamBase::useHole() { +void DreamWebEngine::useHole() { if (defaultUseHandler("HNDA")) return; @@ -1060,7 +1060,7 @@ void DreamBase::useHole() { _getBack = 1; } -void DreamBase::openHotelDoor() { +void DreamWebEngine::openHotelDoor() { if (defaultUseHandler("KEYA")) return; @@ -1070,7 +1070,7 @@ void DreamBase::openHotelDoor() { _getBack = 1; } -void DreamBase::openHotelDoor2() { +void DreamWebEngine::openHotelDoor2() { if (defaultUseHandler("KEYA")) return; @@ -1079,7 +1079,7 @@ void DreamBase::openHotelDoor2() { putBackObStuff(); } -void DreamBase::grafittiDoor() { +void DreamWebEngine::grafittiDoor() { if (defaultUseHandler("APEN")) return; @@ -1087,7 +1087,7 @@ void DreamBase::grafittiDoor() { putBackObStuff(); } -void DreamBase::usePoolReader() { +void DreamWebEngine::usePoolReader() { if (defaultUseHandler("MEMB")) return; @@ -1103,7 +1103,7 @@ void DreamBase::usePoolReader() { } } -void DreamBase::useCardReader1() { +void DreamWebEngine::useCardReader1() { if (defaultUseHandler("CSHR")) return; @@ -1125,7 +1125,7 @@ void DreamBase::useCardReader1() { } } -void DreamBase::useCardReader2() { +void DreamWebEngine::useCardReader2() { if (defaultUseHandler("CSHR")) return; @@ -1152,7 +1152,7 @@ void DreamBase::useCardReader2() { } } -void DreamBase::useCardReader3() { +void DreamWebEngine::useCardReader3() { if (defaultUseHandler("CSHR")) return; @@ -1174,7 +1174,7 @@ void DreamBase::useCardReader3() { } } -void DreamBase::useLighter() { +void DreamWebEngine::useLighter() { if (_withObject == 255) { withWhat(); return; @@ -1191,7 +1191,7 @@ void DreamBase::useLighter() { } } -void DreamBase::useWire() { +void DreamWebEngine::useWire() { if (_withObject == 255) { withWhat(); return; @@ -1216,7 +1216,7 @@ void DreamBase::useWire() { putBackObStuff(); } -void DreamBase::openTomb() { +void DreamWebEngine::openTomb() { _vars._progressPoints++; showFirstUse(); _vars._watchingTime = 35 * 2; @@ -1227,7 +1227,7 @@ void DreamBase::openTomb() { _getBack = 1; } -void DreamBase::hotelControl() { +void DreamWebEngine::hotelControl() { if (_realLocation != 21 || _mapX != 33) showSecondUse(); // Not right control else @@ -1236,7 +1236,7 @@ void DreamBase::hotelControl() { putBackObStuff(); } -void DreamBase::useCooker() { +void DreamWebEngine::useCooker() { if (checkInside(_command, _objectType) == kNumexobjects) showFirstUse(); else @@ -1245,16 +1245,16 @@ void DreamBase::useCooker() { putBackObStuff(); } -void DreamBase::placeFreeObject(uint8 index) { +void DreamWebEngine::placeFreeObject(uint8 index) { findOrMake(index, 0, 1); getFreeAd(index)->mapad[0] = 0; } -void DreamBase::removeFreeObject(uint8 index) { +void DreamWebEngine::removeFreeObject(uint8 index) { getFreeAd(index)->mapad[0] = 0xFF; } -void DreamBase::useDiary() { +void DreamWebEngine::useDiary() { getRidOfReels(); loadIntoTemp("DREAMWEB.G14"); loadTempText("DREAMWEB.T51"); @@ -1270,11 +1270,11 @@ void DreamBase::useDiary() { delPointer(); _getBack = 0; - RectWithCallback diaryList[] = { - { kDiaryx+94,kDiaryx+110,kDiaryy+97,kDiaryy+113,&DreamBase::diaryKeyN }, - { kDiaryx+151,kDiaryx+167,kDiaryy+71,kDiaryy+87,&DreamBase::diaryKeyP }, - { kDiaryx+176,kDiaryx+192,kDiaryy+108,kDiaryy+124,&DreamBase::quitKey }, - { 0,320,0,200,&DreamBase::blank }, + RectWithCallback diaryList[] = { + { kDiaryx+94,kDiaryx+110,kDiaryy+97,kDiaryy+113,&DreamWebEngine::diaryKeyN }, + { kDiaryx+151,kDiaryx+167,kDiaryy+71,kDiaryy+87,&DreamWebEngine::diaryKeyP }, + { kDiaryx+176,kDiaryx+192,kDiaryy+108,kDiaryy+124,&DreamWebEngine::quitKey }, + { 0,320,0,200,&DreamWebEngine::blank }, { 0xFFFF,0,0,0,0 } }; @@ -1300,7 +1300,7 @@ void DreamBase::useDiary() { workToScreenM(); } -void DreamBase::useControl() { +void DreamWebEngine::useControl() { if (_withObject == 255) { withWhat(); return; @@ -1353,7 +1353,7 @@ void DreamBase::useControl() { } } -void DreamBase::useSlab() { +void DreamWebEngine::useSlab() { if (_withObject == 255) { withWhat(); return; @@ -1385,7 +1385,7 @@ void DreamBase::useSlab() { _getBack = 1; } -void DreamBase::usePipe() { +void DreamWebEngine::usePipe() { if (_withObject == 255) { withWhat(); return; @@ -1408,7 +1408,7 @@ void DreamBase::usePipe() { } } -void DreamBase::useOpenBox() { +void DreamWebEngine::useOpenBox() { if (_withObject == 255) { withWhat(); return; @@ -1440,7 +1440,7 @@ void DreamBase::useOpenBox() { showFirstUse(); } -void DreamBase::runTap() { +void DreamWebEngine::runTap() { if (_withObject == 255) { withWhat(); return; @@ -1467,7 +1467,7 @@ void DreamBase::runTap() { putBackObStuff(); } -void DreamBase::useAxe() { +void DreamWebEngine::useAxe() { if (_realLocation != 22) { // Not in pool showFirstUse(); @@ -1494,7 +1494,7 @@ void DreamBase::useAxe() { removeObFromInv(); } -void DreamBase::useHandle() { +void DreamWebEngine::useHandle() { SetObject *object = getSetAd(findSetObject("CUTW")); if (object->mapad[0] == 255) { // Wire not cut @@ -1508,7 +1508,7 @@ void DreamBase::useHandle() { _getBack = 1; } -void DreamBase::useAltar() { +void DreamWebEngine::useAltar() { if (findExObject("CNDA") == 114 || findExObject("CNDB") == 114) { // Things on altar showFirstUse(); @@ -1525,7 +1525,7 @@ void DreamBase::useAltar() { _vars._endWatchReel = 174; _vars._watchSpeed = 1; _vars._speedCount = 1; - DreamBase::setupTimedUse(47, 32, 98, 52, 76); + DreamWebEngine::setupTimedUse(47, 32, 98, 52, 76); _getBack = 1; } else { showPuzText(23, 300); @@ -1533,7 +1533,7 @@ void DreamBase::useAltar() { } } -void DreamBase::withWhat() { +void DreamWebEngine::withWhat() { uint8 commandLine[64] = "OBJECT NAME ONE "; createPanel(); @@ -1556,7 +1556,7 @@ void DreamBase::withWhat() { _invOpen = 2; } -void DreamBase::notHeldError() { +void DreamWebEngine::notHeldError() { createPanel(); showPanel(); showMan(); @@ -1568,7 +1568,7 @@ void DreamBase::notHeldError() { putBackObStuff(); } -void DreamBase::useCashCard() { +void DreamWebEngine::useCashCard() { getRidOfReels(); loadKeypad(); createPanel(); @@ -1597,7 +1597,7 @@ void DreamBase::useCashCard() { putBackObStuff(); } -void DreamBase::useStereo() { +void DreamWebEngine::useStereo() { // Handles the stereo in Ryan's apartment (accessible from the remote on // the couch) @@ -1628,7 +1628,7 @@ void DreamBase::useStereo() { } } -uint16 DreamBase::checkInside(uint16 command, uint16 type) { +uint16 DreamWebEngine::checkInside(uint16 command, uint16 type) { for (uint16 index = 0; index < kNumexobjects; index++) { DynObject *object = getExAd(index); if (object->mapad[1] == command && object->mapad[0] == type) @@ -1638,7 +1638,7 @@ uint16 DreamBase::checkInside(uint16 command, uint16 type) { return kNumexobjects; } -void DreamBase::showPuzText(uint16 command, uint16 count) { +void DreamWebEngine::showPuzText(uint16 command, uint16 count) { createPanel(); showPanel(); showMan(); @@ -1650,7 +1650,7 @@ void DreamBase::showPuzText(uint16 command, uint16 count) { hangOnP(count); } -void DreamBase::useButtonA() { +void DreamWebEngine::useButtonA() { if (!isSetObOnMap(95)) { showFirstUse(); turnAnyPathOn(0, _roomNum - 1); @@ -1671,4 +1671,4 @@ void DreamBase::useButtonA() { } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/vgafades.cpp b/engines/dreamweb/vgafades.cpp index 8359518f61..e8999ab18c 100644 --- a/engines/dreamweb/vgafades.cpp +++ b/engines/dreamweb/vgafades.cpp @@ -22,64 +22,64 @@ #include "dreamweb/dreamweb.h" -namespace DreamGen { +namespace DreamWeb { -void DreamBase::clearStartPal() { +void DreamWebEngine::clearStartPal() { memset(_startPal, 0, 256 * 3); } -void DreamBase::clearEndPal() { +void DreamWebEngine::clearEndPal() { memset(_endPal, 0, 256 * 3); } -void DreamBase::palToStartPal() { +void DreamWebEngine::palToStartPal() { memcpy(_startPal, _mainPal, 256 * 3); } -void DreamBase::endPalToStart() { +void DreamWebEngine::endPalToStart() { memcpy(_startPal, _endPal, 256 * 3); } -void DreamBase::startPalToEnd() { +void DreamWebEngine::startPalToEnd() { memcpy(_endPal, _startPal, 256 * 3); } -void DreamBase::palToEndPal() { +void DreamWebEngine::palToEndPal() { memcpy(_endPal, _mainPal, 256 * 3); } -void DreamBase::fadeDOS() { +void DreamWebEngine::fadeDOS() { return; // FIXME later - engine->waitForVSync(); + waitForVSync(); //processEvents will be called from vsync uint8 *dst = _startPal; - engine->getPalette(dst, 0, 64); + getPalette(dst, 0, 64); for (int fade = 0; fade < 64; ++fade) { for (int c = 0; c < 768; ++c) { //original sources decrement 768 values -> 256 colors if (dst[c]) { --dst[c]; } } - engine->setPalette(dst, 0, 64); - engine->waitForVSync(); + setPalette(dst, 0, 64); + waitForVSync(); } } -void DreamBase::doFade() { +void DreamWebEngine::doFade() { if (_fadeDirection == 0) return; - engine->processEvents(); + processEvents(); uint8 *src = _startPal + 3 * _colourPos; - engine->setPalette(src, _colourPos, _numToFade); + setPalette(src, _colourPos, _numToFade); _colourPos += _numToFade; if (_colourPos == 0) fadeCalculation(); } -void DreamBase::fadeCalculation() { +void DreamWebEngine::fadeCalculation() { if (_fadeCount == 0) { _fadeDirection = 0; return; @@ -102,7 +102,7 @@ void DreamBase::fadeCalculation() { --_fadeCount; } -void DreamBase::fadeUpYellows() { +void DreamWebEngine::fadeUpYellows() { palToEndPal(); memset(_endPal + 231 * 3, 0, 8 * 3); memset(_endPal + 246 * 3, 0, 1 * 3); @@ -113,7 +113,7 @@ void DreamBase::fadeUpYellows() { hangOn(128); } -void DreamBase::fadeUpMonFirst() { +void DreamWebEngine::fadeUpMonFirst() { palToStartPal(); palToEndPal(); memset(_startPal + 231 * 3, 0, 8 * 3); @@ -128,7 +128,7 @@ void DreamBase::fadeUpMonFirst() { } -void DreamBase::fadeDownMon() { +void DreamWebEngine::fadeDownMon() { palToStartPal(); palToEndPal(); memset(_endPal + 231 * 3, 0, 8 * 3); @@ -140,7 +140,7 @@ void DreamBase::fadeDownMon() { hangOn(64); } -void DreamBase::fadeUpMon() { +void DreamWebEngine::fadeUpMon() { palToStartPal(); palToEndPal(); memset(_startPal + 231 * 3, 0, 8 * 3); @@ -152,15 +152,15 @@ void DreamBase::fadeUpMon() { hangOn(128); } -void DreamBase::initialMonCols() { +void DreamWebEngine::initialMonCols() { palToStartPal(); memset(_startPal + 230 * 3, 0, 9 * 3); memset(_startPal + 246 * 3, 0, 1 * 3); - engine->processEvents(); - engine->setPalette(_startPal + 230 * 3, 230, 18); + processEvents(); + setPalette(_startPal + 230 * 3, 230, 18); } -void DreamBase::fadeScreenUp() { +void DreamWebEngine::fadeScreenUp() { clearStartPal(); palToEndPal(); _fadeDirection = 1; @@ -169,7 +169,7 @@ void DreamBase::fadeScreenUp() { _numToFade = 128; } -void DreamBase::fadeScreenUps() { +void DreamWebEngine::fadeScreenUps() { clearStartPal(); palToEndPal(); _fadeDirection = 1; @@ -178,7 +178,7 @@ void DreamBase::fadeScreenUps() { _numToFade = 64; } -void DreamBase::fadeScreenUpHalf() { +void DreamWebEngine::fadeScreenUpHalf() { endPalToStart(); palToEndPal(); _fadeDirection = 1; @@ -187,7 +187,7 @@ void DreamBase::fadeScreenUpHalf() { _numToFade = 32; } -void DreamBase::fadeScreenDown() { +void DreamWebEngine::fadeScreenDown() { palToStartPal(); clearEndPal(); _fadeDirection = 1; @@ -196,7 +196,7 @@ void DreamBase::fadeScreenDown() { _numToFade = 128; } -void DreamBase::fadeScreenDowns() { +void DreamWebEngine::fadeScreenDowns() { palToStartPal(); clearEndPal(); _fadeDirection = 1; @@ -205,7 +205,7 @@ void DreamBase::fadeScreenDowns() { _numToFade = 64; } -void DreamBase::fadeScreenDownHalf() { +void DreamWebEngine::fadeScreenDownHalf() { palToStartPal(); palToEndPal(); @@ -226,7 +226,7 @@ void DreamBase::fadeScreenDownHalf() { } -void DreamBase::clearPalette() { +void DreamWebEngine::clearPalette() { _fadeDirection = 0; clearStartPal(); dumpCurrent(); @@ -234,7 +234,7 @@ void DreamBase::clearPalette() { // Converts palette to grey scale, summed using formula // .20xred + .59xGreen + .11xBlue -void DreamBase::greyscaleSum() { +void DreamWebEngine::greyscaleSum() { byte *src = _mainPal; byte *dst = _endPal; @@ -262,23 +262,23 @@ void DreamBase::greyscaleSum() { } } -void DreamBase::allPalette() { +void DreamWebEngine::allPalette() { memcpy(_startPal, _mainPal, 3 * 256); dumpCurrent(); } -void DreamBase::dumpCurrent() { +void DreamWebEngine::dumpCurrent() { uint8 *pal = _startPal; - engine->waitForVSync(); - engine->processEvents(); - engine->setPalette(pal, 0, 128); + waitForVSync(); + processEvents(); + setPalette(pal, 0, 128); pal += 128 * 3; - engine->waitForVSync(); - engine->processEvents(); - engine->setPalette(pal, 128, 128); + waitForVSync(); + processEvents(); + setPalette(pal, 128, 128); } -} // End of namespace DreamGen +} // End of namespace DreamWeb diff --git a/engines/dreamweb/vgagrafx.cpp b/engines/dreamweb/vgagrafx.cpp index c1a860e184..1e93c0f2fe 100644 --- a/engines/dreamweb/vgagrafx.cpp +++ b/engines/dreamweb/vgagrafx.cpp @@ -24,12 +24,12 @@ #include "engines/util.h" #include "graphics/surface.h" -namespace DreamGen { +namespace DreamWeb { const uint16 kZoomx = 8; const uint16 kZoomy = 132; -void DreamBase::multiGet(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) { +void DreamWebEngine::multiGet(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) { assert(x < 320); assert(y < 200); const uint8 *src = workspace() + x + y * kScreenwidth; @@ -45,7 +45,7 @@ void DreamBase::multiGet(uint8 *dst, uint16 x, uint16 y, uint8 w, uint8 h) { } } -void DreamBase::multiPut(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h) { +void DreamWebEngine::multiPut(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h) { assert(x < 320); assert(y < 200); uint8 *dst = workspace() + x + y * kScreenwidth; @@ -61,25 +61,21 @@ void DreamBase::multiPut(const uint8 *src, uint16 x, uint16 y, uint8 w, uint8 h) } } -void DreamBase::multiDump(uint16 x, uint16 y, uint8 width, uint8 height) { +void DreamWebEngine::multiDump(uint16 x, uint16 y, uint8 width, uint8 height) { unsigned offset = x + y * kScreenwidth; //debug(1, "multiDump %ux%u(segment: %04x) -> %d,%d(address: %d)", w, h, (uint16)ds, x, y, offset); - engine->blit(workspace() + offset, kScreenwidth, x, y, width, height); + blit(workspace() + offset, kScreenwidth, x, y, width, height); } -void DreamBase::workToScreen() { - engine->blit(workspace(), 320, 0, 0, 320, 200); +void DreamWebEngine::workToScreen() { + blit(workspace(), 320, 0, 0, 320, 200); } -void DreamBase::printUnderMon() { - engine->printUnderMonitor(); +void DreamWebEngine::printUnderMon() { + printUnderMonitor(); } -void DreamBase::cls() { - engine->cls(); -} - -void DreamBase::frameOutNm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) { +void DreamWebEngine::frameOutNm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) { dst += pitch * y + x; for (uint16 j = 0; j < height; ++j) { @@ -89,7 +85,7 @@ void DreamBase::frameOutNm(uint8 *dst, const uint8 *src, uint16 pitch, uint16 wi } } -void DreamBase::frameOutBh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) { +void DreamWebEngine::frameOutBh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) { uint16 stride = pitch - width; dst += y * pitch + x; @@ -105,7 +101,7 @@ void DreamBase::frameOutBh(uint8 *dst, const uint8 *src, uint16 pitch, uint16 wi } } -void DreamBase::frameOutFx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) { +void DreamWebEngine::frameOutFx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, uint16 x, uint16 y) { uint16 stride = pitch - width; dst += y * pitch + x; dst -= width; @@ -122,7 +118,7 @@ void DreamBase::frameOutFx(uint8 *dst, const uint8 *src, uint16 pitch, uint16 wi } } -void DreamBase::doShake() { +void DreamWebEngine::doShake() { uint8 &counter = _vars._shakeCounter; if (counter == 48) return; @@ -149,19 +145,19 @@ void DreamBase::doShake() { }; assert(counter < ARRAYSIZE(shakeTable)); int offset = shakeTable[counter]; - engine->setShakePos(offset >= 0 ? offset : -offset); + setShakePos(offset >= 0 ? offset : -offset); } -void DreamBase::vSync() { - engine->waitForVSync(); +void DreamWebEngine::vSync() { + waitForVSync(); } -void DreamBase::setMode() { - engine->waitForVSync(); +void DreamWebEngine::setMode() { + waitForVSync(); initGraphics(320, 200, false); } -void DreamBase::showPCX(const Common::String &name) { +void DreamWebEngine::showPCX(const Common::String &name) { Common::File pcxFile; if (!pcxFile.open(name)) { @@ -229,7 +225,7 @@ void DreamBase::showPCX(const Common::String &name) { pcxFile.close(); } -void DreamBase::frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y) { +void DreamWebEngine::frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 width, uint16 height, int16 x, int16 y) { // NB : These resilience checks were not in the original engine, but did they result in undefined behaviour // or was something broken during porting to C++? assert(pitch == 320); @@ -271,19 +267,19 @@ void DreamBase::frameOutV(uint8 *dst, const uint8 *src, uint16 pitch, uint16 wid } } -void DreamBase::showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag) { +void DreamWebEngine::showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag) { uint8 width, height; showFrame(frameData, x, y, frameNumber, effectsFlag, &width, &height); } -void DreamBase::showFrameInternal(const uint8 *pSrc, uint16 x, uint16 y, uint8 effectsFlag, uint8 width, uint8 height) { +void DreamWebEngine::showFrameInternal(const uint8 *pSrc, uint16 x, uint16 y, uint8 effectsFlag, uint8 width, uint8 height) { if (effectsFlag) { if (effectsFlag & 128) { //centred x -= width / 2; y -= height / 2; } if (effectsFlag & 64) { // diffDest - error("Unsupported DreamBase::showFrame effectsFlag %d", effectsFlag); + error("Unsupported DreamWebEngine::showFrame effectsFlag %d", effectsFlag); /* frameOutFx(es.ptr(0, dx * *height), pSrc, dx, *width, *height, x, y); return; @@ -309,7 +305,7 @@ void DreamBase::showFrameInternal(const uint8 *pSrc, uint16 x, uint16 y, uint8 e frameOutV(workspace(), pSrc, 320, width, height, x, y); } -void DreamBase::showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) { +void DreamWebEngine::showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uint16 frameNumber, uint8 effectsFlag, uint8 *width, uint8 *height) { const Frame *frame = &frameData._frames[frameNumber]; if ((frame->width == 0) && (frame->height == 0)) { *width = 0; @@ -331,16 +327,16 @@ void DreamBase::showFrame(const GraphicsFile &frameData, uint16 x, uint16 y, uin showFrameInternal(pSrc, x, y, effectsFlag, *width, *height); } -void DreamBase::clearWork() { +void DreamWebEngine::clearWork() { memset(workspace(), 0, 320*200); } -void DreamBase::dumpZoom() { +void DreamWebEngine::dumpZoom() { if (_vars._zoomOn == 1) multiDump(kZoomx + 5, kZoomy + 4, 46, 40); } -void DreamBase::crosshair() { +void DreamWebEngine::crosshair() { uint8 frame; if ((_commandType != 3) && (_commandType < 10)) { frame = 9; @@ -350,21 +346,21 @@ void DreamBase::crosshair() { showFrame(_icons1, kZoomx + 24, kZoomy + 19, frame, 0); } -void DreamBase::getUnderZoom() { +void DreamWebEngine::getUnderZoom() { multiGet(_zoomSpace, kZoomx + 5, kZoomy + 4, 46, 40); } -void DreamBase::putUnderZoom() { +void DreamWebEngine::putUnderZoom() { multiPut(_zoomSpace, kZoomx + 5, kZoomy + 4, 46, 40); } -void DreamBase::zoomIcon() { +void DreamWebEngine::zoomIcon() { if (_vars._zoomOn == 0) return; showFrame(_icons1, kZoomx, kZoomy-1, 8, 0); } -void DreamBase::zoom() { +void DreamWebEngine::zoom() { if (_vars._watchingTime != 0) return; if (_vars._zoomOn != 1) @@ -392,19 +388,19 @@ void DreamBase::zoom() { _didZoom = 1; } -void DreamBase::panelToMap() { +void DreamWebEngine::panelToMap() { multiGet(_mapStore, _mapXStart + _mapAdX, _mapYStart + _mapAdY, _mapXSize, _mapYSize); } -void DreamBase::mapToPanel() { +void DreamWebEngine::mapToPanel() { multiPut(_mapStore, _mapXStart + _mapAdX, _mapYStart + _mapAdY, _mapXSize, _mapYSize); } -void DreamBase::dumpMap() { +void DreamWebEngine::dumpMap() { multiDump(_mapXStart + _mapAdX, _mapYStart + _mapAdY, _mapXSize, _mapYSize); } -bool DreamBase::pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y) { +bool DreamWebEngine::pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y) { x -= pos->xMin; y -= pos->yMin; SetObject *setObject = getSetAd(pos->index); @@ -413,7 +409,7 @@ bool DreamBase::pixelCheckSet(const ObjPos *pos, uint8 x, uint8 y) { return *ptr != 0; } -void DreamBase::loadPalFromIFF() { +void DreamWebEngine::loadPalFromIFF() { Common::File palFile; uint8* buf = new uint8[2000]; palFile.open("DREAMWEB.PAL"); @@ -437,25 +433,25 @@ void DreamBase::loadPalFromIFF() { delete[] buf; } -void DreamBase::createPanel() { +void DreamWebEngine::createPanel() { showFrame(_icons2, 0, 8, 0, 2); showFrame(_icons2, 160, 8, 0, 2); showFrame(_icons2, 0, 104, 0, 2); showFrame(_icons2, 160, 104, 0, 2); } -void DreamBase::createPanel2() { +void DreamWebEngine::createPanel2() { createPanel(); showFrame(_icons2, 0, 0, 5, 2); showFrame(_icons2, 160, 0, 5, 2); } -void DreamBase::showPanel() { +void DreamWebEngine::showPanel() { showFrame(_icons1, 72, 0, 19, 0); showFrame(_icons1, 192, 0, 19, 0); } -void DreamBase::transferFrame(uint8 from, uint8 to, uint8 offset) { +void DreamWebEngine::transferFrame(uint8 from, uint8 to, uint8 offset) { const Frame &freeFrame = _freeFrames._frames[3*from + offset]; Frame &exFrame = _exFrames._frames[3*to + offset]; @@ -473,4 +469,4 @@ void DreamBase::transferFrame(uint8 from, uint8 to, uint8 offset) { _vars._exFramePos += byteCount; } -} // End of namespace DreamGen +} // End of namespace DreamWeb -- cgit v1.2.3