mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-15 14:18:37 +00:00
Turned StaticCnv struct into stock Graphics::Surface, and changed all relevant code.
svn-id: r28484
This commit is contained in:
parent
d30c3650a3
commit
d800f33ff1
@ -155,7 +155,7 @@ void Parallaction::freeAnimations() {
|
||||
void jobDisplayAnimations(void *parm, Job *j) {
|
||||
// printf("jobDisplayAnimations()...\n");
|
||||
|
||||
StaticCnv v14;
|
||||
Graphics::Surface v14;
|
||||
|
||||
uint16 _si = 0;
|
||||
|
||||
@ -164,21 +164,20 @@ void jobDisplayAnimations(void *parm, Job *j) {
|
||||
Animation *v18 = *it;
|
||||
|
||||
if ((v18->_flags & kFlagsActive) && ((v18->_flags & kFlagsRemove) == 0)) {
|
||||
v14._width = v18->width();
|
||||
v14._height = v18->height();
|
||||
v14.w = v18->width();
|
||||
v14.h = v18->height();
|
||||
|
||||
int16 frame = CLIP((int)v18->_frame, 0, v18->getFrameNum()-1);
|
||||
|
||||
v14._data0 = v18->getFrameData(frame);
|
||||
// v14._data1 = v18->_cnv->field_8[frame];
|
||||
v14.pixels = v18->getFrameData(frame);
|
||||
|
||||
if (v18->_flags & kFlagsNoMasked)
|
||||
_si = 3;
|
||||
else
|
||||
_si = _vm->_gfx->queryMask(v18->_top + v18->height());
|
||||
|
||||
debugC(9, kDebugLocation, "jobDisplayAnimations(%s, x:%i, y:%i, z:%i, w:%i, h:%i, f:%i/%i, %p)", v18->_label._text, v18->_left, v18->_top, _si, v14._width, v14._height,
|
||||
frame, v18->getFrameNum(), v14._data0);
|
||||
debugC(9, kDebugLocation, "jobDisplayAnimations(%s, x:%i, y:%i, z:%i, w:%i, h:%i, f:%i/%i, %p)", v18->_label._text, v18->_left, v18->_top, _si, v14.w, v14.h,
|
||||
frame, v18->getFrameNum(), v14.pixels);
|
||||
_vm->_gfx->blitCnv(&v14, v18->_left, v18->_top, _si, Gfx::kBitBack);
|
||||
|
||||
}
|
||||
@ -359,7 +358,7 @@ void Parallaction::parseScriptLine(Instruction *inst, Animation *a, LocalVariabl
|
||||
break;
|
||||
|
||||
case INST_SET: // set
|
||||
// WORKAROUND: At least one script (balzo.script) in Amiga versions didn't declare
|
||||
// WORKAROUND: At least one script (balzo.script) in Amiga versions didn't declare
|
||||
// local variables before using them, thus leading to crashes. The line launching the
|
||||
// script was commented out on Dos version. This workaround enables the engine
|
||||
// to dynamically add a local variable when it is encountered the first time in
|
||||
@ -477,7 +476,7 @@ void jobRunScripts(void *parm, Job *j) {
|
||||
|
||||
static uint16 modCounter = 0;
|
||||
|
||||
StaticCnv v18;
|
||||
Graphics::Surface v18;
|
||||
|
||||
for (AnimationList::iterator it = _vm->_animations.begin(); it != _vm->_animations.end(); it++) {
|
||||
|
||||
@ -565,10 +564,9 @@ void jobRunScripts(void *parm, Job *j) {
|
||||
break;
|
||||
|
||||
case INST_PUT: // put
|
||||
v18._width = (*inst)->_opBase._a->width();
|
||||
v18._height = (*inst)->_opBase._a->height();
|
||||
v18._data0 = (*inst)->_opBase._a->getFrameData((*inst)->_opBase._a->_frame);
|
||||
v18._data1 = NULL; // (*inst)->_opBase._a->_cnv.field_8[(*inst)->_opBase._a->_frame];
|
||||
v18.w = (*inst)->_opBase._a->width();
|
||||
v18.h = (*inst)->_opBase._a->height();
|
||||
v18.pixels = (*inst)->_opBase._a->getFrameData((*inst)->_opBase._a->_frame);
|
||||
|
||||
if ((*inst)->_flags & kInstMaskedPut) {
|
||||
uint16 _si = _vm->_gfx->queryMask((*inst)->_opB._value);
|
||||
|
@ -46,7 +46,7 @@ namespace Parallaction {
|
||||
#define ANSWER_CHARACTER_X 10
|
||||
#define ANSWER_CHARACTER_Y 80
|
||||
|
||||
int16 selectAnswer(Question *q, StaticCnv*);
|
||||
int16 selectAnswer(Question *q, Graphics::Surface*);
|
||||
int16 getHoverAnswer(int16 x, int16 y, Question *q);
|
||||
|
||||
int16 _answerBalloonX[10] = { 80, 120, 150, 150, 150, 0, 0, 0, 0, 0 };
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "parallaction/defs.h"
|
||||
#include "common/file.h"
|
||||
#include "graphics/surface.h"
|
||||
|
||||
namespace Parallaction {
|
||||
|
||||
@ -38,8 +39,6 @@ class Script;
|
||||
class Font;
|
||||
|
||||
struct Cnv;
|
||||
struct StaticCnv;
|
||||
|
||||
|
||||
class Disk {
|
||||
|
||||
@ -54,10 +53,10 @@ public:
|
||||
virtual Script* loadScript(const char* name) = 0;
|
||||
virtual Cnv* loadTalk(const char *name) = 0;
|
||||
virtual Cnv* loadObjects(const char *name) = 0;
|
||||
virtual StaticCnv* loadPointer() = 0;
|
||||
virtual StaticCnv* loadHead(const char* name) = 0;
|
||||
virtual Graphics::Surface* loadPointer() = 0;
|
||||
virtual Graphics::Surface* loadHead(const char* name) = 0;
|
||||
virtual Font* loadFont(const char* name) = 0;
|
||||
virtual StaticCnv* loadStatic(const char* name) = 0;
|
||||
virtual Graphics::Surface* loadStatic(const char* name) = 0;
|
||||
virtual Cnv* loadFrames(const char* name) = 0;
|
||||
virtual void loadSlide(const char *filename) = 0;
|
||||
virtual void loadScenery(const char* background, const char* mask) = 0;
|
||||
@ -128,7 +127,7 @@ private:
|
||||
void unpackBackground(Common::ReadStream *stream, byte *screen, byte *mask, byte *path);
|
||||
Cnv* loadExternalCnv(const char *filename);
|
||||
Cnv* loadCnv(const char *filename);
|
||||
StaticCnv *loadExternalStaticCnv(const char *filename);
|
||||
Graphics::Surface *loadExternalStaticCnv(const char *filename);
|
||||
void loadBackground(const char *filename);
|
||||
void loadMaskAndPath(const char *name);
|
||||
void parseDepths(Common::SeekableReadStream &stream);
|
||||
@ -146,10 +145,10 @@ public:
|
||||
Script* loadScript(const char* name);
|
||||
Cnv* loadTalk(const char *name);
|
||||
Cnv* loadObjects(const char *name);
|
||||
StaticCnv* loadPointer();
|
||||
StaticCnv* loadHead(const char* name);
|
||||
Graphics::Surface* loadPointer();
|
||||
Graphics::Surface* loadHead(const char* name);
|
||||
Font* loadFont(const char* name);
|
||||
StaticCnv* loadStatic(const char* name);
|
||||
Graphics::Surface* loadStatic(const char* name);
|
||||
Cnv* loadFrames(const char* name);
|
||||
void loadSlide(const char *filename);
|
||||
void loadScenery(const char* background, const char* mask);
|
||||
@ -162,7 +161,7 @@ class AmigaDisk_ns : public Disk_ns {
|
||||
|
||||
protected:
|
||||
Cnv* makeCnv(Common::SeekableReadStream &stream);
|
||||
StaticCnv* makeStaticCnv(Common::SeekableReadStream &stream);
|
||||
Graphics::Surface* makeStaticCnv(Common::SeekableReadStream &stream);
|
||||
void patchFrame(byte *dst, byte *dlta, uint16 bytesPerPlane, uint16 height);
|
||||
void unpackFrame(byte *dst, byte *src, uint16 planeSize);
|
||||
void unpackBitmap(byte *dst, byte *src, uint16 numFrames, uint16 bytesPerPlane, uint16 height);
|
||||
@ -180,10 +179,10 @@ public:
|
||||
Script* loadScript(const char* name);
|
||||
Cnv* loadTalk(const char *name);
|
||||
Cnv* loadObjects(const char *name);
|
||||
StaticCnv* loadPointer();
|
||||
StaticCnv* loadHead(const char* name);
|
||||
Graphics::Surface* loadPointer();
|
||||
Graphics::Surface* loadHead(const char* name);
|
||||
Font* loadFont(const char* name);
|
||||
StaticCnv* loadStatic(const char* name);
|
||||
Graphics::Surface* loadStatic(const char* name);
|
||||
Cnv* loadFrames(const char* name);
|
||||
void loadSlide(const char *filename);
|
||||
void loadScenery(const char* background, const char* mask);
|
||||
@ -214,10 +213,10 @@ public:
|
||||
Script* loadScript(const char* name);
|
||||
Cnv* loadTalk(const char *name);
|
||||
Cnv* loadObjects(const char *name);
|
||||
StaticCnv* loadPointer();
|
||||
StaticCnv* loadHead(const char* name);
|
||||
Graphics::Surface* loadPointer();
|
||||
Graphics::Surface* loadHead(const char* name);
|
||||
Font* loadFont(const char* name);
|
||||
StaticCnv* loadStatic(const char* name);
|
||||
Graphics::Surface* loadStatic(const char* name);
|
||||
Cnv* loadFrames(const char* name);
|
||||
void loadSlide(const char *filename);
|
||||
void loadScenery(const char* background, const char* mask);
|
||||
|
@ -69,13 +69,13 @@ Script* DosDisk_br::loadScript(const char* name) {
|
||||
}
|
||||
|
||||
// there are no Head resources in Big Red Adventure
|
||||
StaticCnv* DosDisk_br::loadHead(const char* name) {
|
||||
Graphics::Surface* DosDisk_br::loadHead(const char* name) {
|
||||
debugC(5, kDebugDisk, "DosDisk_br::loadHead");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
StaticCnv* DosDisk_br::loadPointer() {
|
||||
Graphics::Surface* DosDisk_br::loadPointer() {
|
||||
debugC(5, kDebugDisk, "DosDisk_br::loadPointer");
|
||||
return 0;
|
||||
}
|
||||
@ -93,7 +93,7 @@ Cnv* DosDisk_br::loadObjects(const char *name) {
|
||||
}
|
||||
|
||||
|
||||
StaticCnv* DosDisk_br::loadStatic(const char* name) {
|
||||
Graphics::Surface* DosDisk_br::loadStatic(const char* name) {
|
||||
debugC(5, kDebugDisk, "DosDisk_br::loadStatic");
|
||||
return 0;
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ Cnv* DosDisk_ns::loadExternalCnv(const char *filename) {
|
||||
return new Cnv(numFrames, width, height, data);
|
||||
}
|
||||
|
||||
StaticCnv *DosDisk_ns::loadExternalStaticCnv(const char *filename) {
|
||||
Graphics::Surface *DosDisk_ns::loadExternalStaticCnv(const char *filename) {
|
||||
|
||||
char path[PATH_LEN];
|
||||
|
||||
@ -356,16 +356,14 @@ StaticCnv *DosDisk_ns::loadExternalStaticCnv(const char *filename) {
|
||||
if (!stream.open(path))
|
||||
errorFileNotFound(path);
|
||||
|
||||
StaticCnv *cnv = new StaticCnv;
|
||||
Graphics::Surface *cnv = new Graphics::Surface;
|
||||
|
||||
stream.skip(1);
|
||||
cnv->_width = stream.readByte();
|
||||
cnv->_height = stream.readByte();
|
||||
byte w = stream.readByte();
|
||||
byte h = stream.readByte();
|
||||
|
||||
uint16 size = cnv->_width*cnv->_height;
|
||||
|
||||
cnv->_data0 = (byte*)malloc(size);
|
||||
stream.read(cnv->_data0, size);
|
||||
cnv->create(w, h, 1);
|
||||
stream.read(cnv->pixels, w*h);
|
||||
|
||||
return cnv;
|
||||
}
|
||||
@ -462,7 +460,7 @@ Script* DosDisk_ns::loadScript(const char* name) {
|
||||
return new Script(new DummyArchiveStream(_resArchive), true);
|
||||
}
|
||||
|
||||
StaticCnv* DosDisk_ns::loadHead(const char* name) {
|
||||
Graphics::Surface* DosDisk_ns::loadHead(const char* name) {
|
||||
|
||||
char path[PATH_LEN];
|
||||
|
||||
@ -477,7 +475,7 @@ StaticCnv* DosDisk_ns::loadHead(const char* name) {
|
||||
}
|
||||
|
||||
|
||||
StaticCnv* DosDisk_ns::loadPointer() {
|
||||
Graphics::Surface* DosDisk_ns::loadPointer() {
|
||||
return loadExternalStaticCnv("pointer");
|
||||
}
|
||||
|
||||
@ -501,7 +499,7 @@ Cnv* DosDisk_ns::loadObjects(const char *name) {
|
||||
}
|
||||
|
||||
|
||||
StaticCnv* DosDisk_ns::loadStatic(const char* name) {
|
||||
Graphics::Surface* DosDisk_ns::loadStatic(const char* name) {
|
||||
|
||||
char path[PATH_LEN];
|
||||
|
||||
@ -512,17 +510,16 @@ StaticCnv* DosDisk_ns::loadStatic(const char* name) {
|
||||
errorFileNotFound(path);
|
||||
}
|
||||
|
||||
StaticCnv* cnv = new StaticCnv;
|
||||
Graphics::Surface* cnv = new Graphics::Surface;
|
||||
|
||||
_resArchive.skip(1);
|
||||
cnv->_width = _resArchive.readByte();
|
||||
cnv->_height = _resArchive.readByte();
|
||||
byte w = _resArchive.readByte();
|
||||
byte h = _resArchive.readByte();
|
||||
|
||||
uint16 size = cnv->_width*cnv->_height;
|
||||
cnv->_data0 = (byte*)malloc(size);
|
||||
cnv->create(w, h, 1);
|
||||
|
||||
Graphics::PackBitsReadStream decoder(_resArchive);
|
||||
decoder.read(cnv->_data0, size);
|
||||
decoder.read(cnv->pixels, w*h);
|
||||
|
||||
return cnv;
|
||||
}
|
||||
@ -977,7 +974,7 @@ void AmigaDisk_ns::unpackBitmap(byte *dst, byte *src, uint16 numFrames, uint16 b
|
||||
|
||||
}
|
||||
|
||||
StaticCnv* AmigaDisk_ns::makeStaticCnv(Common::SeekableReadStream &stream) {
|
||||
Graphics::Surface* AmigaDisk_ns::makeStaticCnv(Common::SeekableReadStream &stream) {
|
||||
|
||||
stream.skip(1);
|
||||
uint16 width = stream.readByte();
|
||||
@ -992,18 +989,14 @@ StaticCnv* AmigaDisk_ns::makeStaticCnv(Common::SeekableReadStream &stream) {
|
||||
stream.read(buf, rawsize);
|
||||
|
||||
uint32 decsize = width * height;
|
||||
byte *data = (byte*)calloc(decsize, 1);
|
||||
|
||||
unpackBitmap(data, buf, 1, bytesPerPlane, height);
|
||||
Graphics::Surface *cnv = new Graphics::Surface;
|
||||
cnv->create(width, height, 1);
|
||||
|
||||
unpackBitmap((byte*)cnv->pixels, buf, 1, bytesPerPlane, height);
|
||||
|
||||
free(buf);
|
||||
|
||||
StaticCnv *cnv = new StaticCnv();
|
||||
cnv->_width = width;
|
||||
cnv->_height = height;
|
||||
cnv->_data0 = data;
|
||||
cnv->_data1 = NULL;
|
||||
|
||||
return cnv;
|
||||
}
|
||||
|
||||
@ -1066,7 +1059,7 @@ Script* AmigaDisk_ns::loadScript(const char* name) {
|
||||
return new Script(new DummyArchiveStream(_resArchive), true);
|
||||
}
|
||||
|
||||
StaticCnv* AmigaDisk_ns::loadPointer() {
|
||||
Graphics::Surface* AmigaDisk_ns::loadPointer() {
|
||||
debugC(1, kDebugDisk, "AmigaDisk_ns::loadPointer");
|
||||
|
||||
Common::File stream;
|
||||
@ -1076,11 +1069,11 @@ StaticCnv* AmigaDisk_ns::loadPointer() {
|
||||
return makeStaticCnv(stream);
|
||||
}
|
||||
|
||||
StaticCnv* AmigaDisk_ns::loadStatic(const char* name) {
|
||||
Graphics::Surface* AmigaDisk_ns::loadStatic(const char* name) {
|
||||
debugC(1, kDebugDisk, "AmigaDisk_ns::loadStatic '%s'", name);
|
||||
|
||||
Common::SeekableReadStream *s = openArchivedFile(name, true);
|
||||
StaticCnv *cnv = makeStaticCnv(*s);
|
||||
Graphics::Surface *cnv = makeStaticCnv(*s);
|
||||
|
||||
delete s;
|
||||
|
||||
@ -1325,14 +1318,14 @@ Cnv* AmigaDisk_ns::loadFrames(const char* name) {
|
||||
return cnv;
|
||||
}
|
||||
|
||||
StaticCnv* AmigaDisk_ns::loadHead(const char* name) {
|
||||
Graphics::Surface* AmigaDisk_ns::loadHead(const char* name) {
|
||||
debugC(1, kDebugDisk, "AmigaDisk_ns::loadHead '%s'", name);
|
||||
|
||||
char path[PATH_LEN];
|
||||
sprintf(path, "%s.head", name);
|
||||
|
||||
Common::SeekableReadStream *s = openArchivedFile(path, true);
|
||||
StaticCnv *cnv = makeStaticCnv(*s);
|
||||
Graphics::Surface *cnv = makeStaticCnv(*s);
|
||||
|
||||
delete s;
|
||||
|
||||
|
@ -399,7 +399,7 @@ void jobDisplayLabel(void *parm, Job *j) {
|
||||
Label *label = (Label*)parm;
|
||||
debugC(9, kDebugJobs, "jobDisplayLabel (%p)", (const void*) label);
|
||||
|
||||
if (label->_cnv._width == 0)
|
||||
if (label->_cnv.w == 0)
|
||||
return;
|
||||
_vm->_gfx->flatBlitCnv(&label->_cnv, _vm->_gfx->_labelPosition[0].x, _vm->_gfx->_labelPosition[0].y, Gfx::kBitBack);
|
||||
|
||||
@ -414,20 +414,20 @@ void jobEraseLabel(void *parm, Job *j) {
|
||||
int16 _si, _di;
|
||||
|
||||
if (_vm->_activeItem._id != 0) {
|
||||
_si = _vm->_mousePos.x + 16 - label->_cnv._width/2;
|
||||
_si = _vm->_mousePos.x + 16 - label->_cnv.w/2;
|
||||
_di = _vm->_mousePos.y + 34;
|
||||
} else {
|
||||
_si = _vm->_mousePos.x + 8 - label->_cnv._width/2;
|
||||
_si = _vm->_mousePos.x + 8 - label->_cnv.w/2;
|
||||
_di = _vm->_mousePos.y + 21;
|
||||
}
|
||||
|
||||
if (_si < 0) _si = 0;
|
||||
if (_di > 190) _di = 190;
|
||||
|
||||
if (label->_cnv._width + _si > _vm->_screenWidth)
|
||||
_si = _vm->_screenWidth - label->_cnv._width;
|
||||
if (label->_cnv.w + _si > _vm->_screenWidth)
|
||||
_si = _vm->_screenWidth - label->_cnv.w;
|
||||
|
||||
Common::Rect r(label->_cnv._width, label->_cnv._height);
|
||||
Common::Rect r(label->_cnv.w, label->_cnv.h);
|
||||
r.moveTo(_vm->_gfx->_labelPosition[1]);
|
||||
_vm->_gfx->restoreBackground(r);
|
||||
|
||||
@ -463,7 +463,7 @@ void Gfx::setMousePointer(int16 index) {
|
||||
|
||||
} else {
|
||||
// inventory item pointer
|
||||
byte *v8 = _mouseComposedArrow->_data0;
|
||||
byte *v8 = (byte*)_mouseComposedArrow->pixels;
|
||||
|
||||
// FIXME: destination offseting is not clear
|
||||
byte* s = _vm->_char._objs->getFramePtr(getInventoryItemIndex(index));
|
||||
@ -490,30 +490,29 @@ void Gfx::setMousePointer(int16 index) {
|
||||
//
|
||||
void Gfx::flatBlitCnv(Cnv *cnv, uint16 frame, int16 x, int16 y, Gfx::Buffers buffer) {
|
||||
|
||||
StaticCnv scnv;
|
||||
Graphics::Surface scnv;
|
||||
|
||||
scnv._width = cnv->_width;
|
||||
scnv._height = cnv->_height;
|
||||
scnv._data0 = cnv->getFramePtr(frame);
|
||||
scnv._data1 = NULL; // ->field_8[v60->_mood & 0xF];
|
||||
scnv.w = cnv->_width;
|
||||
scnv.h = cnv->_height;
|
||||
scnv.pixels = cnv->getFramePtr(frame);
|
||||
|
||||
flatBlitCnv(&scnv, x, y, buffer);
|
||||
}
|
||||
|
||||
void Gfx::flatBlitCnv(StaticCnv *cnv, int16 x, int16 y, Gfx::Buffers buffer) {
|
||||
Common::Rect r(cnv->_width, cnv->_height);
|
||||
void Gfx::flatBlitCnv(Graphics::Surface *cnv, int16 x, int16 y, Gfx::Buffers buffer) {
|
||||
Common::Rect r(cnv->w, cnv->h);
|
||||
r.moveTo(x, y);
|
||||
|
||||
flatBlit(r, cnv->_data0, buffer);
|
||||
flatBlit(r, (byte*)cnv->pixels, buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void Gfx::blitCnv(StaticCnv *cnv, int16 x, int16 y, uint16 z, Gfx::Buffers buffer) {
|
||||
Common::Rect r(cnv->_width, cnv->_height);
|
||||
void Gfx::blitCnv(Graphics::Surface *cnv, int16 x, int16 y, uint16 z, Gfx::Buffers buffer) {
|
||||
Common::Rect r(cnv->w, cnv->h);
|
||||
r.moveTo(x, y);
|
||||
|
||||
blit(r, z, cnv->_data0, buffer);
|
||||
blit(r, z, (byte*)cnv->pixels, buffer);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -534,14 +533,14 @@ void Gfx::backupDoorBackground(DoorData *data, int16 x, int16 y) {
|
||||
|
||||
void Gfx::backupGetBackground(GetData *data, int16 x, int16 y) {
|
||||
|
||||
byte *t = data->_cnv->_data0;
|
||||
byte *t = (byte*)data->_cnv->pixels;
|
||||
byte *s = (byte*)_buffers[kBitBack]->getBasePtr(x, y);
|
||||
byte *d = data->_backup;
|
||||
|
||||
uint pitch = _vm->_screenWidth - data->_cnv->_width;
|
||||
uint pitch = _vm->_screenWidth - data->_cnv->w;
|
||||
|
||||
for (uint16 i = 0; i < data->_cnv->_height ; i++) {
|
||||
for (uint16 j = 0; j < data->_cnv->_width ; j++) {
|
||||
for (uint16 i = 0; i < data->_cnv->h ; i++) {
|
||||
for (uint16 j = 0; j < data->_cnv->w ; j++) {
|
||||
*d = (*t) ? *s : 0;
|
||||
|
||||
d++;
|
||||
@ -558,9 +557,9 @@ void Gfx::backupGetBackground(GetData *data, int16 x, int16 y) {
|
||||
//
|
||||
// restores background according to specified frame
|
||||
//
|
||||
void Gfx::restoreDoorBackground(StaticCnv *cnv, const Common::Rect& r, byte* background) {
|
||||
void Gfx::restoreDoorBackground(Graphics::Surface *cnv, const Common::Rect& r, byte* background) {
|
||||
|
||||
byte *t = cnv->_data0;
|
||||
byte *t = (byte*)cnv->pixels;
|
||||
byte *s = background;
|
||||
byte *d0 = (byte*)_buffers[kBitBack]->getBasePtr(r.left, r.top);
|
||||
byte *d1 = (byte*)_buffers[kBit2]->getBasePtr(r.left, r.top);
|
||||
@ -594,12 +593,11 @@ void Gfx::restoreDoorBackground(StaticCnv *cnv, const Common::Rect& r, byte* bac
|
||||
//
|
||||
void Gfx::restoreGetBackground(const Common::Rect& r, byte *data) {
|
||||
|
||||
StaticCnv cnv;
|
||||
Graphics::Surface cnv;
|
||||
|
||||
cnv._data0 = data;
|
||||
cnv._data1 = NULL;
|
||||
cnv._width = r.width();
|
||||
cnv._height = r.height();
|
||||
cnv.w = r.width();
|
||||
cnv.h = r.height();
|
||||
cnv.pixels = data;
|
||||
|
||||
flatBlitCnv(&cnv, r.left, r.top, kBitBack);
|
||||
flatBlitCnv(&cnv, r.left, r.top, kBit2);
|
||||
@ -607,28 +605,22 @@ void Gfx::restoreGetBackground(const Common::Rect& r, byte *data) {
|
||||
return;
|
||||
}
|
||||
|
||||
void Gfx::makeCnvFromString(StaticCnv *cnv, char *text) {
|
||||
void Gfx::makeCnvFromString(Graphics::Surface *cnv, char *text) {
|
||||
assert(_font == _fonts[kFontLabel]);
|
||||
|
||||
if (_vm->getPlatform() == Common::kPlatformAmiga) {
|
||||
cnv->_width = _font->getStringWidth(text) + 16;
|
||||
cnv->_height = 10;
|
||||
cnv->_data0 = (byte*)malloc(cnv->_width * cnv->_height);
|
||||
memset(cnv->_data0, 0, cnv->_width * cnv->_height);
|
||||
cnv->create(_font->getStringWidth(text) + 16, 10, 1);
|
||||
|
||||
_font->setColor(7);
|
||||
_font->drawString(cnv->_data0 + 1, cnv->_width, text);
|
||||
_font->drawString(cnv->_data0 + 1 + cnv->_width * 2, cnv->_width, text);
|
||||
_font->drawString(cnv->_data0 + cnv->_width, cnv->_width, text);
|
||||
_font->drawString(cnv->_data0 + 2 + cnv->_width, cnv->_width, text);
|
||||
_font->drawString((byte*)cnv->pixels + 1, cnv->w, text);
|
||||
_font->drawString((byte*)cnv->pixels + 1 + cnv->w * 2, cnv->w, text);
|
||||
_font->drawString((byte*)cnv->pixels + cnv->w, cnv->w, text);
|
||||
_font->drawString((byte*)cnv->pixels + 2 + cnv->w, cnv->w, text);
|
||||
_font->setColor(1);
|
||||
_font->drawString(cnv->_data0 + 1 + cnv->_width, cnv->_width, text);
|
||||
_font->drawString((byte*)cnv->pixels + 1 + cnv->w, cnv->w, text);
|
||||
} else {
|
||||
cnv->_width = _font->getStringWidth(text);
|
||||
cnv->_height = _font->height();
|
||||
cnv->_data0 = (byte*)malloc(cnv->_width * cnv->_height);
|
||||
memset(cnv->_data0, 0, cnv->_width * cnv->_height);
|
||||
_font->drawString(cnv->_data0, cnv->_width, text);
|
||||
cnv->create(_font->getStringWidth(text), _font->height(), 1);
|
||||
_font->drawString((byte*)cnv->pixels, cnv->w, text);
|
||||
}
|
||||
|
||||
}
|
||||
@ -758,18 +750,6 @@ void Gfx::restoreBackground(const Common::Rect& r) {
|
||||
return;
|
||||
}
|
||||
|
||||
void Gfx::freeStaticCnv(StaticCnv *cnv) {
|
||||
|
||||
if (!cnv) return;
|
||||
|
||||
if (!cnv || !cnv->_data0) return;
|
||||
free(cnv->_data0);
|
||||
cnv->_data0 = NULL;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Gfx::setBackground(Graphics::Surface *surface) {
|
||||
if (_buffers[kBit2]) {
|
||||
@ -916,7 +896,6 @@ Gfx::~Gfx() {
|
||||
delete _fonts[kFontLabel];
|
||||
delete _fonts[kFontMenu];
|
||||
|
||||
freeStaticCnv(_mouseComposedArrow);
|
||||
delete _mouseComposedArrow;
|
||||
|
||||
return;
|
||||
|
@ -91,18 +91,6 @@ public:
|
||||
|
||||
};
|
||||
|
||||
struct StaticCnv {
|
||||
uint16 _width; //
|
||||
uint16 _height; //
|
||||
byte* _data0; // bitmap
|
||||
byte* _data1; // unused
|
||||
|
||||
StaticCnv() {
|
||||
_width = _height = 0;
|
||||
_data0 = _data1 = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
struct Cnv {
|
||||
uint16 _count; // # of frames
|
||||
uint16 _width; //
|
||||
@ -207,15 +195,15 @@ public:
|
||||
bool displayWrappedString(char *text, uint16 x, uint16 y, byte color, int16 wrapwidth = -1);
|
||||
uint16 getStringWidth(const char *text);
|
||||
void getStringExtent(char *text, uint16 maxwidth, int16* width, int16* height);
|
||||
void makeCnvFromString(StaticCnv *cnv, char *text);
|
||||
void makeCnvFromString(Graphics::Surface *cnv, char *text);
|
||||
|
||||
// cut/paste
|
||||
void flatBlitCnv(StaticCnv *cnv, int16 x, int16 y, Gfx::Buffers buffer);
|
||||
void flatBlitCnv(Graphics::Surface *cnv, int16 x, int16 y, Gfx::Buffers buffer);
|
||||
void flatBlitCnv(Cnv *cnv, uint16 frame, int16 x, int16 y, Gfx::Buffers buffer);
|
||||
void blitCnv(StaticCnv *cnv, int16 x, int16 y, uint16 z, Gfx::Buffers buffer);
|
||||
void blitCnv(Graphics::Surface *cnv, int16 x, int16 y, uint16 z, Gfx::Buffers buffer);
|
||||
void restoreBackground(const Common::Rect& r);
|
||||
void backupDoorBackground(DoorData *data, int16 x, int16 y);
|
||||
void restoreDoorBackground(StaticCnv *cnv, const Common::Rect& r, byte* background);
|
||||
void restoreDoorBackground(Graphics::Surface *cnv, const Common::Rect& r, byte* background);
|
||||
void backupGetBackground(GetData *data, int16 x, int16 y);
|
||||
void restoreGetBackground(const Common::Rect& r, byte *data);
|
||||
|
||||
@ -242,7 +230,6 @@ public:
|
||||
void setHalfbriteMode(bool enable);
|
||||
|
||||
// misc
|
||||
void freeStaticCnv(StaticCnv *cnv);
|
||||
int16 queryMask(int16 v);
|
||||
void setMousePointer(int16 index);
|
||||
void setFont(Fonts name);
|
||||
@ -267,7 +254,7 @@ protected:
|
||||
Graphics::Surface *_buffers[NUM_BUFFERS];
|
||||
MaskBuffer *_depthMask;
|
||||
static byte _mouseArrow[256];
|
||||
StaticCnv *_mouseComposedArrow;
|
||||
Graphics::Surface *_mouseComposedArrow;
|
||||
Font *_font;
|
||||
Font *_fonts[3];
|
||||
bool _halfbrite;
|
||||
@ -287,3 +274,4 @@ protected:
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -343,11 +343,8 @@ void Menu::selectCharacter() {
|
||||
|
||||
uint16 _donna_points, _dino_points, _dough_points;
|
||||
|
||||
StaticCnv v14;
|
||||
|
||||
v14._data0 = (byte*)malloc(BLOCK_WIDTH*BLOCK_HEIGHT);
|
||||
v14._width = BLOCK_WIDTH;
|
||||
v14._height = BLOCK_HEIGHT;
|
||||
Graphics::Surface v14;
|
||||
v14.create(BLOCK_WIDTH, BLOCK_HEIGHT, 1);
|
||||
|
||||
_vm->changeCursor(kCursorArrow);
|
||||
_vm->_soundMan->stopMusic();
|
||||
@ -383,7 +380,7 @@ void Menu::selectCharacter() {
|
||||
Common::Rect r;
|
||||
int _si = getSelectedBlock(_vm->_mousePos, r);
|
||||
if (_si != -1) {
|
||||
_vm->_gfx->grabRect(v14._data0, r, Gfx::kBitFront, BLOCK_WIDTH);
|
||||
_vm->_gfx->grabRect((byte*)v14.pixels, r, Gfx::kBitFront, BLOCK_WIDTH);
|
||||
_vm->_gfx->flatBlitCnv(&v14, _di * SLOT_WIDTH + SLOT_X, SLOT_Y, Gfx::kBitFront);
|
||||
// beep();
|
||||
|
||||
@ -435,7 +432,7 @@ void Menu::selectCharacter() {
|
||||
|
||||
_engineFlags |= kEngineChangeLocation;
|
||||
|
||||
free(v14._data0);
|
||||
v14.free();
|
||||
|
||||
return;
|
||||
|
||||
|
@ -701,9 +701,7 @@ void Parallaction::freeCharacter() {
|
||||
delete _char._talk;
|
||||
_char._talk = NULL;
|
||||
|
||||
_gfx->freeStaticCnv(_char._head);
|
||||
if (_char._head)
|
||||
delete _char._head;
|
||||
delete _char._head;
|
||||
_char._head = NULL;
|
||||
|
||||
if (_char._objs)
|
||||
|
@ -238,7 +238,7 @@ struct Location {
|
||||
|
||||
struct Character {
|
||||
Animation _ani;
|
||||
StaticCnv *_head;
|
||||
Graphics::Surface *_head;
|
||||
Cnv *_talk;
|
||||
Cnv *_objs;
|
||||
PathBuilder _builder;
|
||||
@ -256,7 +256,7 @@ struct Character {
|
||||
_ani._frame = 0;
|
||||
_ani._flags = kFlagsActive | kFlagsNoName;
|
||||
_ani._type = kZoneYou;
|
||||
_ani._label._cnv._data0 = NULL;
|
||||
_ani._label._cnv.pixels = NULL;
|
||||
_ani._label._text = strdup("yourself");
|
||||
}
|
||||
|
||||
|
@ -236,7 +236,7 @@ void Parallaction::parseZoneTypeBlock(Script &script, Zone *z) {
|
||||
if (!scumm_stricmp(_tokens[0], "file")) {
|
||||
strcpy(vC8, _tokens[1]);
|
||||
u->get->_cnv = _disk->loadStatic(vC8);
|
||||
u->get->_backup = (byte*)malloc(u->get->_cnv->_width*u->get->_cnv->_height);
|
||||
u->get->_backup = (byte*)malloc(u->get->_cnv->w*u->get->_cnv->h);
|
||||
|
||||
if ((z->_flags & kFlagsRemove) == 0) {
|
||||
_gfx->backupGetBackground(u->get, z->_left, z->_top);
|
||||
@ -338,8 +338,7 @@ void Parallaction::displayItemComment(ExamineData *data) {
|
||||
char v68[PATH_LEN];
|
||||
strcpy(v68, data->_filename);
|
||||
data->_cnv = _disk->loadStatic(v68);
|
||||
_gfx->flatBlitCnv(data->_cnv, 140, (_screenHeight - data->_cnv->_height)/2, Gfx::kBitFront);
|
||||
_gfx->freeStaticCnv(data->_cnv);
|
||||
_gfx->flatBlitCnv(data->_cnv, 140, (_screenHeight - data->_cnv->h)/2, Gfx::kBitFront);
|
||||
delete data->_cnv;
|
||||
|
||||
int16 v6A = 0, v6C = 0;
|
||||
@ -421,16 +420,16 @@ void jobToggleDoor(void *parm, Job *j) {
|
||||
|
||||
Zone *z = (Zone*)parm;
|
||||
|
||||
StaticCnv v14;
|
||||
Graphics::Surface v14;
|
||||
|
||||
if (z->u.door->_cnv) {
|
||||
Common::Rect r(z->_left, z->_top, z->_left+z->u.door->_cnv->_width, z->_top+z->u.door->_cnv->_height);
|
||||
|
||||
uint16 _ax = (z->_flags & kFlagsClosed ? 1 : 0);
|
||||
|
||||
v14._width = z->u.door->_cnv->_width;
|
||||
v14._height = z->u.door->_cnv->_height;
|
||||
v14._data0 = z->u.door->_cnv->getFramePtr(_ax);
|
||||
v14.w = z->u.door->_cnv->_width;
|
||||
v14.h = z->u.door->_cnv->_height;
|
||||
v14.pixels = z->u.door->_cnv->getFramePtr(_ax);
|
||||
|
||||
_vm->_gfx->restoreDoorBackground(&v14, r, z->u.door->_background);
|
||||
|
||||
@ -470,7 +469,7 @@ void jobRemovePickedItem(void *parm, Job *j) {
|
||||
static uint16 count = 0;
|
||||
|
||||
if (z->u.get->_cnv) {
|
||||
Common::Rect r(z->_left, z->_top, z->_left + z->u.get->_cnv->_width, z->_top + z->u.get->_cnv->_height);
|
||||
Common::Rect r(z->_left, z->_top, z->_left + z->u.get->_cnv->w, z->_top + z->u.get->_cnv->h);
|
||||
|
||||
_vm->_gfx->restoreGetBackground(r, z->u.get->_backup);
|
||||
}
|
||||
@ -635,7 +634,6 @@ Zone::~Zone() {
|
||||
|
||||
case kZoneGet:
|
||||
free(u.get->_backup);
|
||||
_vm->_gfx->freeStaticCnv(u.get->_cnv);
|
||||
if (u.get->_cnv)
|
||||
delete u.get->_cnv;
|
||||
delete u.get;
|
||||
@ -681,7 +679,7 @@ Label::Label() {
|
||||
}
|
||||
|
||||
Label::~Label() {
|
||||
_vm->_gfx->freeStaticCnv(&_cnv);
|
||||
_cnv.free();
|
||||
if (_text)
|
||||
free(_text);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ struct Dialogue {
|
||||
|
||||
struct GetData { // size = 24
|
||||
uint32 _icon;
|
||||
StaticCnv *_cnv;
|
||||
Graphics::Surface *_cnv;
|
||||
byte *_backup;
|
||||
uint16 field_14; // unused
|
||||
uint16 field_16; // unused
|
||||
@ -125,7 +125,7 @@ struct SpeakData { // size = 36
|
||||
}
|
||||
};
|
||||
struct ExamineData { // size = 28
|
||||
StaticCnv *_cnv;
|
||||
Graphics::Surface *_cnv;
|
||||
uint16 _opBase; // unused
|
||||
uint16 field_12; // unused
|
||||
char* _description;
|
||||
@ -193,7 +193,7 @@ struct TypeData {
|
||||
|
||||
struct Label {
|
||||
char* _text;
|
||||
StaticCnv _cnv;
|
||||
Graphics::Surface _cnv;
|
||||
|
||||
Label();
|
||||
~Label();
|
||||
|
Loading…
Reference in New Issue
Block a user