mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 08:25:35 +00:00
MADS: Fix spare screen background changes for TextView showing quotes
This commit is contained in:
parent
6201ddf63e
commit
a5528ecc7e
@ -434,7 +434,6 @@ void TextView::execute(MADSEngine *vm, const Common::String &resName) {
|
|||||||
TextView::TextView(MADSEngine *vm) : MenuView(vm) {
|
TextView::TextView(MADSEngine *vm) : MenuView(vm) {
|
||||||
_animating = false;
|
_animating = false;
|
||||||
_panSpeed = 0;
|
_panSpeed = 0;
|
||||||
Common::fill(&_spareScreens[0], &_spareScreens[10], 0);
|
|
||||||
_spareScreen = nullptr;
|
_spareScreen = nullptr;
|
||||||
_scrollCount = 0;
|
_scrollCount = 0;
|
||||||
_lineY = -1;
|
_lineY = -1;
|
||||||
@ -449,7 +448,6 @@ TextView::TextView(MADSEngine *vm) : MenuView(vm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TextView::~TextView() {
|
TextView::~TextView() {
|
||||||
delete _spareScreen;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextView::load() {
|
void TextView::load() {
|
||||||
@ -570,11 +568,17 @@ void TextView::processCommand() {
|
|||||||
// Sets a secondary background number that can be later switched in with a PAGE command
|
// Sets a secondary background number that can be later switched in with a PAGE command
|
||||||
paramP = commandStr + 6;
|
paramP = commandStr + 6;
|
||||||
int spareIndex = commandStr[5] - '0';
|
int spareIndex = commandStr[5] - '0';
|
||||||
if ((spareIndex >= 0) && (spareIndex <= 9)) {
|
assert(spareIndex < 4);
|
||||||
int screenId = getParameter(¶mP);
|
int screenId = getParameter(¶mP);
|
||||||
|
|
||||||
_spareScreens[spareIndex] = screenId;
|
// Load the spare background
|
||||||
}
|
SceneInfo *sceneInfo = SceneInfo::init(_vm);
|
||||||
|
sceneInfo->_width = MADS_SCREEN_WIDTH;
|
||||||
|
sceneInfo->_height = MADS_SCENE_HEIGHT;
|
||||||
|
_spareScreens[spareIndex].setSize(MADS_SCREEN_WIDTH, MADS_SCENE_HEIGHT);
|
||||||
|
sceneInfo->loadMadsV1Background(screenId, "", SCENEFLAG_TRANSLATE,
|
||||||
|
_spareScreens[spareIndex]);
|
||||||
|
delete sceneInfo;
|
||||||
|
|
||||||
} else if (!strncmp(commandStr, "PAGE", 4)) {
|
} else if (!strncmp(commandStr, "PAGE", 4)) {
|
||||||
// Signals to change to a previous specified secondary background
|
// Signals to change to a previous specified secondary background
|
||||||
@ -582,10 +586,8 @@ void TextView::processCommand() {
|
|||||||
int spareIndex = getParameter(¶mP);
|
int spareIndex = getParameter(¶mP);
|
||||||
|
|
||||||
// Only allow background switches if one isn't currently in progress
|
// Only allow background switches if one isn't currently in progress
|
||||||
if (!_spareScreen && (_spareScreens[spareIndex] != 0)) {
|
if (!_spareScreen && _spareScreens[spareIndex].getPixels() != nullptr) {
|
||||||
_spareScreen = new MSurface(MADS_SCREEN_WIDTH, MADS_SCREEN_HEIGHT);
|
_spareScreen = &_spareScreens[spareIndex];
|
||||||
//_spareScreen->loadBackground(_spareScreens[spareIndex], &_bgSpare);
|
|
||||||
|
|
||||||
_translationX = 0;
|
_translationX = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -667,24 +669,23 @@ void TextView::doFrame() {
|
|||||||
// If a screen transition is in progress and it's time for another column, handle it
|
// If a screen transition is in progress and it's time for another column, handle it
|
||||||
if (_spareScreen) {
|
if (_spareScreen) {
|
||||||
byte *srcP = _spareScreen->getBasePtr(_translationX, 0);
|
byte *srcP = _spareScreen->getBasePtr(_translationX, 0);
|
||||||
byte *destP = scene._backgroundSurface.getBasePtr(_translationX, 0);
|
byte *bgP = scene._backgroundSurface.getBasePtr(_translationX, 0);
|
||||||
|
byte *screenP = (byte *)_vm->_screen.getBasePtr(_translationX, 0);
|
||||||
|
|
||||||
for (int y = 0; y < MADS_SCENE_HEIGHT; ++y, srcP += _spareScreen->w,
|
for (int y = 0; y < MADS_SCENE_HEIGHT; ++y, srcP += MADS_SCREEN_WIDTH,
|
||||||
destP += MADS_SCREEN_WIDTH) {
|
bgP += MADS_SCREEN_WIDTH, screenP += MADS_SCREEN_WIDTH) {
|
||||||
*destP = *srcP;
|
*bgP = *srcP;
|
||||||
|
*screenP = *srcP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (++_translationX >= MADS_SCREEN_WIDTH) {
|
// Flag the column of the screen is modified
|
||||||
// Surface transition is complete
|
_vm->_screen.copyRectToScreen(Common::Rect(_translationX, 0,
|
||||||
/*
|
_translationX + 1, MADS_SCENE_HEIGHT));
|
||||||
delete _spareScreen;
|
|
||||||
_spareScreen = nullptr;
|
|
||||||
|
|
||||||
// _vm->_palette->deleteRange(_bgCurrent);
|
// Keep moving the column to copy to the right
|
||||||
delete _bgCurrent;
|
if (++_translationX == MADS_SCREEN_WIDTH) {
|
||||||
_bgCurrent = _bgSpare;
|
// Surface transition is complete
|
||||||
_bgSpare = nullptr;
|
_spareScreen = nullptr;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ private:
|
|||||||
Common::Array<TextLine> _textLines;
|
Common::Array<TextLine> _textLines;
|
||||||
Common::Point _pan;
|
Common::Point _pan;
|
||||||
int _panSpeed;
|
int _panSpeed;
|
||||||
int _spareScreens[10];
|
MSurface _spareScreens[4];
|
||||||
int _scrollCount;
|
int _scrollCount;
|
||||||
int _lineY;
|
int _lineY;
|
||||||
uint32 _scrollTimeout;
|
uint32 _scrollTimeout;
|
||||||
|
@ -333,7 +333,7 @@ void SceneInfo::loadMadsV1Background(int sceneId, const Common::String &resName,
|
|||||||
|
|
||||||
// Get the ART resource
|
// Get the ART resource
|
||||||
if (sceneFlag) {
|
if (sceneFlag) {
|
||||||
resourceName = Resources::formatName(RESPREFIX_RM, _artFileNum, ".ART");
|
resourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".ART");
|
||||||
} else {
|
} else {
|
||||||
resourceName = "*" + Resources::formatResource(resName, resName);
|
resourceName = "*" + Resources::formatResource(resName, resName);
|
||||||
}
|
}
|
||||||
@ -346,9 +346,27 @@ void SceneInfo::loadMadsV1Background(int sceneId, const Common::String &resName,
|
|||||||
assert(_width == bgSurface.w && _height == bgSurface.h);
|
assert(_width == bgSurface.w && _height == bgSurface.h);
|
||||||
stream = artResource.getItemStream(1);
|
stream = artResource.getItemStream(1);
|
||||||
stream->read(bgSurface.getPixels(), bgSurface.w * bgSurface.h);
|
stream->read(bgSurface.getPixels(), bgSurface.w * bgSurface.h);
|
||||||
|
delete stream;
|
||||||
|
|
||||||
|
if (flags & SCENEFLAG_TRANSLATE) {
|
||||||
|
// Load in the palette and translate it
|
||||||
|
Common::SeekableReadStream *palStream = artResource.getItemStream(0);
|
||||||
|
Common::Array<RGB6> palette;
|
||||||
|
|
||||||
|
palStream->skip(4); // Skip width and height
|
||||||
|
int numColors = palStream->readUint16LE();
|
||||||
|
assert(numColors <= 252);
|
||||||
|
palette.resize(numColors);
|
||||||
|
for (int i = 0; i < numColors; ++i)
|
||||||
|
palette[i].load(palStream);
|
||||||
|
delete palStream;
|
||||||
|
|
||||||
|
// Translate the surface
|
||||||
|
_vm->_palette->_paletteUsage.process(palette, 0);
|
||||||
|
bgSurface.translate(palette);
|
||||||
|
}
|
||||||
|
|
||||||
// Close the ART file
|
// Close the ART file
|
||||||
delete stream;
|
|
||||||
artFile.close();
|
artFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,8 @@ class SpriteSlot;
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
SCENEFLAG_DITHER = 0x01, // Dither to 16 colors
|
SCENEFLAG_DITHER = 0x01, // Dither to 16 colors
|
||||||
SCENEFLAG_LOAD_SHADOW = 0x10 // Load hard shadows
|
SCENEFLAG_LOAD_SHADOW = 0x10, // Load hard shadows
|
||||||
|
SCENEFLAG_TRANSLATE = 0x10000 // Translate palette of loaded background
|
||||||
};
|
};
|
||||||
|
|
||||||
class VerbInit {
|
class VerbInit {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user