aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2007-03-18 10:38:31 +0000
committerNicola Mettifogo2007-03-18 10:38:31 +0000
commit791ad09510422d231b5e57b1a408dc8e993bc41a (patch)
tree94223ced1167f41edb5f9af00fba6a98e6cad503 /engines/parallaction
parent13385a5f2d22870417ec07334ae0836d4fac12a7 (diff)
downloadscummvm-rg350-791ad09510422d231b5e57b1a408dc8e993bc41a.tar.gz
scummvm-rg350-791ad09510422d231b5e57b1a408dc8e993bc41a.tar.bz2
scummvm-rg350-791ad09510422d231b5e57b1a408dc8e993bc41a.zip
Made loadFont return a new Cnv instead of accepting a parameter.
svn-id: r26203
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/disk.cpp5
-rw-r--r--engines/parallaction/disk.h2
-rw-r--r--engines/parallaction/graphics.cpp34
-rw-r--r--engines/parallaction/graphics.h2
4 files changed, 25 insertions, 18 deletions
diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp
index 8e2c2dd8a2..26da5f6967 100644
--- a/engines/parallaction/disk.cpp
+++ b/engines/parallaction/disk.cpp
@@ -313,11 +313,14 @@ StaticCnv* Disk::loadPointer() {
return cnv;
}
-void Disk::loadFont(const char* name, Cnv* cnv) {
+Cnv* Disk::loadFont(const char* name) {
char path[PATH_LEN];
sprintf(path, "%scnv", name);
+
+ Cnv* cnv = new Cnv;
loadExternalCnv(path, cnv);
+ return cnv;
}
// loads character's icons set
diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h
index 730cf559e6..d9163f92e4 100644
--- a/engines/parallaction/disk.h
+++ b/engines/parallaction/disk.h
@@ -109,7 +109,7 @@ public:
Cnv* loadObjects(const char *name);
StaticCnv* loadPointer();
StaticCnv* loadHead(const char* name);
- void loadFont(const char* name, Cnv* cnv);
+ Cnv* loadFont(const char* name);
void loadStatic(const char* name, StaticCnv* cnv);
void loadFrames(const char* name, Cnv* cnv);
void loadSlide(const char *filename);
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index e8d8da16d4..f2344a542c 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -587,9 +587,9 @@ void Gfx::displayString(uint16 x, uint16 y, const char *text) {
for (uint16 i = 0; i < len; i++) {
byte c = mapChar(text[i]);
- tmp._width = _font._width;
- tmp._height = _font._height;
- tmp._data0 = _font._array[c];
+ tmp._width = _font->_width;
+ tmp._height = _font->_height;
+ tmp._data0 = _font->_array[c];
flatBlitCnv(&tmp, x, y, kBitFront);
@@ -609,12 +609,12 @@ void Gfx::displayBalloonString(uint16 x, uint16 y, const char *text, byte color)
byte c = mapChar(text[i]);
uint16 w = _proportionalFont ? _glyphWidths[(int)c] : 8;
- byte *s = _font._array[c];
+ byte *s = _font->_array[c];
byte *d = _buffers[kBitFront] + x + y*SCREEN_WIDTH;
// printf("%i\n", text[i]);
- for (uint16 j = 0; j < _font._height; j++) {
+ for (uint16 j = 0; j < _font->_height; j++) {
for (uint16 k = 0; k < w; k++) {
*d = (*s) ? 1 : color;
d++;
@@ -742,8 +742,10 @@ void Gfx::getStringExtent(char *text, uint16 maxwidth, int16* width, int16* heig
void Gfx::setFont(const char* name) {
- freeCnv(&_font);
- _vm->_disk->loadFont(name, &_font);
+ freeCnv(_font);
+ if (_font) delete _font;
+
+ _font = _vm->_disk->loadFont(name);
}
@@ -782,8 +784,8 @@ void Gfx::makeCnvFromString(StaticCnv *cnv, char *text) {
uint16 len = strlen(text);
- cnv->_width = _font._width * len;
- cnv->_height = _font._height;
+ cnv->_width = _font->_width * len;
+ cnv->_height = _font->_height;
// printf("%i x %i\n", cnv->_width, cnv->_height);
@@ -792,10 +794,10 @@ void Gfx::makeCnvFromString(StaticCnv *cnv, char *text) {
for (uint16 i = 0; i < len; i++) {
byte c = mapChar(text[i]);
- byte *s = _font._array[c];
- byte *d = cnv->_data0 + _font._width * i;
+ byte *s = _font->_array[c];
+ byte *d = cnv->_data0 + _font->_width * i;
- for (uint16 j = 0; j < _font._height; j++) {
+ for (uint16 j = 0; j < _font->_height; j++) {
memcpy(d, s, 8);
s += 8;
@@ -970,8 +972,9 @@ Gfx::Gfx(Parallaction* vm) :
initMouse( 0 );
- _font._count = 0;
- _font._array = NULL;
+ _font = NULL;
+// _font._count = 0;
+// _font._array = NULL;
return;
}
@@ -984,7 +987,8 @@ Gfx::~Gfx() {
free(_buffers[kBitBack]);
free(_buffers[kBit2]);
- freeCnv(&_font);
+ freeCnv(_font);
+ if (_font) delete _font;
return;
}
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index 9301fed35d..1f91386777 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -151,7 +151,7 @@ protected:
static byte _mouseArrow[256];
StaticCnv *_mouseComposedArrow;
- Cnv _font;
+ Cnv *_font;
protected: