[Scummvm-cvs-logs] scummvm master -> d00f5c0aa739a7a61618f14b47be137f517d92d7

bluegr bluegr at gmail.com
Sun Jun 9 16:14:27 CEST 2013


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9e0c843c9f NEVERHOOD: Remove superfluous check
d00f5c0aa7 NEVERHOOD: Add a console command to display the current surfaces


Commit: 9e0c843c9f41239a878e8d2772c27507196428b6
    https://github.com/scummvm/scummvm/commit/9e0c843c9f41239a878e8d2772c27507196428b6
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2013-06-09T07:11:24-07:00

Commit Message:
NEVERHOOD: Remove superfluous check

Changed paths:
    engines/neverhood/gamemodule.cpp



diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp
index db4d0ef..e63109a 100644
--- a/engines/neverhood/gamemodule.cpp
+++ b/engines/neverhood/gamemodule.cpp
@@ -441,8 +441,7 @@ void GameModule::createModule(int moduleNum, int which) {
 	debug("GameModule::createModule(%d, %d)", moduleNum, which);
 	_moduleNum = moduleNum;
 
-	if (_childObject)
-		delete _childObject;
+	delete _childObject;
 
 	switch (_moduleNum) {
 	case 1000:


Commit: d00f5c0aa739a7a61618f14b47be137f517d92d7
    https://github.com/scummvm/scummvm/commit/d00f5c0aa739a7a61618f14b47be137f517d92d7
Author: Filippos Karapetis (bluegr at gmail.com)
Date: 2013-06-09T07:13:23-07:00

Commit Message:
NEVERHOOD: Add a console command to display the current surfaces

Changed paths:
    engines/neverhood/background.cpp
    engines/neverhood/console.cpp
    engines/neverhood/console.h
    engines/neverhood/graphics.cpp
    engines/neverhood/graphics.h
    engines/neverhood/menumodule.cpp
    engines/neverhood/module.h
    engines/neverhood/modules/module2200.cpp
    engines/neverhood/scene.cpp
    engines/neverhood/scene.h
    engines/neverhood/smackerplayer.cpp
    engines/neverhood/sprite.cpp



diff --git a/engines/neverhood/background.cpp b/engines/neverhood/background.cpp
index 0a80bd8..e9e5325 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 c82f3a5..c6c22f9 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 78a7338..3ae989b 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 5099c7a..8a30b20 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 a0ac1f0..9ab0d87 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 a8631cb..afa2754 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 e98012c..ba1e1fa 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 4f2d9e8..d382cd6 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 07d4175..c65bd37 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 1abcbfb..813ffba 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 b67c8db..ba89ec3 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 45d131f..5088008 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) {






More information about the Scummvm-git-logs mailing list