aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/neverhood/background.cpp2
-rw-r--r--engines/neverhood/console.cpp9
-rw-r--r--engines/neverhood/console.h1
-rw-r--r--engines/neverhood/graphics.cpp10
-rw-r--r--engines/neverhood/graphics.h4
-rw-r--r--engines/neverhood/menumodule.cpp2
-rw-r--r--engines/neverhood/module.h3
-rw-r--r--engines/neverhood/modules/module2200.cpp6
-rw-r--r--engines/neverhood/scene.cpp13
-rw-r--r--engines/neverhood/scene.h3
-rw-r--r--engines/neverhood/smackerplayer.cpp2
-rw-r--r--engines/neverhood/sprite.cpp4
12 files changed, 44 insertions, 15 deletions
diff --git a/engines/neverhood/background.cpp b/engines/neverhood/background.cpp
index 0a80bd8390..e9e5325e77 100644
--- a/engines/neverhood/background.cpp
+++ b/engines/neverhood/background.cpp
@@ -45,7 +45,7 @@ Background::~Background() {
}
void Background::createSurface(int surfacePriority, int16 width, int16 height) {
- _surface = new BaseSurface(_vm, surfacePriority, width, height);
+ _surface = new BaseSurface(_vm, surfacePriority, width, height, "background");
_surface->setTransparent(false);
_spriteResource.getPosition().x = width;
_spriteResource.getPosition().y = height;
diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp
index c82f3a5f38..c6c22f97ce 100644
--- a/engines/neverhood/console.cpp
+++ b/engines/neverhood/console.cpp
@@ -24,11 +24,13 @@
#include "gui/debugger.h"
#include "neverhood/neverhood.h"
#include "neverhood/gamemodule.h"
+#include "neverhood/scene.h"
namespace Neverhood {
Console::Console(NeverhoodEngine *vm) : GUI::Debugger(), _vm(vm) {
DCmd_Register("room", WRAP_METHOD(Console, Cmd_Room));
+ DCmd_Register("surfaces", WRAP_METHOD(Console, Cmd_Surfaces));
}
Console::~Console() {
@@ -55,4 +57,11 @@ bool Console::Cmd_Room(int argc, const char **argv) {
return true;
}
+bool Console::Cmd_Surfaces(int argc, const char **argv) {
+ if (_vm->_gameModule->_childObject) {
+ ((Scene *)((GameModule *)_vm->_gameModule->_childObject)->_childObject)->printSurfaces(this);
+ }
+ return true;
+}
+
} // End of namespace Neverhood
diff --git a/engines/neverhood/console.h b/engines/neverhood/console.h
index 78a7338dc5..3ae989b08a 100644
--- a/engines/neverhood/console.h
+++ b/engines/neverhood/console.h
@@ -38,6 +38,7 @@ private:
NeverhoodEngine *_vm;
bool Cmd_Room(int argc, const char **argv);
+ bool Cmd_Surfaces(int argc, const char **argv);
};
} // End of namespace Neverhood
diff --git a/engines/neverhood/graphics.cpp b/engines/neverhood/graphics.cpp
index 5099c7a00e..8a30b20df4 100644
--- a/engines/neverhood/graphics.cpp
+++ b/engines/neverhood/graphics.cpp
@@ -26,9 +26,9 @@
namespace Neverhood {
-BaseSurface::BaseSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height)
+BaseSurface::BaseSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height, Common::String name)
: _vm(vm), _priority(priority), _visible(true), _transparent(true),
- _clipRects(NULL), _clipRectsCount(0), _version(0) {
+ _clipRects(NULL), _clipRectsCount(0), _version(0), _name(name) {
_drawRect.x = 0;
_drawRect.y = 0;
@@ -130,7 +130,7 @@ void BaseSurface::copyFrom(Graphics::Surface *sourceSurface, int16 x, int16 y, N
// ShadowSurface
ShadowSurface::ShadowSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height, BaseSurface *shadowSurface)
- : BaseSurface(vm, priority, width, height), _shadowSurface(shadowSurface) {
+ : BaseSurface(vm, priority, width, height, "shadow"), _shadowSurface(shadowSurface) {
// Empty
}
@@ -143,7 +143,7 @@ void ShadowSurface::draw() {
// FontSurface
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),
+ : BaseSurface(vm, 0, charWidth * charsPerRow, charHeight * numRows, "font"), _charsPerRow(charsPerRow), _numRows(numRows),
_firstChar(firstChar), _charWidth(charWidth), _charHeight(charHeight), _tracking(NULL) {
_tracking = new NPointArray();
@@ -152,7 +152,7 @@ FontSurface::FontSurface(NeverhoodEngine *vm, NPointArray *tracking, uint charsP
}
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),
+ : BaseSurface(vm, 0, charWidth * charsPerRow, charHeight * numRows, "font"), _charsPerRow(charsPerRow), _numRows(numRows),
_firstChar(firstChar), _charWidth(charWidth), _charHeight(charHeight), _tracking(NULL) {
SpriteResource fontSpriteResource(_vm);
diff --git a/engines/neverhood/graphics.h b/engines/neverhood/graphics.h
index a0ac1f09d5..9ab0d87ab9 100644
--- a/engines/neverhood/graphics.h
+++ b/engines/neverhood/graphics.h
@@ -83,7 +83,7 @@ class MouseCursorResource;
class BaseSurface {
public:
- BaseSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height);
+ BaseSurface(NeverhoodEngine *vm, int priority, int16 width, int16 height, Common::String name);
virtual ~BaseSurface();
virtual void draw();
void clear();
@@ -104,10 +104,12 @@ public:
void setVisible(bool value) { _visible = value; }
void setTransparent(bool value) { _transparent = value; }
Graphics::Surface *getSurface() { return _surface; }
+ const Common::String getName() const { return _name; }
protected:
NeverhoodEngine *_vm;
int _priority;
bool _visible;
+ Common::String _name;
Graphics::Surface *_surface;
NDrawRect _drawRect;
NDrawRect _sysRect;
diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp
index a8631cb0d6..afa27543dc 100644
--- a/engines/neverhood/menumodule.cpp
+++ b/engines/neverhood/menumodule.cpp
@@ -608,7 +608,7 @@ void TextEditWidget::initialize() {
_textLabelWidget->initialize();
if (_cursorFileHash != 0) {
cursorSpriteResource.load(_cursorFileHash, true);
- _cursorSurface = new BaseSurface(_vm, 0, cursorSpriteResource.getDimensions().width, cursorSpriteResource.getDimensions().height);
+ _cursorSurface = new BaseSurface(_vm, 0, cursorSpriteResource.getDimensions().width, cursorSpriteResource.getDimensions().height, "cursor");
_cursorSurface->drawSpriteResourceEx(cursorSpriteResource, false, false, cursorSpriteResource.getDimensions().width, cursorSpriteResource.getDimensions().height);
_cursorSurface->setVisible(!_readOnly);
}
diff --git a/engines/neverhood/module.h b/engines/neverhood/module.h
index e98012cbea..ba1e1fa3db 100644
--- a/engines/neverhood/module.h
+++ b/engines/neverhood/module.h
@@ -48,9 +48,10 @@ public:
Module(NeverhoodEngine *vm, Module *parentModule);
virtual ~Module();
virtual void draw();
+
+ Entity *_childObject;
protected:
Module *_parentModule;
- Entity *_childObject;
bool _done;
uint32 _moduleResult;
SceneType _sceneType;
diff --git a/engines/neverhood/modules/module2200.cpp b/engines/neverhood/modules/module2200.cpp
index 4f2d9e8fd2..d382cd6bba 100644
--- a/engines/neverhood/modules/module2200.cpp
+++ b/engines/neverhood/modules/module2200.cpp
@@ -2142,17 +2142,17 @@ Scene2208::Scene2208(NeverhoodEngine *vm, Module *parentModule, int which)
_fontSurface = FontSurface::createFontSurface(_vm, 0x0800090C);
- _backgroundSurface = new BaseSurface(_vm, 0, 640, 480);
+ _backgroundSurface = new BaseSurface(_vm, 0, 640, 480, "background");
spriteResource.load(0x08100289, true);
_backgroundSurface->drawSpriteResourceEx(spriteResource, false, false, 0, 0);
- _topBackgroundSurface = new BaseSurface(_vm, 0, 640, 192);
+ _topBackgroundSurface = new BaseSurface(_vm, 0, 640, 192, "top background");
spriteResource.load(!getGlobalVar(V_COLUMN_BACK_NAME)
? kScene2208FileHashes1[getGlobalVar(V_CLICKED_COLUMN_INDEX) % 6]
: getGlobalVar(V_COLUMN_BACK_NAME), true);
_topBackgroundSurface->drawSpriteResourceEx(spriteResource, false, false, 0, 0);
- _bottomBackgroundSurface = new BaseSurface(_vm, 0, 640, 192);
+ _bottomBackgroundSurface = new BaseSurface(_vm, 0, 640, 192, "bottom background");
spriteResource.load(kScene2208FileHashes2[getGlobalVar(V_CLICKED_COLUMN_INDEX) % 6], true);
_bottomBackgroundSurface->drawSpriteResourceEx(spriteResource, false, false, 0, 0);
diff --git a/engines/neverhood/scene.cpp b/engines/neverhood/scene.cpp
index 07d41754c9..c65bd3781d 100644
--- a/engines/neverhood/scene.cpp
+++ b/engines/neverhood/scene.cpp
@@ -20,6 +20,7 @@
*
*/
+#include "neverhood/console.h"
#include "neverhood/scene.h"
namespace Neverhood {
@@ -135,6 +136,18 @@ bool Scene::removeSurface(BaseSurface *surface) {
return false;
}
+void Scene::printSurfaces(Console *con) {
+ for (uint index = 0; index < _surfaces.size(); index++) {
+ NDrawRect drawRect = _surfaces[index]->getDrawRect();
+ NRect clipRect = _surfaces[index]->getClipRect();
+ int priority = _surfaces[index]->getPriority();
+ con->DebugPrintf("%d ('%s'): Priority %d, draw rect (%d, %d, %d, %d), clip rect (%d, %d, %d, %d)\n",
+ index, _surfaces[index]->getName().c_str(), priority,
+ drawRect.x, drawRect.y, drawRect.x2(), drawRect.y2(),
+ clipRect.x1, clipRect.y1, clipRect.x2, clipRect.y2);
+ }
+}
+
Sprite *Scene::addSprite(Sprite *sprite) {
addEntity(sprite);
addSurface(sprite->getSurface());
diff --git a/engines/neverhood/scene.h b/engines/neverhood/scene.h
index 1abcbfb964..813ffba0bb 100644
--- a/engines/neverhood/scene.h
+++ b/engines/neverhood/scene.h
@@ -37,6 +37,8 @@
namespace Neverhood {
+class Console;
+
class Scene : public Entity {
public:
Scene(NeverhoodEngine *vm, Module *parentModule);
@@ -46,6 +48,7 @@ public:
bool removeEntity(Entity *entity);
void addSurface(BaseSurface *surface);
bool removeSurface(BaseSurface *surface);
+ void printSurfaces(Console *con);
Sprite *addSprite(Sprite *sprite);
void removeSprite(Sprite *sprite);
void setSurfacePriority(BaseSurface *surface, int priority);
diff --git a/engines/neverhood/smackerplayer.cpp b/engines/neverhood/smackerplayer.cpp
index b67c8db9fc..ba89ec3efd 100644
--- a/engines/neverhood/smackerplayer.cpp
+++ b/engines/neverhood/smackerplayer.cpp
@@ -31,7 +31,7 @@ namespace Neverhood {
// SmackerSurface
SmackerSurface::SmackerSurface(NeverhoodEngine *vm)
- : BaseSurface(vm, 0, 0, 0), _smackerFrame(NULL) {
+ : BaseSurface(vm, 0, 0, 0, "smacker"), _smackerFrame(NULL) {
}
void SmackerSurface::draw() {
diff --git a/engines/neverhood/sprite.cpp b/engines/neverhood/sprite.cpp
index 45d131fd3c..50880089f9 100644
--- a/engines/neverhood/sprite.cpp
+++ b/engines/neverhood/sprite.cpp
@@ -83,7 +83,7 @@ void Sprite::loadDataResource(uint32 fileHash) {
}
void Sprite::createSurface(int surfacePriority, int16 width, int16 height) {
- _surface = new BaseSurface(_vm, surfacePriority, width, height);
+ _surface = new BaseSurface(_vm, surfacePriority, width, height, "sprite");
}
int16 Sprite::defFilterY(int16 y) {
@@ -398,7 +398,7 @@ void AnimatedSprite::updateFrameInfo() {
void AnimatedSprite::createSurface1(uint32 fileHash, int surfacePriority) {
NDimensions dimensions = _animResource.loadSpriteDimensions(fileHash);
- _surface = new BaseSurface(_vm, surfacePriority, dimensions.width, dimensions.height);
+ _surface = new BaseSurface(_vm, surfacePriority, dimensions.width, dimensions.height, "animated sprite");
}
void AnimatedSprite::createShadowSurface1(BaseSurface *shadowSurface, uint32 fileHash, int surfacePriority) {