aboutsummaryrefslogtreecommitdiff
path: root/engines/neverhood
diff options
context:
space:
mode:
Diffstat (limited to 'engines/neverhood')
-rw-r--r--engines/neverhood/graphics.cpp82
-rw-r--r--engines/neverhood/graphics.h27
-rw-r--r--engines/neverhood/menumodule.cpp48
-rw-r--r--engines/neverhood/menumodule.h16
-rw-r--r--engines/neverhood/module1000.cpp22
-rw-r--r--engines/neverhood/module1000.h1
-rw-r--r--engines/neverhood/module2200.cpp19
-rw-r--r--engines/neverhood/module2200.h1
8 files changed, 88 insertions, 128 deletions
diff --git a/engines/neverhood/graphics.cpp b/engines/neverhood/graphics.cpp
index 3b456a574f..1c3769dc65 100644
--- a/engines/neverhood/graphics.cpp
+++ b/engines/neverhood/graphics.cpp
@@ -150,62 +150,70 @@ void ShadowSurface::draw() {
// FontSurface
-FontSurface::FontSurface(NeverhoodEngine *vm, NPointArray &tracking, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight)
- : BaseSurface(vm, 0, charWidth * 16, charHeight * numRows), _tracking(tracking), _numRows(numRows), _firstChar(firstChar),
- _charWidth(charWidth), _charHeight(charHeight) {
-}
+FontSurface::FontSurface(NeverhoodEngine *vm, NPointArray *tracking, uint charsPerRow, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight)
+ : BaseSurface(vm, 0, charWidth * charsPerRow, charHeight * numRows), _charsPerRow(charsPerRow), _numRows(numRows),
+ _firstChar(firstChar), _charWidth(charWidth), _charHeight(charHeight), _tracking(NULL) {
+
+ _tracking = new NPointArray();
+ *_tracking = *tracking;
-void FontSurface::drawChar(BaseSurface *destSurface, int16 x, int16 y, byte chr) {
- NDrawRect sourceRect;
- chr -= _firstChar;
- sourceRect.x = (chr % 16) * _charWidth;
- sourceRect.y = (chr / 16) * _charHeight;
- sourceRect.width = _charWidth;
- sourceRect.height = _charHeight;
- destSurface->copyFrom(_surface, x, y, sourceRect, true);
}
-void FontSurface::drawString(BaseSurface *destSurface, int16 x, int16 y, const byte *string) {
- for (; *string != 0; string++) {
- drawChar(destSurface, x, y, *string);
- x += _tracking[*string - _firstChar].x;
- }
+FontSurface::FontSurface(NeverhoodEngine *vm, uint32 fileHash, uint charsPerRow, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight)
+ : BaseSurface(vm, 0, charWidth * charsPerRow, charHeight * numRows), _charsPerRow(charsPerRow), _numRows(numRows),
+ _firstChar(firstChar), _charWidth(charWidth), _charHeight(charHeight), _tracking(NULL) {
+
+ SpriteResource fontSpriteResource(_vm);
+ fontSpriteResource.load2(fileHash);
+ drawSpriteResourceEx(fontSpriteResource, false, false, 0, 0);
}
-// TextSurface
-
-TextSurface::TextSurface(NeverhoodEngine *vm, uint32 fileHash, uint16 numRows, uint charCount,
- byte firstChar, uint16 charWidth, uint16 charHeight)
- : BaseSurface(vm, 0, charWidth * charCount, charHeight * numRows),
- _numRows(numRows), _firstChar(firstChar), _charWidth(charWidth), _charHeight(charHeight),
- _fileHash(fileHash), _charCount(charCount) {
-
- SpriteResource spriteResource(_vm);
- spriteResource.load2(_fileHash);
- drawSpriteResourceEx(spriteResource, false, false, 0, 0);
+FontSurface::~FontSurface() {
+ delete _tracking;
}
-void TextSurface::drawChar(BaseSurface *destSurface, int16 x, int16 y, byte chr) {
+void FontSurface::drawChar(BaseSurface *destSurface, int16 x, int16 y, byte chr) {
NDrawRect sourceRect;
chr -= _firstChar;
- sourceRect.x = (chr % _charCount) * _charWidth;
- sourceRect.y = (chr / _charCount) * _charHeight;
+ sourceRect.x = (chr % _charsPerRow) * _charWidth;
+ sourceRect.y = (chr / _charsPerRow) * _charHeight;
sourceRect.width = _charWidth;
sourceRect.height = _charHeight;
destSurface->copyFrom(_surface, x, y, sourceRect, true);
}
-void TextSurface::drawString(BaseSurface *destSurface, int16 x, int16 y, const byte *string, int stringLen) {
- for (; stringLen > 0; stringLen--, string++) {
+void FontSurface::drawString(BaseSurface *destSurface, int16 x, int16 y, const byte *string, int stringLen) {
+
+ if (stringLen < 0)
+ stringLen = strlen((const char*)string);
+
+ for (; stringLen > 0; --stringLen, ++string) {
drawChar(destSurface, x, y, *string);
- x += _charWidth;
+ x += _tracking ? (*_tracking)[*string - _firstChar].x : _charWidth;
}
+
}
-int16 TextSurface::getStringWidth(const byte *string, int stringLen) {
+int16 FontSurface::getStringWidth(const byte *string, int stringLen) {
return string ? stringLen * _charWidth : 0;
}
+FontSurface *FontSurface::createFontSurface(NeverhoodEngine *vm, uint32 fileHash) {
+ FontSurface *fontSurface;
+ DataResource fontData(vm);
+ SpriteResource fontSprite(vm);
+ fontData.load(calcHash("asRecFont"));
+ uint16 numRows = fontData.getPoint(calcHash("meNumRows")).x;
+ uint16 firstChar = fontData.getPoint(calcHash("meFirstChar")).x;
+ uint16 charWidth = fontData.getPoint(calcHash("meCharWidth")).x;
+ uint16 charHeight = fontData.getPoint(calcHash("meCharHeight")).x;
+ NPointArray *tracking = fontData.getPointArray(calcHash("meTracking"));
+ fontSprite.load2(fileHash);
+ fontSurface = new FontSurface(vm, tracking, 16, numRows, firstChar, charWidth, charHeight);
+ fontSurface->drawSpriteResourceEx(fontSprite, false, false, 0, 0);
+ return fontSurface;
+}
+
// Misc
enum BitmapFlags {
@@ -338,8 +346,8 @@ void unpackSpriteNormal(const byte *source, int width, int height, byte *dest, i
}
int calcDistance(int16 x1, int16 y1, int16 x2, int16 y2) {
- int16 deltaX = ABS(x1 - x2);
- int16 deltaY = ABS(y1 - y2);
+ const int16 deltaX = ABS(x1 - x2);
+ const int16 deltaY = ABS(y1 - y2);
return sqrt((double)(deltaX * deltaX + deltaY * deltaY));
}
diff --git a/engines/neverhood/graphics.h b/engines/neverhood/graphics.h
index 65d25c04ce..a900cea10f 100644
--- a/engines/neverhood/graphics.h
+++ b/engines/neverhood/graphics.h
@@ -81,8 +81,6 @@ class AnimResource;
class SpriteResource;
class MouseCursorResource;
-// NOTE: "Restore" methods aren't need in the reimplementation as they're DirectDraw-specific
-
class BaseSurface {
public:
BaseSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height);
@@ -131,33 +129,22 @@ protected:
class FontSurface : public BaseSurface {
public:
- FontSurface(NeverhoodEngine *vm, NPointArray &tracking, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight);
- void drawChar(BaseSurface *destSurface, int16 x, int16 y, byte chr);
- void drawString(BaseSurface *destSurface, int16 x, int16 y, const byte *string);
-protected:
- NPointArray _tracking;
- uint16 _numRows;
- byte _firstChar;
- uint16 _charWidth;
- uint16 _charHeight;
-};
-
-class TextSurface : public BaseSurface {
-public:
- TextSurface(NeverhoodEngine *vm, uint32 fileHash, uint16 numRows, uint charCount,
- byte firstChar, uint16 charWidth, uint16 charHeight);
+ FontSurface(NeverhoodEngine *vm, NPointArray *tracking, uint charsPerRow, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight);
+ FontSurface(NeverhoodEngine *vm, uint32 fileHash, uint charsPerRow, uint16 numRows, byte firstChar, uint16 charWidth, uint16 charHeight);
+ virtual ~FontSurface();
void drawChar(BaseSurface *destSurface, int16 x, int16 y, byte chr);
- void drawString(BaseSurface *destSurface, int16 x, int16 y, const byte *string, int stringLen);
+ void drawString(BaseSurface *destSurface, int16 x, int16 y, const byte *string, int stringLen = -1);
int16 getStringWidth(const byte *string, int stringLen);
uint16 getCharWidth() const { return _charWidth; }
uint16 getCharHeight() const { return _charHeight; }
+ static FontSurface *createFontSurface(NeverhoodEngine *vm, uint32 fileHash);
protected:
+ uint _charsPerRow;
uint16 _numRows;
byte _firstChar;
uint16 _charWidth;
uint16 _charHeight;
- uint32 _fileHash;
- uint _charCount;
+ NPointArray *_tracking;
};
// Misc
diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp
index a1489fc78b..726ab91b8c 100644
--- a/engines/neverhood/menumodule.cpp
+++ b/engines/neverhood/menumodule.cpp
@@ -458,9 +458,9 @@ uint32 Widget::handleMessage(int messageNum, const MessageParam &param, Entity *
TextLabelWidget::TextLabelWidget(NeverhoodEngine *vm, int16 x, int16 y, int16 itemID, WidgetScene *parentScene,
int baseObjectPriority, int baseSurfacePriority,
- const byte *string, int stringLen, BaseSurface *drawSurface, int16 tx, int16 ty, TextSurface *textSurface)
+ const byte *string, int stringLen, BaseSurface *drawSurface, int16 tx, int16 ty, FontSurface *fontSurface)
: Widget(vm, x, y, itemID, parentScene, baseObjectPriority, baseSurfacePriority),
- _string(string), _stringLen(stringLen), _drawSurface(drawSurface), _tx(tx), _ty(ty), _textSurface(textSurface) {
+ _string(string), _stringLen(stringLen), _drawSurface(drawSurface), _tx(tx), _ty(ty), _fontSurface(fontSurface) {
}
@@ -470,15 +470,15 @@ void TextLabelWidget::addSprite() {
}
int16 TextLabelWidget::getWidth() {
- return _textSurface->getStringWidth(_string, _stringLen);
+ return _fontSurface->getStringWidth(_string, _stringLen);
}
int16 TextLabelWidget::getHeight() {
- return _textSurface->getCharHeight();
+ return _fontSurface->getCharHeight();
}
void TextLabelWidget::drawString(int maxStringLength) {
- _textSurface->drawString(_drawSurface, _x, _y, _string, MIN(_stringLen, maxStringLength));
+ _fontSurface->drawString(_drawSurface, _x, _y, _string, MIN(_stringLen, maxStringLength));
_collisionBoundsOffset.set(_tx, _ty, getWidth(), getHeight());
updateBounds();
}
@@ -499,14 +499,14 @@ void TextLabelWidget::setString(const byte *string, int stringLen) {
}
TextEditWidget::TextEditWidget(NeverhoodEngine *vm, int16 x, int16 y, int16 itemID, WidgetScene *parentScene,
- int baseObjectPriority, int baseSurfacePriority, int maxStringLength, TextSurface *textSurface,
+ int baseObjectPriority, int baseSurfacePriority, int maxStringLength, FontSurface *fontSurface,
uint32 fileHash, const NRect &rect)
: Widget(vm, x, y, itemID, parentScene, baseObjectPriority, baseSurfacePriority),
- _maxStringLength(maxStringLength), _textSurface(textSurface), _fileHash(fileHash), _rect(rect),
+ _maxStringLength(maxStringLength), _fontSurface(fontSurface), _fileHash(fileHash), _rect(rect),
_cursorSurface(NULL), _cursorTicks(0), _cursorPos(0), _cursorFileHash(0), _cursorWidth(0), _cursorHeight(0),
_modified(false) {
- _maxVisibleChars = (_rect.x2 - _rect.x1) / _textSurface->getCharWidth();
+ _maxVisibleChars = (_rect.x2 - _rect.x1) / _fontSurface->getCharWidth();
_cursorPos = 0;
SetUpdateHandler(&TextEditWidget::update);
@@ -526,8 +526,8 @@ void TextEditWidget::onClick() {
if (_entryString.size() == 1)
_cursorPos = 0;
else {
- int newCursorPos = mousePos.x / _textSurface->getCharWidth();
- if (mousePos.x % _textSurface->getCharWidth() > _textSurface->getCharWidth() / 2 && newCursorPos <= (int)_entryString.size())//###
+ int newCursorPos = mousePos.x / _fontSurface->getCharWidth();
+ if (mousePos.x % _fontSurface->getCharWidth() > _fontSurface->getCharWidth() / 2 && newCursorPos <= (int)_entryString.size())//###
++newCursorPos;
_cursorPos = MIN((int)_entryString.size(), newCursorPos);
}
@@ -546,9 +546,9 @@ void TextEditWidget::addSprite() {
_parentScene->addSprite(this);
_parentScene->addCollisionSprite(this);
_surface->setVisible(true);
- _textLabelWidget = new TextLabelWidget(_vm, _rect.x1, _rect.y1 + (_rect.y2 - _rect.y1 + 1 - _textSurface->getCharHeight()) / 2,
+ _textLabelWidget = new TextLabelWidget(_vm, _rect.x1, _rect.y1 + (_rect.y2 - _rect.y1 + 1 - _fontSurface->getCharHeight()) / 2,
0, _parentScene, _baseObjectPriority + 1, _baseSurfacePriority + 1,
- (const byte*)_entryString.c_str(), _entryString.size(), _surface, _x, _y, _textSurface);
+ (const byte*)_entryString.c_str(), _entryString.size(), _surface, _x, _y, _fontSurface);
_textLabelWidget->addSprite();
cursorSpriteResource.load2(_cursorFileHash);
_cursorSurface = new BaseSurface(_vm, 0, cursorSpriteResource.getDimensions().width, cursorSpriteResource.getDimensions().height);
@@ -576,7 +576,7 @@ void TextEditWidget::setCursor(uint32 cursorFileHash, int16 cursorWidth, int16 c
void TextEditWidget::drawCursor() {
if (_cursorSurface->getVisible() && _cursorPos >= 0 && _cursorPos <= _maxVisibleChars) {
NDrawRect sourceRect(0, 0, _cursorWidth, _cursorHeight);
- _surface->copyFrom(_cursorSurface->getSurface(), _rect.x1 + _cursorPos * _textSurface->getCharWidth(),
+ _surface->copyFrom(_cursorSurface->getSurface(), _rect.x1 + _cursorPos * _fontSurface->getCharWidth(),
_rect.y1 + (_rect.y2 - _cursorHeight - _rect.y1 + 1) / 2, sourceRect, true);
} else
_cursorSurface->setVisible(false);
@@ -677,13 +677,13 @@ uint32 TextEditWidget::handleMessage(int messageNum, const MessageParam &param,
SavegameListBox::SavegameListBox(NeverhoodEngine *vm, int16 x, int16 y, int16 itemID, WidgetScene *parentScene,
int baseObjectPriority, int baseSurfacePriority,
- StringArray *savegameList, TextSurface *textSurface, uint32 bgFileHash, const NRect &rect)
+ StringArray *savegameList, FontSurface *fontSurface, uint32 bgFileHash, const NRect &rect)
: Widget(vm, x, y, itemID, parentScene, baseObjectPriority, baseSurfacePriority),
- _savegameList(savegameList), _textSurface(textSurface), _bgFileHash(bgFileHash), _rect(rect),
+ _savegameList(savegameList), _fontSurface(fontSurface), _bgFileHash(bgFileHash), _rect(rect),
_maxStringLength(0), _firstVisibleItem(0), _lastVisibleItem(0), _currIndex(0) {
- _maxVisibleItemsCount = (_rect.y2 - _rect.y1) / _textSurface->getCharHeight();
- _maxStringLength = (_rect.x2 - _rect.x1) / _textSurface->getCharWidth();
+ _maxVisibleItemsCount = (_rect.y2 - _rect.y1) / _fontSurface->getCharHeight();
+ _maxStringLength = (_rect.x2 - _rect.x1) / _fontSurface->getCharWidth();
}
void SavegameListBox::onClick() {
@@ -692,7 +692,7 @@ void SavegameListBox::onClick() {
mousePos.y -= _y + _rect.y1;
if (mousePos.x >= 0 && mousePos.x <= _rect.x2 - _rect.x1 &&
mousePos.y >= 0 && mousePos.y <= _rect.y2 - _rect.y1) {
- int newIndex = _firstVisibleItem + mousePos.y / _textSurface->getCharHeight();
+ int newIndex = _firstVisibleItem + mousePos.y / _fontSurface->getCharHeight();
if (newIndex <= _lastVisibleItem) {
_currIndex = newIndex;
refresh();
@@ -723,7 +723,7 @@ void SavegameListBox::buildItems() {
const byte *string = (const byte*)savegameList[i].c_str();
int stringLen = (int)savegameList[i].size();
TextLabelWidget *label = new TextLabelWidget(_vm, itemX, itemY, i, _parentScene, _baseObjectPriority + 1,
- _baseSurfacePriority + 1, string, MIN(stringLen, _maxStringLength), _surface, _x, _y, _textSurface);
+ _baseSurfacePriority + 1, string, MIN(stringLen, _maxStringLength), _surface, _x, _y, _fontSurface);
label->addSprite();
_textLabelItems.push_back(label);
}
@@ -733,7 +733,7 @@ void SavegameListBox::drawItems() {
for (int i = 0; i < (int)_textLabelItems.size(); ++i) {
TextLabelWidget *label = _textLabelItems[i];
if (i >= _firstVisibleItem && i < _lastVisibleItem) {
- label->setY(_rect.y1 + (i - _firstVisibleItem) * _textSurface->getCharHeight());
+ label->setY(_rect.y1 + (i - _firstVisibleItem) * _fontSurface->getCharHeight());
label->updateBounds();
label->drawString(_maxStringLength);
} else
@@ -805,7 +805,7 @@ SaveGameMenu::SaveGameMenu(NeverhoodEngine *vm, Module *parentModule, StringArra
static const NRect kTextEditRect(0, 0, 377, 17);
static const NRect kMouseRect(50, 47, 427, 64);
- _textSurface = new TextSurface(_vm, 0x2328121A, 7, 32, 32, 11, 17);
+ _fontSurface = new FontSurface(_vm, 0x2328121A, 32, 7, 32, 11, 17);
setBackground(0x30084E25);
setPalette(0x30084E25);
@@ -814,11 +814,11 @@ SaveGameMenu::SaveGameMenu(NeverhoodEngine *vm, Module *parentModule, StringArra
insertStaticSprite(0x1301A7EA, 200);
_listBox = new SavegameListBox(_vm, 60, 142, 69/*ItemID*/, this, 1000, 1000,
- _savegameList, _textSurface, 0x1115A223, kListBoxRect);
+ _savegameList, _fontSurface, 0x1115A223, kListBoxRect);
_listBox->addSprite();
_textEditWidget = new TextEditWidget(_vm, 50, 47, 70/*ItemID*/, this, 1000, 1000, 29,
- _textSurface, 0x3510A868, kTextEditRect);
+ _fontSurface, 0x3510A868, kTextEditRect);
_textEditWidget->setCursor(0x8290AC20, 2, 13);
_textEditWidget->addSprite();
setCurrWidget(_textEditWidget);
@@ -835,7 +835,7 @@ SaveGameMenu::SaveGameMenu(NeverhoodEngine *vm, Module *parentModule, StringArra
}
SaveGameMenu::~SaveGameMenu() {
- delete _textSurface;
+ delete _fontSurface;
}
void SaveGameMenu::handleEvent(int16 itemID, int eventType) {
diff --git a/engines/neverhood/menumodule.h b/engines/neverhood/menumodule.h
index 0f45795ab9..51c32aa878 100644
--- a/engines/neverhood/menumodule.h
+++ b/engines/neverhood/menumodule.h
@@ -123,7 +123,7 @@ class TextLabelWidget : public Widget {
public:
TextLabelWidget(NeverhoodEngine *vm, int16 x, int16 y, int16 itemID, WidgetScene *parentScene,
int baseObjectPriority, int baseSurfacePriority,
- const byte *string, int stringLen, BaseSurface *drawSurface, int16 tx, int16 ty, TextSurface *textSurface);
+ const byte *string, int stringLen, BaseSurface *drawSurface, int16 tx, int16 ty, FontSurface *fontSurface);
virtual void onClick();
virtual void addSprite();
virtual int16 getWidth();
@@ -131,11 +131,11 @@ public:
void drawString(int maxStringLength);
void clear();
void setString(const byte *string, int stringLen);
- TextSurface *getTextSurface() const { return _textSurface; }
+ FontSurface *getFontSurface() const { return _fontSurface; }
protected:
BaseSurface *_drawSurface;
int16 _tx, _ty;
- TextSurface *_textSurface;
+ FontSurface *_fontSurface;
const byte *_string;
int _stringLen;
};
@@ -143,7 +143,7 @@ protected:
class TextEditWidget : public Widget {
public:
TextEditWidget(NeverhoodEngine *vm, int16 x, int16 y, int16 itemID, WidgetScene *parentScene,
- int baseObjectPriority, int baseSurfacePriority, int maxStringLength, TextSurface *textSurface,
+ int baseObjectPriority, int baseSurfacePriority, int maxStringLength, FontSurface *fontSurface,
uint32 fileHash, const NRect &rect);
~TextEditWidget();
virtual void onClick();
@@ -167,7 +167,7 @@ protected:
int _cursorPos;
int _cursorTicks;
Common::String _entryString;
- TextSurface *_textSurface;
+ FontSurface *_fontSurface;
TextLabelWidget *_textLabelWidget;
BaseSurface *_cursorSurface;
uint32 _cursorFileHash;
@@ -181,7 +181,7 @@ class SavegameListBox : public Widget {
public:
SavegameListBox(NeverhoodEngine *vm, int16 x, int16 y, int16 itemID, WidgetScene *parentScene,
int baseObjectPriority, int baseSurfacePriority,
- StringArray *savegameList, TextSurface *textSurface, uint32 bgFileHash, const NRect &rect);
+ StringArray *savegameList, FontSurface *fontSurface, uint32 bgFileHash, const NRect &rect);
virtual void onClick();
virtual void addSprite();
void buildItems();
@@ -200,7 +200,7 @@ protected:
int _firstVisibleItem;
int _lastVisibleItem;
StringArray *_savegameList;
- TextSurface *_textSurface;
+ FontSurface *_fontSurface;
uint _currIndex;
int _maxVisibleItemsCount;
};
@@ -212,7 +212,7 @@ public:
virtual void handleEvent(int16 itemID, int eventType);
protected:
StringArray *_savegameList;
- TextSurface *_textSurface;
+ FontSurface *_fontSurface;
SavegameListBox *_listBox;
TextEditWidget *_textEditWidget;
Common::String _savegameDescription;
diff --git a/engines/neverhood/module1000.cpp b/engines/neverhood/module1000.cpp
index 7033cafdc9..44bb778645 100644
--- a/engines/neverhood/module1000.cpp
+++ b/engines/neverhood/module1000.cpp
@@ -1580,7 +1580,7 @@ void Scene1005::drawTextToBackground() {
const char *textStart, *textEnd;
int16 y = 36;
uint32 textIndex = getTextIndex();
- FontSurface *fontSurface = createFontSurface();
+ FontSurface *fontSurface = FontSurface::createFontSurface(_vm, getGlobalVar(V_ENTRANCE_OPEN) ? 0x283CE401 : 0xC6604282);
textResource.load(0x80283101);
textStart = textResource.getString(textIndex, textEnd);
while (textStart < textEnd) {
@@ -1591,26 +1591,6 @@ void Scene1005::drawTextToBackground() {
delete fontSurface;
}
-FontSurface *Scene1005::createFontSurface() {
- FontSurface *fontSurface;
- DataResource fontData(_vm);
- SpriteResource fontSprite(_vm);
- fontData.load(calcHash("asRecFont"));
- uint16 numRows = fontData.getPoint(calcHash("meNumRows")).x;
- uint16 firstChar = fontData.getPoint(calcHash("meFirstChar")).x;
- uint16 charWidth = fontData.getPoint(calcHash("meCharWidth")).x;
- uint16 charHeight = fontData.getPoint(calcHash("meCharHeight")).x;
- NPointArray *tracking = fontData.getPointArray(calcHash("meTracking"));
- fontSurface = new FontSurface(_vm, *tracking, numRows, firstChar, charWidth, charHeight);
- if (getGlobalVar(V_ENTRANCE_OPEN)) {
- fontSprite.load2(0x283CE401);
- } else {
- fontSprite.load2(0xC6604282);
- }
- fontSurface->drawSpriteResourceEx(fontSprite, false, false, 0, 0);
- return fontSurface;
-}
-
uint32 Scene1005::getTextIndex() {
uint32 textIndex;
textIndex = getTextIndex1();
diff --git a/engines/neverhood/module1000.h b/engines/neverhood/module1000.h
index 6f73326c61..32228a20e7 100644
--- a/engines/neverhood/module1000.h
+++ b/engines/neverhood/module1000.h
@@ -289,7 +289,6 @@ public:
protected:
uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
void drawTextToBackground();
- FontSurface *createFontSurface();
uint32 getTextIndex();
uint32 getTextIndex1();
uint32 getTextIndex2();
diff --git a/engines/neverhood/module2200.cpp b/engines/neverhood/module2200.cpp
index 889af37852..6448955934 100644
--- a/engines/neverhood/module2200.cpp
+++ b/engines/neverhood/module2200.cpp
@@ -2135,8 +2135,9 @@ Scene2208::Scene2208(NeverhoodEngine *vm, Module *parentModule, int which)
setPalette(0x08100289);
addEntity(_palette);
insertPuzzleMouse(0x0028D089, 40, 600);
-
- createFontSurface();
+
+ _fontSurface = FontSurface::createFontSurface(_vm, 0x0800090C);
+
_backgroundSurface = new BaseSurface(_vm, 0, 640, 480);
spriteResource.load2(0x08100289);
_backgroundSurface->drawSpriteResourceEx(spriteResource, false, false, 0, 0);
@@ -2232,20 +2233,6 @@ uint32 Scene2208::handleMessage(int messageNum, const MessageParam &param, Entit
return messageResult;
}
-void Scene2208::createFontSurface() {
- DataResource fontData(_vm);
- SpriteResource spriteResource(_vm);
- fontData.load(calcHash("asRecFont"));
- uint16 numRows = fontData.getPoint(calcHash("meNumRows")).x;
- uint16 firstChar = fontData.getPoint(calcHash("meFirstChar")).x;
- uint16 charWidth = fontData.getPoint(calcHash("meCharWidth")).x;
- uint16 charHeight = fontData.getPoint(calcHash("meCharHeight")).x;
- NPointArray *tracking = fontData.getPointArray(calcHash("meTracking"));
- spriteResource.load2(0x0800090C);
- _fontSurface = new FontSurface(_vm, *tracking, numRows, firstChar, charWidth, charHeight);
- _fontSurface->drawSpriteResourceEx(spriteResource, false, false, 0, 0);
-}
-
void Scene2208::drawRow(int16 rowIndex) {
NDrawRect sourceRect;
int16 y = (rowIndex * 48) % 528;
diff --git a/engines/neverhood/module2200.h b/engines/neverhood/module2200.h
index 34be267645..30cc681b40 100644
--- a/engines/neverhood/module2200.h
+++ b/engines/neverhood/module2200.h
@@ -336,7 +336,6 @@ protected:
Common::Array<const char*> _strings;
void update();
uint32 handleMessage(int messageNum, const MessageParam &param, Entity *sender);
- void createFontSurface();
void drawRow(int16 rowIndex);
};