aboutsummaryrefslogtreecommitdiff
path: root/scumm
diff options
context:
space:
mode:
authorMax Horn2004-10-09 00:47:47 +0000
committerMax Horn2004-10-09 00:47:47 +0000
commit0d746b05fc4dbf4ef2e2530e6ad95b69bcdfe58d (patch)
tree90a2c8ead4e8bc6e7e3966ee270678d414b9f997 /scumm
parenta904bfc9cfbc4fb2e018dbaf61c2af802e5867a5 (diff)
downloadscummvm-rg350-0d746b05fc4dbf4ef2e2530e6ad95b69bcdfe58d.tar.gz
scummvm-rg350-0d746b05fc4dbf4ef2e2530e6ad95b69bcdfe58d.tar.bz2
scummvm-rg350-0d746b05fc4dbf4ef2e2530e6ad95b69bcdfe58d.zip
Added methods to access charset x/y offs values (though those seem to be all 0 in COMI)
svn-id: r15482
Diffstat (limited to 'scumm')
-rw-r--r--scumm/nut_renderer.cpp54
-rw-r--r--scumm/nut_renderer.h11
-rw-r--r--scumm/smush/smush_font.h1
3 files changed, 51 insertions, 15 deletions
diff --git a/scumm/nut_renderer.cpp b/scumm/nut_renderer.cpp
index 0930ae9397..859578bb14 100644
--- a/scumm/nut_renderer.cpp
+++ b/scumm/nut_renderer.cpp
@@ -30,14 +30,14 @@ NutRenderer::NutRenderer(ScummEngine *vm) :
_vm(vm),
_initialized(false),
_loaded(false),
- _nbChars(0) {
+ _numChars(0) {
for (int i = 0; i < 256; i++)
_chars[i].src = NULL;
}
NutRenderer::~NutRenderer() {
- for (int i = 0; i < _nbChars; i++) {
+ for (int i = 0; i < _numChars; i++) {
if (_chars[i].src)
delete []_chars[i].src;
}
@@ -143,11 +143,11 @@ bool NutRenderer::loadFont(const char *filename) {
return false;
}
- _nbChars = READ_LE_UINT16(dataSrc + 10);
+ _numChars = READ_LE_UINT16(dataSrc + 10);
uint32 offset = 0;
int32 decoded_length;
- for (int l = 0; l < _nbChars; l++) {
+ for (int l = 0; l < _numChars; l++) {
offset += READ_BE_UINT32(dataSrc + offset + 4) + 8;
if (READ_BE_UINT32(dataSrc + offset) == 'FRME') {
offset += 8;
@@ -197,7 +197,7 @@ bool NutRenderer::loadFont(const char *filename) {
return true;
}
-int NutRenderer::getCharWidth(byte c) {
+int NutRenderer::getCharWidth(byte c) const {
debug(8, "NutRenderer::getCharWidth() called");
if (!_loaded) {
warning("NutRenderer::getCharWidth() Font is not loaded");
@@ -212,13 +212,13 @@ int NutRenderer::getCharWidth(byte c) {
return 0;
}
- if (c >= _nbChars)
- error("invalid character in NutRenderer::getCharWidth : %d (%d)", c, _nbChars);
+ if (c >= _numChars)
+ error("invalid character in NutRenderer::getCharWidth : %d (%d)", c, _numChars);
return _chars[c].width;
}
-int NutRenderer::getCharHeight(byte c) {
+int NutRenderer::getCharHeight(byte c) const {
debug(8, "NutRenderer::getCharHeight() called");
if (!_loaded) {
warning("NutRenderer::getCharHeight() Font is not loaded");
@@ -233,12 +233,46 @@ int NutRenderer::getCharHeight(byte c) {
return 0;
}
- if (c >= _nbChars)
- error("invalid character in NutRenderer::getCharHeight : %d (%d)", c, _nbChars);
+ if (c >= _numChars)
+ error("invalid character in NutRenderer::getCharHeight : %d (%d)", c, _numChars);
return _chars[c].height;
}
+int NutRenderer::getCharOffsX(byte c) const {
+ debug(8, "NutRenderer::getCharOffsX() called");
+ if (!_loaded) {
+ warning("NutRenderer::getCharOffsX() Font is not loaded");
+ return 0;
+ }
+
+ if (c >= 0x80 && _vm->_useCJKMode) {
+ return 0;
+ }
+
+ if (c >= _numChars)
+ error("invalid character in NutRenderer::getCharOffsX : %d (%d)", c, _numChars);
+
+ return _chars[c].xoffs;
+}
+
+int NutRenderer::getCharOffsY(byte c) const {
+ debug(8, "NutRenderer::getCharOffsY() called");
+ if (!_loaded) {
+ warning("NutRenderer::getCharOffsY() Font is not loaded");
+ return 0;
+ }
+
+ if (c >= 0x80 && _vm->_useCJKMode) {
+ return 0;
+ }
+
+ if (c >= _numChars)
+ error("invalid character in NutRenderer::getCharOffsY : %d (%d)", c, _numChars);
+
+ return _chars[c].yoffs;
+}
+
void NutRenderer::drawShadowChar(const Graphics::Surface &s, int c, int x, int y, byte color, bool showShadow) {
debug(8, "NutRenderer::drawShadowChar('%c', %d, %d, %d, %d) called", c, x, y, (int)color, showShadow);
if (!_loaded) {
diff --git a/scumm/nut_renderer.h b/scumm/nut_renderer.h
index b0e232e7c4..3aca0081a3 100644
--- a/scumm/nut_renderer.h
+++ b/scumm/nut_renderer.h
@@ -33,7 +33,7 @@ protected:
ScummEngine *_vm;
bool _initialized;
bool _loaded;
- int _nbChars;
+ int _numChars;
struct {
int xoffs;
int yoffs;
@@ -50,15 +50,18 @@ protected:
public:
NutRenderer(ScummEngine *vm);
virtual ~NutRenderer();
- int getNbChars() { return _nbChars; }
+ int getNumChars() { return _numChars; }
bool loadFont(const char *filename);
void drawFrame(byte *dst, int c, int x, int y);
void drawShadowChar(const Graphics::Surface &s, int c, int x, int y, byte color, bool showShadow);
- int getCharWidth(byte c);
- int getCharHeight(byte c);
+ int getCharWidth(byte c) const;
+ int getCharHeight(byte c) const;
+
+ int getCharOffsX(byte c) const;
+ int getCharOffsY(byte c) const;
};
} // End of namespace Scumm
diff --git a/scumm/smush/smush_font.h b/scumm/smush/smush_font.h
index b197dad9c6..19de753a64 100644
--- a/scumm/smush/smush_font.h
+++ b/scumm/smush/smush_font.h
@@ -29,7 +29,6 @@ namespace Scumm {
class SmushFont : public NutRenderer {
protected:
- int _nbChars;
int16 _color;
bool _new_colors;
bool _original;