From c846231af3ccf9a910c5cfd5276a38a2244e325d Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Sat, 12 Feb 2011 16:20:57 +0000 Subject: HUGO: Replace Common::File by Common::ReadStream in several functions svn-id: r55897 --- engines/hugo/display.cpp | 6 +++--- engines/hugo/display.h | 8 ++++---- engines/hugo/file.cpp | 2 +- engines/hugo/file.h | 2 +- engines/hugo/hugo.cpp | 2 +- engines/hugo/hugo.h | 2 +- engines/hugo/menu.cpp | 2 +- engines/hugo/menu.h | 2 +- engines/hugo/object.cpp | 4 ++-- engines/hugo/object.h | 4 ++-- engines/hugo/schedule.cpp | 8 ++++---- engines/hugo/schedule.h | 8 ++++---- engines/hugo/sound.cpp | 2 +- engines/hugo/sound.h | 2 +- engines/hugo/text.cpp | 8 ++++---- engines/hugo/text.h | 8 ++++---- 16 files changed, 35 insertions(+), 35 deletions(-) diff --git a/engines/hugo/display.cpp b/engines/hugo/display.cpp index d2ceea8fc8..37b3e6e97b 100644 --- a/engines/hugo/display.cpp +++ b/engines/hugo/display.cpp @@ -574,7 +574,7 @@ void Screen::initNewScreenDisplay() { /** * Load palette from Hugo.dat */ -void Screen::loadPalette(Common::File &in) { +void Screen::loadPalette(Common::ReadStream &in) { // Read palette _paletteSize = in.readUint16BE(); _mainPalette = (byte *)malloc(sizeof(byte) * _paletteSize); @@ -733,7 +733,7 @@ void Screen_v1d::loadFont(const int16 fontId) { * These fonts are a workaround to avoid handling TTF fonts used by DOS versions * TODO: Get rid of this function when the win1 fonts are supported */ -void Screen_v1d::loadFontArr(Common::File &in) { +void Screen_v1d::loadFontArr(Common::ReadStream &in) { for (int i = 0; i < kNumFonts; i++) { _arrayFontSize[i] = in.readUint16BE(); _arrayFont[i] = (byte *)malloc(sizeof(byte) * _arrayFontSize[i]); @@ -785,7 +785,7 @@ void Screen_v1w::loadFont(const int16 fontId) { /** * Skips the fonts used by the DOS versions */ -void Screen_v1w::loadFontArr(Common::File &in) { +void Screen_v1w::loadFontArr(Common::ReadStream &in) { for (int i = 0; i < kNumFonts; i++) { uint16 numElem = in.readUint16BE(); for (int j = 0; j < numElem; j++) diff --git a/engines/hugo/display.h b/engines/hugo/display.h index ff49661536..575d47c37b 100644 --- a/engines/hugo/display.h +++ b/engines/hugo/display.h @@ -52,7 +52,7 @@ public: virtual ~Screen(); virtual void loadFont(int16 fontId) = 0; - virtual void loadFontArr(Common::File &in) = 0; + virtual void loadFontArr(Common::ReadStream &in) = 0; int16 fontHeight() const; int16 stringLength(const char *s) const; @@ -70,7 +70,7 @@ public: void hideCursor(); void initDisplay(); void initNewScreenDisplay(); - void loadPalette(Common::File &in); + void loadPalette(Common::ReadStream &in); void moveImage(image_pt srcImage, const int16 x1, const int16 y1, const int16 dx, int16 dy, const int16 width1, image_pt dstImage, const int16 x2, const int16 y2, const int16 width2); void remapPal(uint16 oldIndex, uint16 newIndex); void resetInventoryObjId(); @@ -165,7 +165,7 @@ public: ~Screen_v1d(); void loadFont(int16 fontId); - void loadFontArr(Common::File &in); + void loadFontArr(Common::ReadStream &in); }; class Screen_v1w : public Screen { @@ -174,7 +174,7 @@ public: ~Screen_v1w(); void loadFont(int16 fontId); - void loadFontArr(Common::File &in); + void loadFontArr(Common::ReadStream &in); }; } // End of namespace Hugo diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 5535f24bac..7427771906 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -78,7 +78,7 @@ byte *FileManager::convertPCC(byte *p, const uint16 y, const uint16 bpl, image_p * allocate space if NULL. Name used for errors. Returns address of seq_p * Set first TRUE to initialize b_index (i.e. not reading a sequential image in file). */ -seq_t *FileManager::readPCX(Common::File &f, seq_t *seqPtr, byte *imagePtr, const bool firstFl, const char *name) { +seq_t *FileManager::readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr, const bool firstFl, const char *name) { debugC(1, kDebugFile, "readPCX(..., %s)", name); // Read in the PCC header and check consistency diff --git a/engines/hugo/file.h b/engines/hugo/file.h index 99bb2afc83..f62c78e580 100644 --- a/engines/hugo/file.h +++ b/engines/hugo/file.h @@ -112,7 +112,7 @@ protected: PCC_header_t PCC_header; - seq_t *readPCX(Common::File &f, seq_t *seqPtr, byte *imagePtr, const bool firstFl, const char *name); + seq_t *readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr, const bool firstFl, const char *name); const char *getBootCypher() const; // If this is the first call, read the lookup table diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index c8fb8282f8..2c6c675f2f 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -689,7 +689,7 @@ bool HugoEngine::loadHugoDat() { return true; } -uint16 **HugoEngine::loadLongArray(Common::File &in) { +uint16 **HugoEngine::loadLongArray(Common::ReadStream &in) { uint16 **resArray = 0; for (int varnt = 0; varnt < _numVariant; varnt++) { diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h index 47cb6cbe06..720e97e7bd 100644 --- a/engines/hugo/hugo.h +++ b/engines/hugo/hugo.h @@ -385,7 +385,7 @@ private: int _score; // Holds current score int _maxscore; // Holds maximum score - uint16 **loadLongArray(Common::File &in); + uint16 **loadLongArray(Common::ReadStream &in); void initPlaylist(bool playlist[kMaxTunes]); void initConfig(); diff --git a/engines/hugo/menu.cpp b/engines/hugo/menu.cpp index ae6c1f81a5..065d68bdc5 100644 --- a/engines/hugo/menu.cpp +++ b/engines/hugo/menu.cpp @@ -121,7 +121,7 @@ void TopMenu::reflowLayout() { _inventButton->setGfx(arrayBmp[4 * kMenuInventory + scale - 1]); } -void TopMenu::loadBmpArr(Common::File &in) { +void TopMenu::loadBmpArr(Common::SeekableReadStream &in) { arraySize = in.readUint16BE(); delete arrayBmp; diff --git a/engines/hugo/menu.h b/engines/hugo/menu.h index 14139ee755..6e2a9063bc 100644 --- a/engines/hugo/menu.h +++ b/engines/hugo/menu.h @@ -74,7 +74,7 @@ public: void handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data); void handleMouseUp(int x, int y, int button, int clickCount); - void loadBmpArr(Common::File &in); + void loadBmpArr(Common::SeekableReadStream &in); protected: void init(); diff --git a/engines/hugo/object.cpp b/engines/hugo/object.cpp index 263b1d98c8..1fa5293992 100644 --- a/engines/hugo/object.cpp +++ b/engines/hugo/object.cpp @@ -369,7 +369,7 @@ void ObjectHandler::freeObjectArr() { /** * Load ObjectArr from Hugo.dat */ -void ObjectHandler::loadObjectArr(Common::File &in) { +void ObjectHandler::loadObjectArr(Common::ReadStream &in) { debugC(6, kDebugObject, "loadObject(&in)"); for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { @@ -487,7 +487,7 @@ void ObjectHandler::setCarriedScreen(int screenNum) { /** * Load _numObj from Hugo.dat */ -void ObjectHandler::loadNumObj(Common::File &in) { +void ObjectHandler::loadNumObj(Common::ReadStream &in) { int numElem; for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { diff --git a/engines/hugo/object.h b/engines/hugo/object.h index ce94c79103..aa2ed9ba9f 100644 --- a/engines/hugo/object.h +++ b/engines/hugo/object.h @@ -73,9 +73,9 @@ public: int calcMaxScore(); int16 findObject(uint16 x, uint16 y); void freeObjects(); - void loadObjectArr(Common::File &in); + void loadObjectArr(Common::ReadStream &in); void freeObjectArr(); - void loadNumObj(Common::File &in); + void loadNumObj(Common::ReadStream &in); void lookObject(object_t *obj); void readObjectImages(); void restoreAllSeq(); diff --git a/engines/hugo/schedule.cpp b/engines/hugo/schedule.cpp index b31cab6819..b36ce70847 100644 --- a/engines/hugo/schedule.cpp +++ b/engines/hugo/schedule.cpp @@ -233,7 +233,7 @@ void Scheduler::waitForRefresh() { /** * Read kALnewscr used by maze (Hugo 2) */ -void Scheduler::loadAlNewscrIndex(Common::File &in) { +void Scheduler::loadAlNewscrIndex(Common::ReadStream &in) { debugC(6, kDebugSchedule, "loadAlNewscrIndex(&in)"); int numElem; @@ -247,7 +247,7 @@ void Scheduler::loadAlNewscrIndex(Common::File &in) { /** * Load actListArr from Hugo.dat */ -void Scheduler::loadActListArr(Common::File &in) { +void Scheduler::loadActListArr(Common::ReadStream &in) { debugC(6, kDebugSchedule, "loadActListArr(&in)"); int numElem, numSubElem, numSubAct; @@ -910,7 +910,7 @@ void Scheduler::saveEvents(Common::WriteStream *f) { * Restore the action data from file with handle f */ -void Scheduler::restoreActions(Common::SeekableReadStream *f) { +void Scheduler::restoreActions(Common::ReadStream *f) { for (int i = 0; i < _actListArrSize; i++) { @@ -982,7 +982,7 @@ void Scheduler::findAction(act* action, int16* index, int16* subElem) { /** * Restore the event list from file with handle f */ -void Scheduler::restoreEvents(Common::SeekableReadStream *f) { +void Scheduler::restoreEvents(Common::ReadStream *f) { debugC(1, kDebugSchedule, "restoreEvents"); event_t savedEvents[kMaxEvents]; // Convert event ptrs to indexes diff --git a/engines/hugo/schedule.h b/engines/hugo/schedule.h index c6b664b892..b4889aa728 100644 --- a/engines/hugo/schedule.h +++ b/engines/hugo/schedule.h @@ -461,19 +461,19 @@ public: void freeActListArr(); void initEventQueue(); void insertActionList(const uint16 actIndex); - void loadActListArr(Common::File &in); - void loadAlNewscrIndex(Common::File &in); + void loadActListArr(Common::ReadStream &in); + void loadAlNewscrIndex(Common::ReadStream &in); void newScreen(const int screenIndex); void processBonus(const int bonusIndex); void processMaze(const int x1, const int x2, const int y1, const int y2); void restoreScreen(const int screenIndex); - void restoreEvents(Common::SeekableReadStream *f); + void restoreEvents(Common::ReadStream *f); void saveEvents(Common::WriteStream *f); void waitForRefresh(); void findAction(act* action, int16* index, int16* subElem); void saveActions(Common::WriteStream* f) const; - void restoreActions(Common::SeekableReadStream *f); + void restoreActions(Common::ReadStream *f); protected: HugoEngine *_vm; diff --git a/engines/hugo/sound.cpp b/engines/hugo/sound.cpp index 9906cb7c3c..3fa7e9fd4e 100644 --- a/engines/hugo/sound.cpp +++ b/engines/hugo/sound.cpp @@ -479,7 +479,7 @@ void SoundHandler::pcspkr_player() { } } -void SoundHandler::loadIntroSong(Common::File &in) { +void SoundHandler::loadIntroSong(Common::ReadStream &in) { for (int varnt = 0; varnt < _vm->_numVariant; varnt++) { uint16 numBuf = in.readUint16BE(); if (varnt == _vm->_gameVariant) diff --git a/engines/hugo/sound.h b/engines/hugo/sound.h index f3a8a71588..1b29ffcef9 100644 --- a/engines/hugo/sound.h +++ b/engines/hugo/sound.h @@ -113,7 +113,7 @@ public: void initSound(); void syncVolume(); void checkMusic(); - void loadIntroSong(Common::File &in); + void loadIntroSong(Common::ReadStream &in); void initPcspkrPlayer(); protected: byte curPriority; // Priority of currently playing sound diff --git a/engines/hugo/text.cpp b/engines/hugo/text.cpp index ebb89ae4a8..00a485a730 100644 --- a/engines/hugo/text.cpp +++ b/engines/hugo/text.cpp @@ -37,7 +37,7 @@ TextHandler::TextHandler(HugoEngine *vm) : _vm(vm), _textData(0), _stringtData(0 TextHandler::~TextHandler() { } -char **TextHandler::loadTextsVariante(Common::File &in, uint16 *arraySize) { +char **TextHandler::loadTextsVariante(Common::ReadStream &in, uint16 *arraySize) { int numTexts; int entryLen; int len; @@ -80,7 +80,7 @@ char **TextHandler::loadTextsVariante(Common::File &in, uint16 *arraySize) { return res; } -char ***TextHandler::loadTextsArray(Common::File &in) { +char ***TextHandler::loadTextsArray(Common::ReadStream &in) { char ***resArray = 0; uint16 arraySize; @@ -127,7 +127,7 @@ char ***TextHandler::loadTextsArray(Common::File &in) { return resArray; } -char **TextHandler::loadTexts(Common::File &in) { +char **TextHandler::loadTexts(Common::ReadStream &in) { int numTexts = in.readUint16BE(); char **res = (char **)malloc(sizeof(char *) * numTexts); int entryLen = in.readUint16BE(); @@ -148,7 +148,7 @@ char **TextHandler::loadTexts(Common::File &in) { return res; } -void TextHandler::loadAllTexts(Common::File &in) { +void TextHandler::loadAllTexts(Common::ReadStream &in) { // Read textData _textData = loadTextsVariante(in, 0); diff --git a/engines/hugo/text.h b/engines/hugo/text.h index 70a77fbe23..cf728f6ad4 100644 --- a/engines/hugo/text.h +++ b/engines/hugo/text.h @@ -45,7 +45,7 @@ public: char **getNounArray(int idx1) { return _arrayNouns[idx1]; } char **getVerbArray(int idx1) { return _arrayVerbs[idx1]; } - void loadAllTexts(Common::File &in); + void loadAllTexts(Common::ReadStream &in); void freeAllTexts(); private: @@ -63,9 +63,9 @@ private: char **_textParser; char **_textUtil; - char ***loadTextsArray(Common::File &in); - char **loadTextsVariante(Common::File &in, uint16 *arraySize); - char **loadTexts(Common::File &in); + char ***loadTextsArray(Common::ReadStream &in); + char **loadTextsVariante(Common::ReadStream &in, uint16 *arraySize); + char **loadTexts(Common::ReadStream &in); void freeTexts(char **ptr); -- cgit v1.2.3