mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-07 10:48:43 +00:00
MADS: Fix display of user interface during animation
This commit is contained in:
parent
b652e2eafd
commit
ca6cf0eaf2
@ -39,7 +39,6 @@
|
||||
#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.
|
||||
|
@ -34,20 +34,32 @@ MADSEngine *MSurface::_vm = nullptr;
|
||||
|
||||
MSurface::MSurface() {
|
||||
pixels = nullptr;
|
||||
_freeFlag = false;
|
||||
}
|
||||
|
||||
MSurface::MSurface(int width, int height) {
|
||||
pixels = nullptr;
|
||||
_freeFlag = false;
|
||||
setSize(width, height);
|
||||
}
|
||||
|
||||
MSurface::~MSurface() {
|
||||
Graphics::Surface::free();
|
||||
if (_freeFlag)
|
||||
Graphics::Surface::free();
|
||||
}
|
||||
|
||||
void MSurface::setSize(int width, int height) {
|
||||
Graphics::Surface::free();
|
||||
if (_freeFlag)
|
||||
Graphics::Surface::free();
|
||||
Graphics::Surface::create(width, height, Graphics::PixelFormat::createFormatCLUT8());
|
||||
_freeFlag = true;
|
||||
}
|
||||
|
||||
void MSurface::setPixels(byte *pData, int horizSize, int vertSize) {
|
||||
_freeFlag = false;
|
||||
pixels = pData;
|
||||
w = horizSize;
|
||||
h = vertSize;
|
||||
}
|
||||
|
||||
int MSurface::scaleValue(int value, int scale, int err) {
|
||||
|
@ -50,6 +50,8 @@ struct SpriteInfo {
|
||||
* MADS graphics surface
|
||||
*/
|
||||
class MSurface : public Graphics::Surface {
|
||||
private:
|
||||
bool _freeFlag;
|
||||
protected:
|
||||
static MADSEngine *_vm;
|
||||
public:
|
||||
@ -83,6 +85,12 @@ public:
|
||||
*/
|
||||
void setSize(int width, int height);
|
||||
|
||||
/**
|
||||
* Sets the pixels the surface is associated with
|
||||
* @remarks The surface will not free the data block
|
||||
*/
|
||||
void setPixels(byte *pData, int horizSize, int vertSize);
|
||||
|
||||
/**
|
||||
* Draws an arbitrary line on the screen using a specified color
|
||||
* @param startPos Starting position
|
||||
|
@ -39,6 +39,9 @@ void SceneNode::load(Common::SeekableReadStream *f) {
|
||||
UserInterface::UserInterface(MADSEngine *vm) : _vm(vm) {
|
||||
_category = CAT_NONE;
|
||||
_screenObjectsCount = 0;
|
||||
|
||||
byte *pData = _vm->_screen.getBasePtr(0, MADS_SCREEN_HEIGHT - MADS_INTERFACE_HEIGHT);
|
||||
setPixels(pData, MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT);
|
||||
}
|
||||
|
||||
void UserInterface::load(const Common::String &resName) {
|
||||
@ -61,7 +64,6 @@ void UserInterface::load(const Common::String &resName) {
|
||||
delete palStream;
|
||||
|
||||
// set the size for the interface
|
||||
setSize(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT);
|
||||
Common::SeekableReadStream *pixelsStream = madsPack.getItemStream(1);
|
||||
pixelsStream->read(getData(), MADS_SCREEN_WIDTH * MADS_INTERFACE_HEIGHT);
|
||||
delete pixelsStream;
|
||||
@ -84,7 +86,6 @@ void UserInterface::setup(int id) {
|
||||
resName += "A";
|
||||
|
||||
resName += ".INT";
|
||||
free();
|
||||
load(resName);
|
||||
}
|
||||
scene._screenObjects._v832EC = id;
|
||||
|
Loading…
x
Reference in New Issue
Block a user