MADS: Adding in classes for fonts, game, user interfaec, and graphics
This commit is contained in:
parent
0e46c809d1
commit
530cbb4bc3
14 changed files with 668 additions and 13 deletions
|
@ -25,6 +25,8 @@
|
|||
namespace MADS {
|
||||
|
||||
const char *const madsPackString = "MADSPACK";
|
||||
const char *const FabInputExceededError = "FabDecompressor - Passed end of input buffer during decompression";
|
||||
const char *const FabOutputExceededError = "FabDecompressor - Decompressed data exceeded specified size";
|
||||
|
||||
bool MadsPack::isCompressed(Common::SeekableReadStream *stream) {
|
||||
// Check whether the passed stream is packed
|
||||
|
@ -94,9 +96,6 @@ MadsPack::~MadsPack() {
|
|||
|
||||
//--------------------------------------------------------------------------
|
||||
|
||||
const char *FabInputExceededError = "FabDecompressor - Passed end of input buffer during decompression";
|
||||
const char *FabOutputExceededError = "FabDecompressor - Decompressed data exceeded specified size";
|
||||
|
||||
void FabDecompressor::decompress(const byte *srcData, int srcSize, byte *destData, int destSize) {
|
||||
byte copyLen, copyOfsShift, copyOfsMask, copyLenMask;
|
||||
unsigned long copyOfs;
|
||||
|
|
283
engines/mads/font.cpp
Normal file
283
engines/mads/font.cpp
Normal file
|
@ -0,0 +1,283 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "mads/mads.h"
|
||||
#include "mads/compression.h"
|
||||
#include "mads/font.h"
|
||||
#include "mads/msurface.h"
|
||||
|
||||
namespace MADS {
|
||||
|
||||
Font *Font::init(MADSEngine *vm) {
|
||||
if (vm->getGameFeatures() & GF_MADS) {
|
||||
return new FontMADS(vm);
|
||||
} else {
|
||||
return new FontM4(vm);
|
||||
}
|
||||
}
|
||||
|
||||
Font::Font(MADSEngine *vm) : _vm(vm) {
|
||||
_sysFont = true;
|
||||
|
||||
_fontColors[0] = _vm->_palette->BLACK;
|
||||
_fontColors[1] = _vm->_palette->WHITE;
|
||||
_fontColors[2] = _vm->_palette->BLACK;
|
||||
_fontColors[3] = _vm->_palette->DARK_GRAY;
|
||||
}
|
||||
|
||||
Font::~Font() {
|
||||
if (!_sysFont) {
|
||||
delete[] _charWidths;
|
||||
delete[] _charOffs;
|
||||
delete[] _charData;
|
||||
}
|
||||
}
|
||||
|
||||
void Font::setColor(uint8 color) {
|
||||
if (_sysFont)
|
||||
_fontColors[1] = color;
|
||||
else
|
||||
_fontColors[3] = color;
|
||||
}
|
||||
|
||||
void Font::setColors(uint8 alt1, uint8 alt2, uint8 foreground) {
|
||||
if (_sysFont)
|
||||
_fontColors[1] = foreground;
|
||||
else {
|
||||
_fontColors[1] = alt1;
|
||||
_fontColors[2] = alt2;
|
||||
_fontColors[3] = foreground;
|
||||
}
|
||||
}
|
||||
|
||||
int Font::write(MSurface *surface, const Common::String &msg, const Common::Point &pt, int width, int spaceWidth, uint8 colors[]) {
|
||||
|
||||
/*TODO
|
||||
if (custom_ascii_converter) { // if there is a function to convert the extended ASCII characters
|
||||
custom_ascii_converter(out_string); // call it with the string
|
||||
}
|
||||
*/
|
||||
|
||||
if (width > 0)
|
||||
width = MIN(surface->width(), pt.x + width);
|
||||
else
|
||||
width = surface->width();
|
||||
|
||||
int x = pt.x + 1;
|
||||
int y = pt.y + 1;
|
||||
|
||||
int skipY = 0;
|
||||
if (y < 0) {
|
||||
skipY = -y;
|
||||
y = 0;
|
||||
}
|
||||
|
||||
int height = MAX(0, _maxHeight - skipY);
|
||||
if (height == 0)
|
||||
return x;
|
||||
|
||||
int bottom = y + height - 1;
|
||||
if (bottom > surface->height() - 1) {
|
||||
height -= MIN(height, bottom - (surface->height() - 1));
|
||||
}
|
||||
|
||||
if (height <= 0)
|
||||
return x;
|
||||
|
||||
byte *destPtr = surface->getBasePtr(x, y);
|
||||
uint8 *oldDestPtr = destPtr;
|
||||
|
||||
int xPos = x;
|
||||
|
||||
const char *text = msg.c_str();
|
||||
while (*text) {
|
||||
char theChar = (*text++) & 0x7F;
|
||||
int charWidth = _charWidths[theChar];
|
||||
|
||||
if (charWidth > 0) {
|
||||
|
||||
if (xPos + charWidth >= width)
|
||||
return xPos;
|
||||
|
||||
uint8 *charData = &_charData[_charOffs[theChar]];
|
||||
int bpp = getBpp(charWidth);
|
||||
|
||||
if (skipY != 0)
|
||||
charData += bpp * skipY;
|
||||
|
||||
for (int i = 0; i < height; i++) {
|
||||
for (int j = 0; j < bpp; j++) {
|
||||
if (*charData & 0xc0)
|
||||
*destPtr = colors[(*charData & 0xc0) >> 6];
|
||||
destPtr++;
|
||||
if (*charData & 0x30)
|
||||
*destPtr = colors[(*charData & 0x30) >> 4];
|
||||
destPtr++;
|
||||
if (*charData & 0x0C)
|
||||
*destPtr = colors[(*charData & 0x0C) >> 2];
|
||||
destPtr++;
|
||||
if (*charData & 0x03)
|
||||
*destPtr = colors[*charData & 0x03];
|
||||
destPtr++;
|
||||
charData++;
|
||||
}
|
||||
|
||||
destPtr += surface->width() - bpp * 4;
|
||||
|
||||
}
|
||||
|
||||
destPtr = oldDestPtr + charWidth + spaceWidth;
|
||||
oldDestPtr = destPtr;
|
||||
|
||||
}
|
||||
|
||||
xPos += charWidth + spaceWidth;
|
||||
|
||||
}
|
||||
|
||||
surface->freeData();
|
||||
return xPos;
|
||||
|
||||
}
|
||||
|
||||
int Font::getWidth(const Common::String &msg, int spaceWidth) {
|
||||
/*
|
||||
if (custom_ascii_converter) { // if there is a function to convert the extended ASCII characters
|
||||
custom_ascii_converter(out_string); // call it with the string
|
||||
}
|
||||
*/
|
||||
int width = 0;
|
||||
const char *text = msg.c_str();
|
||||
|
||||
while (*text)
|
||||
width += _charWidths[*text++ & 0x7F] + spaceWidth;
|
||||
return width;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
void FontMADS::setFont(const Common::String &filename) {
|
||||
if (!_filename.empty() && (filename == _filename))
|
||||
// Already using specified font, so don't bother reloading
|
||||
return;
|
||||
|
||||
_sysFont = false;
|
||||
_filename = filename;
|
||||
|
||||
MadsPack fontData(filename, _vm);
|
||||
Common::SeekableReadStream *fontFile = fontData.getItemStream(0);
|
||||
|
||||
_maxHeight = fontFile->readByte();
|
||||
_maxWidth = fontFile->readByte();
|
||||
|
||||
_charWidths = new uint8[128];
|
||||
// Char data is shifted by 1
|
||||
_charWidths[0] = 0;
|
||||
fontFile->read(_charWidths + 1, 127);
|
||||
fontFile->readByte(); // remainder
|
||||
|
||||
_charOffs = new uint16[128];
|
||||
|
||||
uint startOffs = 2 + 128 + 256;
|
||||
uint fontSize = fontFile->size() - startOffs;
|
||||
|
||||
// Char data is shifted by 1
|
||||
_charOffs[0] = 0;
|
||||
for (int i = 1; i < 128; i++)
|
||||
_charOffs[i] = fontFile->readUint16LE() - startOffs;
|
||||
fontFile->readUint16LE(); // remainder
|
||||
|
||||
_charData = new uint8[fontSize];
|
||||
fontFile->read(_charData, fontSize);
|
||||
|
||||
delete fontFile;
|
||||
}
|
||||
|
||||
int FontMADS::getBpp(int charWidth) {
|
||||
if (charWidth > 12)
|
||||
return 4;
|
||||
else if (charWidth > 8)
|
||||
return 3;
|
||||
else if (charWidth > 4)
|
||||
return 2;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
void FontM4::setFont(const Common::String &filename) {
|
||||
if (!_filename.empty() && (filename == _filename))
|
||||
// Already using specified font, so don't bother reloading
|
||||
return;
|
||||
|
||||
_sysFont = false;
|
||||
_filename = filename;
|
||||
|
||||
Common::SeekableReadStream *fontFile = _vm->_resources->openFile(filename);
|
||||
|
||||
if (fontFile->readUint32LE() != MKTAG('F', 'O', 'N', 'T')) {
|
||||
warning("Font: FONT tag expected");
|
||||
return;
|
||||
}
|
||||
|
||||
_maxHeight = fontFile->readByte();
|
||||
_maxWidth = fontFile->readByte();
|
||||
uint fontSize = fontFile->readUint32LE();
|
||||
|
||||
//printf("Font::Font: _maxWidth = %d, _maxHeight = %d, fontSize = %d\n", _maxWidth, _maxHeight, fontSize);
|
||||
|
||||
if (fontFile->readUint32LE() != MKTAG('W', 'I', 'D', 'T')) {
|
||||
warning("Font: WIDT tag expected");
|
||||
return;
|
||||
}
|
||||
|
||||
_charWidths = new uint8[256];
|
||||
fontFile->read(_charWidths, 256);
|
||||
|
||||
if (fontFile->readUint32LE() != MKTAG('O', 'F', 'F', 'S')) {
|
||||
warning("Font: OFFS tag expected\n");
|
||||
return;
|
||||
}
|
||||
|
||||
_charOffs = new uint16[256];
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
_charOffs[i] = fontFile->readUint16LE();
|
||||
|
||||
if (fontFile->readUint32LE() != MKTAG('P', 'I', 'X', 'S')) {
|
||||
warning("Font: PIXS tag expected\n");
|
||||
return;
|
||||
}
|
||||
|
||||
_charData = new uint8[fontSize];
|
||||
fontFile->read(_charData, fontSize);
|
||||
|
||||
_vm->_resources->toss(filename);
|
||||
}
|
||||
|
||||
int FontM4::getBpp(int charWidth) {
|
||||
return charWidth / 4 + 1;
|
||||
}
|
||||
|
||||
} // End of namespace MADS
|
106
engines/mads/font.h
Normal file
106
engines/mads/font.h
Normal file
|
@ -0,0 +1,106 @@
|
|||
/* 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 MADS_FONT_H
|
||||
#define MADS_FONT_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/util.h"
|
||||
#include "common/endian.h"
|
||||
#include "mads/msurface.h"
|
||||
|
||||
namespace MADS {
|
||||
|
||||
#define FONT_MENU "fontmenu.fnt"
|
||||
#define FONT_INTERFACE "fontintr.fnt"
|
||||
#define FONT_TINY "small.fnt"
|
||||
#define FONT_SMALL "small.fnt"
|
||||
#define FONT_MEDIUM "medium.fnt"
|
||||
#define FONT_LINE "fontline.fnt"
|
||||
#define FONT_CONVERSATION "fontconv.fnt"
|
||||
#define FONT_4X6 "4x6pp.fnt"
|
||||
#define FONT_5X6 "5x6pp.fnt"
|
||||
|
||||
#define FONT_CONVERSATION_MADS "fontconv.ff"
|
||||
#define FONT_INTERFACE_MADS "fontintr.ff"
|
||||
#define FONT_MAIN_MADS "fontmain.ff"
|
||||
#define FONT_MENU_MADS "fontmenu.ff" // Not in Rex (uses bitmap files for menu strings)
|
||||
#define FONT_MISC_MADS "fontmisc.ff"
|
||||
#define FONT_TELE_MADS "fonttele.ff" // Not in Phantom
|
||||
#define FONT_PHAN_MADS "fontphan.ff" // Phantom only
|
||||
|
||||
class MADSEngine;
|
||||
|
||||
class Font {
|
||||
protected:
|
||||
MADSEngine *_vm;
|
||||
|
||||
uint8 _maxWidth, _maxHeight;
|
||||
uint8 *_charWidths;
|
||||
uint16 *_charOffs;
|
||||
uint8 *_charData;
|
||||
bool _sysFont;
|
||||
Common::String _filename;
|
||||
uint8 _fontColors[4];
|
||||
|
||||
protected:
|
||||
Font(MADSEngine *vm);
|
||||
|
||||
virtual void setFont(const Common::String &filename) = 0;
|
||||
virtual int getBpp(int charWidth) = 0;
|
||||
public:
|
||||
static Font *init(MADSEngine *vm);
|
||||
public:
|
||||
virtual ~Font();
|
||||
|
||||
void setColor(uint8 color);
|
||||
void setColors(uint8 alt1, uint8 alt2, uint8 foreground);
|
||||
|
||||
int getWidth(const Common::String &msg, int spaceWidth = -1);
|
||||
int getHeight() const { return _maxHeight; }
|
||||
int write(MSurface *surface, const Common::String &msg, const Common::Point &pt, int width, int spaceWidth, uint8 colors[]);
|
||||
int writeString(MSurface *surface, const Common::String &msg, const Common::Point &pt, int width = 0, int spaceWidth = -1) {
|
||||
return write(surface, msg, pt, width, spaceWidth, _fontColors);
|
||||
}
|
||||
};
|
||||
|
||||
class FontMADS: public Font {
|
||||
friend class Font;
|
||||
protected:
|
||||
virtual void setFont(const Common::String &filename);
|
||||
virtual int getBpp(int charWidth);
|
||||
|
||||
FontMADS(MADSEngine *vm): Font(vm) {}
|
||||
};
|
||||
|
||||
class FontM4: public Font {
|
||||
friend class Font;
|
||||
protected:
|
||||
virtual void setFont(const Common::String &filename);
|
||||
virtual int getBpp(int charWidth);
|
||||
|
||||
FontM4(MADSEngine *vm): Font(vm) {}
|
||||
};
|
||||
|
||||
} // End of namespace MADS
|
||||
|
||||
#endif /* MADS_FONT_H */
|
39
engines/mads/game.cpp
Normal file
39
engines/mads/game.cpp
Normal file
|
@ -0,0 +1,39 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "mads/mads.h"
|
||||
#include "mads/game.h"
|
||||
#include "mads/graphics.h"
|
||||
#include "mads/msurface.h"
|
||||
|
||||
namespace MADS {
|
||||
|
||||
Game *Game::init(MADSEngine *vm) {
|
||||
return new Game(vm);
|
||||
}
|
||||
|
||||
Game::Game(MADSEngine *vm): _vm(vm), _surface(MSurface::init(
|
||||
MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT)) {
|
||||
}
|
||||
|
||||
} // End of namespace MADS
|
46
engines/mads/game.h
Normal file
46
engines/mads/game.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MADS_GAME_H
|
||||
#define MADS_GAME_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
namespace MADS {
|
||||
|
||||
class MADSEngine;
|
||||
|
||||
class Game {
|
||||
private:
|
||||
MADSEngine *_vm;
|
||||
MSurface *_surface;
|
||||
|
||||
Game(MADSEngine *vm);
|
||||
public:
|
||||
static Game *init(MADSEngine *vm);
|
||||
public:
|
||||
~Game();
|
||||
};
|
||||
|
||||
} // End of namespace MADS
|
||||
|
||||
#endif /* MADS_GAME_H */
|
30
engines/mads/graphics.cpp
Normal file
30
engines/mads/graphics.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "mads/mads.h"
|
||||
#include "mads/graphics.h"
|
||||
|
||||
namespace MADS {
|
||||
|
||||
|
||||
} // End of namespace MADS
|
36
engines/mads/graphics.h
Normal file
36
engines/mads/graphics.h
Normal file
|
@ -0,0 +1,36 @@
|
|||
/* 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 MADS_GRAPHICS_H
|
||||
#define MADS_GRAPHICS_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
namespace MADS {
|
||||
|
||||
#define MADS_SCREEN_WIDTH 320
|
||||
#define MADS_SCREEN_HEIGHT 200
|
||||
#define MADS_INTERFACE_HEIGHT 44
|
||||
|
||||
} // End of namespace MADS
|
||||
|
||||
#endif /* MADS_GRAPHICS_H */
|
|
@ -26,6 +26,7 @@
|
|||
#include "common/events.h"
|
||||
#include "engines/util.h"
|
||||
#include "mads/mads.h"
|
||||
#include "mads/graphics.h"
|
||||
#include "mads/resources.h"
|
||||
#include "mads/sound.h"
|
||||
#include "mads/msurface.h"
|
||||
|
@ -40,17 +41,24 @@ MADSEngine::MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc) :
|
|||
_easyMouse = true;
|
||||
_invObjectStill = false;
|
||||
_textWindowStill = false;
|
||||
|
||||
_events = nullptr;
|
||||
_font = nullptr;
|
||||
_palette = nullptr;
|
||||
_resources = nullptr;
|
||||
_screen = nullptr;
|
||||
_sound = nullptr;
|
||||
_userInterface = nullptr;
|
||||
}
|
||||
|
||||
MADSEngine::~MADSEngine() {
|
||||
delete _events;
|
||||
delete _font;
|
||||
delete _palette;
|
||||
delete _resources;
|
||||
delete _screen;
|
||||
delete _sound;
|
||||
delete _userInterface;
|
||||
}
|
||||
|
||||
void MADSEngine::initialise() {
|
||||
|
@ -63,13 +71,18 @@ void MADSEngine::initialise() {
|
|||
MSprite::setVm(this);
|
||||
|
||||
_events = new EventsManager(this);
|
||||
_palette = new Palette(this);
|
||||
_font = Font::init(this);
|
||||
_resources = new ResourcesManager(this);
|
||||
_screen = MSurface::init();
|
||||
_screen = MSurface::init(true);
|
||||
_sound = new SoundManager(this, _mixer);
|
||||
_userInterface = UserInterface::init(this);
|
||||
|
||||
_screen->empty();
|
||||
}
|
||||
|
||||
Common::Error MADSEngine::run() {
|
||||
initGraphics(320, 200, false);
|
||||
initGraphics(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT, false);
|
||||
initialise();
|
||||
|
||||
Common::Event e;
|
||||
|
|
|
@ -31,9 +31,11 @@
|
|||
#include "engines/engine.h"
|
||||
#include "graphics/surface.h"
|
||||
#include "mads/events.h"
|
||||
#include "mads/font.h"
|
||||
#include "mads/msurface.h"
|
||||
#include "mads/resources.h"
|
||||
#include "mads/sound.h"
|
||||
#include "mads/user_interface.h"
|
||||
|
||||
/**
|
||||
* This is the namespace of the MADS engine.
|
||||
|
@ -88,10 +90,12 @@ protected:
|
|||
virtual bool hasFeature(EngineFeature f) const;
|
||||
public:
|
||||
EventsManager *_events;
|
||||
Font *_font;
|
||||
Palette *_palette;
|
||||
ResourcesManager *_resources;
|
||||
MSurface *_screen;
|
||||
SoundManager *_sound;
|
||||
UserInterface *_userInterface;
|
||||
|
||||
public:
|
||||
MADSEngine(OSystem *syst, const MADSGameDescription *gameDesc);
|
||||
|
|
|
@ -4,6 +4,9 @@ MODULE_OBJS := \
|
|||
compression.o \
|
||||
detection.o \
|
||||
events.o \
|
||||
font.o \
|
||||
game.o \
|
||||
graphics.o \
|
||||
mads.o \
|
||||
msprite.o \
|
||||
msurface.o \
|
||||
|
@ -11,7 +14,8 @@ MODULE_OBJS := \
|
|||
resources.o \
|
||||
sound.o \
|
||||
sound_nebular.o \
|
||||
sprite.o
|
||||
sprite.o \
|
||||
user_interface.o
|
||||
|
||||
# This module can be built as a plugin
|
||||
ifeq ($(ENABLE_MADS), DYNAMIC_PLUGIN)
|
||||
|
|
|
@ -21,10 +21,11 @@
|
|||
*/
|
||||
|
||||
#include "engines/util.h"
|
||||
#include "mads/mads.h"
|
||||
#include "mads/compression.h"
|
||||
#include "mads/msurface.h"
|
||||
#include "mads/graphics.h"
|
||||
#include "mads/mads.h"
|
||||
#include "mads/msprite.h"
|
||||
#include "mads/msurface.h"
|
||||
|
||||
namespace MADS {
|
||||
|
||||
|
@ -370,8 +371,8 @@ void MSurfaceMADS::loadCodes(Common::SeekableReadStream *source) {
|
|||
return;
|
||||
}
|
||||
|
||||
uint16 widthVal = 320;
|
||||
uint16 heightVal = 156;
|
||||
uint16 widthVal = MADS_SCREEN_WIDTH;
|
||||
uint16 heightVal = MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT;
|
||||
byte *walkMap = new byte[source->size()];
|
||||
|
||||
create(widthVal, heightVal);
|
||||
|
@ -536,8 +537,8 @@ void MSurfaceMADS::loadInterface(int index, RGBList **palData) {
|
|||
|
||||
// Chunk 1, data
|
||||
intStream = intFile.getItemStream(1);
|
||||
create(320, 44);
|
||||
intStream->read(pixels, 320 * 44);
|
||||
create(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT);
|
||||
intStream->read(pixels, MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT);
|
||||
delete intStream;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/stream.h"
|
||||
#include "common/str.h"
|
||||
|
||||
namespace MADS {
|
||||
|
||||
|
@ -39,11 +40,15 @@ public:
|
|||
/**
|
||||
* Return a named resource
|
||||
*/
|
||||
Common::SeekableReadStream *get(const Common::String &resourceName) {
|
||||
Common::SeekableReadStream *get(const Common::String &resourceName, bool loadFlag = false) {
|
||||
// TODO
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *openFile(const Common::String &resourceName) {
|
||||
return get(resourceName, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Release a previously loaded resource
|
||||
*/
|
||||
|
|
43
engines/mads/user_interface.cpp
Normal file
43
engines/mads/user_interface.cpp
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "mads/mads.h"
|
||||
#include "mads/graphics.h"
|
||||
#include "mads/user_interface.h"
|
||||
#include "mads/msurface.h"
|
||||
|
||||
namespace MADS {
|
||||
|
||||
UserInterface *UserInterface::init(MADSEngine *vm) {
|
||||
return new UserInterface(vm);
|
||||
}
|
||||
|
||||
UserInterface::UserInterface(MADSEngine *vm): _vm(vm), _surface(
|
||||
MSurface::init(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT)) {
|
||||
}
|
||||
|
||||
UserInterface::~UserInterface() {
|
||||
delete _surface;
|
||||
}
|
||||
|
||||
} // End of namespace MADS
|
46
engines/mads/user_interface.h
Normal file
46
engines/mads/user_interface.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MADS_USER_INTERFACE_H
|
||||
#define MADS_USER_INTERFACE_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
namespace MADS {
|
||||
|
||||
class MADSEngine;
|
||||
|
||||
class UserInterface {
|
||||
private:
|
||||
MADSEngine *_vm;
|
||||
MSurface *_surface;
|
||||
|
||||
UserInterface(MADSEngine *vm);
|
||||
public:
|
||||
static UserInterface *init(MADSEngine *vm);
|
||||
public:
|
||||
~UserInterface();
|
||||
};
|
||||
|
||||
} // End of namespace MADS
|
||||
|
||||
#endif /* MADS_USER_INTERFACE_H */
|
Loading…
Add table
Add a link
Reference in a new issue