diff options
author | Arnaud Boutonné | 2011-01-03 16:19:00 +0000 |
---|---|---|
committer | Arnaud Boutonné | 2011-01-03 16:19:00 +0000 |
commit | 42a41ebd85dce3c07c68303e7df35812662819eb (patch) | |
tree | 93409f0d200820890a6186827d9c39632caf0453 /engines | |
parent | e670e698f1571fab1c21c0d09b5003c2772e58d1 (diff) | |
download | scummvm-rg350-42a41ebd85dce3c07c68303e7df35812662819eb.tar.gz scummvm-rg350-42a41ebd85dce3c07c68303e7df35812662819eb.tar.bz2 scummvm-rg350-42a41ebd85dce3c07c68303e7df35812662819eb.zip |
HUGO: Load bitmaps from hugo.dat
- set menu bitmaps to 'on' buttons by default
- rename menu entries to match a bit better the original
svn-id: r55103
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hugo/hugo.cpp | 1 | ||||
-rw-r--r-- | engines/hugo/hugo.h | 2 | ||||
-rw-r--r-- | engines/hugo/menu.cpp | 54 | ||||
-rw-r--r-- | engines/hugo/menu.h | 24 |
4 files changed, 57 insertions, 24 deletions
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index 6166bdced1..5d86bc3872 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -755,6 +755,7 @@ bool HugoEngine::loadHugoDat() { _object->loadNumObj(in); _scheduler->loadAlNewscrIndex(in); _screen->loadFontArr(in); + _topMenu->loadBmpArr(in); return true; } diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h index 401af19166..270ca25a48 100644 --- a/engines/hugo/hugo.h +++ b/engines/hugo/hugo.h @@ -36,7 +36,7 @@ #include "hugo/file.h" #define HUGO_DAT_VER_MAJ 0 // 1 byte -#define HUGO_DAT_VER_MIN 35 // 1 byte +#define HUGO_DAT_VER_MIN 36 // 1 byte #define DATAALIGNMENT 4 #define EDGE 10 // Closest object can get to edge of screen #define EDGE2 (EDGE * 2) // Push object further back on edge collision diff --git a/engines/hugo/menu.cpp b/engines/hugo/menu.cpp index 849a5ec114..c40174ecc4 100644 --- a/engines/hugo/menu.cpp +++ b/engines/hugo/menu.cpp @@ -25,6 +25,7 @@ #include "hugo/hugo.h" #include "graphics/imagedec.h" +#include "common/substream.h" namespace Hugo { @@ -42,16 +43,16 @@ enum { enum { kCmdWhat = 'WHAT', kCmdMusic = 'MUZK', - kCmdVolume = 'VOLM', + kCmdSoundFX = 'SOUN', kCmdLoad = 'LOAD', kCmdSave = 'SAVE', - kCmdUndo = 'UNDO', - kCmdText = 'TEXT', + kCmdRecall = 'RECL', + kCmdTurbo = 'TURB', kCmdLook = 'LOOK', - kCmdBomb = 'BOMB' + kCmdInvent = 'INVT' }; -TopMenu::TopMenu(HugoEngine *vm) : Dialog(0, 0, kMenuWidth, kMenuHeight), +TopMenu::TopMenu(HugoEngine *vm) : Dialog(0, 0, kMenuWidth, kMenuHeight), arrayBmp(0), _vm(vm) { init(); } @@ -60,22 +61,13 @@ void TopMenu::init() { int x = kMenuX; int y = kMenuY; - Graphics::Surface *surf; - Common::File in; - - in.open("btn_1.bmp"); - - surf = Graphics::ImageDecoder::loadFile(in, g_system->getOverlayFormat()); - _whatButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "What is it?", kCmdWhat); - _whatButton->setGfx(surf); - x += kButtonWidth + kButtonPad; _musicButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Music", kCmdMusic); x += kButtonWidth + kButtonPad; - _volumeButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Volume", kCmdVolume); + _soundFXButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Sound FX", kCmdSoundFX); x += kButtonWidth + kButtonPad; x += kButtonSpace; @@ -88,20 +80,44 @@ void TopMenu::init() { x += kButtonSpace; - _undoButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Undo", kCmdUndo); + _recallButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Recall last command", kCmdRecall); x += kButtonWidth + kButtonPad; - _textButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Text", kCmdText); + _turboButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Turbo", kCmdTurbo); x += kButtonWidth + kButtonPad; x += kButtonSpace; - _lookButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Look", kCmdLook); + _lookButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Description of the scene", kCmdLook); x += kButtonWidth + kButtonPad; - _bombButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Bomb", kCmdBomb); + _inventButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Inventory", kCmdInvent); x += kButtonWidth + kButtonPad; } +void TopMenu::loadBmpArr(Common::File &in) { + uint16 arraySize = in.readUint16BE(); + + arrayBmp = (Graphics::Surface **)malloc(sizeof(Graphics::Surface *) * (arraySize)); + for (int i = 0; i < arraySize; i++) { + uint16 bmpSize = in.readUint16BE(); + uint32 filPos = in.pos(); + Common::SeekableSubReadStream stream(&in, filPos, filPos + bmpSize); + arrayBmp[i] = Graphics::ImageDecoder::loadFile(stream, g_system->getOverlayFormat()); + in.skip(bmpSize); + } + + // Set the graphics to the 'on' buttons + _whatButton->setGfx(arrayBmp[2*kMenuWhat]); + _musicButton->setGfx(arrayBmp[2*kMenuMusic]); + _soundFXButton->setGfx(arrayBmp[2*kMenuSoundFX]); + _loadButton->setGfx(arrayBmp[2*kMenuLoad]); + _saveButton->setGfx(arrayBmp[2*kMenuSave]); + _recallButton->setGfx(arrayBmp[2*kMenuRecall]); + _turboButton->setGfx(arrayBmp[2*kMenuTurbo]); + _lookButton->setGfx(arrayBmp[2*kMenuLook]); + _inventButton->setGfx(arrayBmp[2*kMenuInventory]); +} + } // End of namespace Hugo diff --git a/engines/hugo/menu.h b/engines/hugo/menu.h index fa565c3a5e..5d7c1c6dd8 100644 --- a/engines/hugo/menu.h +++ b/engines/hugo/menu.h @@ -30,6 +30,18 @@ namespace Hugo { +enum MenuOption { + kMenuWhat = 0, + kMenuMusic, + kMenuSoundFX, + kMenuLoad, + kMenuSave, + kMenuRecall, + kMenuTurbo, + kMenuLook, + kMenuInventory +}; + class TopMenu : public GUI::Dialog { public: TopMenu(HugoEngine *vm); @@ -41,6 +53,7 @@ public: void handleKeyDown(Common::KeyState state); void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); */ + void loadBmpArr(Common::File &in); protected: void init(); @@ -49,13 +62,16 @@ protected: GUI::PicButtonWidget *_whatButton; GUI::PicButtonWidget *_musicButton; - GUI::PicButtonWidget *_volumeButton; + GUI::PicButtonWidget *_soundFXButton; GUI::PicButtonWidget *_loadButton; GUI::PicButtonWidget *_saveButton; - GUI::PicButtonWidget *_undoButton; - GUI::PicButtonWidget *_textButton; + GUI::PicButtonWidget *_recallButton; + GUI::PicButtonWidget *_turboButton; GUI::PicButtonWidget *_lookButton; - GUI::PicButtonWidget *_bombButton; + GUI::PicButtonWidget *_inventButton; + + Graphics::Surface **arrayBmp; + }; } |