[Scummvm-cvs-logs] SF.net SVN: scummvm:[45511] scummvm/trunk/engines/draci

spalek at users.sourceforge.net spalek at users.sourceforge.net
Fri Oct 30 02:41:57 CET 2009


Revision: 45511
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45511&view=rev
Author:   spalek
Date:     2009-10-30 01:41:57 +0000 (Fri, 30 Oct 2009)

Log Message:
-----------
Remove most of default parameter values.

Also, add comments to the last commit.

Modified Paths:
--------------
    scummvm/trunk/engines/draci/animation.cpp
    scummvm/trunk/engines/draci/animation.h
    scummvm/trunk/engines/draci/font.h
    scummvm/trunk/engines/draci/game.cpp
    scummvm/trunk/engines/draci/game.h
    scummvm/trunk/engines/draci/mouse.h
    scummvm/trunk/engines/draci/script.cpp
    scummvm/trunk/engines/draci/sprite.cpp
    scummvm/trunk/engines/draci/sprite.h
    scummvm/trunk/engines/draci/surface.cpp
    scummvm/trunk/engines/draci/surface.h
    scummvm/trunk/engines/draci/walking.h

Modified: scummvm/trunk/engines/draci/animation.cpp
===================================================================
--- scummvm/trunk/engines/draci/animation.cpp	2009-10-30 00:52:05 UTC (rev 45510)
+++ scummvm/trunk/engines/draci/animation.cpp	2009-10-30 01:41:57 UTC (rev 45511)
@@ -127,7 +127,7 @@
 	const Drawable *frame = _frames[_currentFrame];
 
 	if (_id == kOverlayImage) {
-		frame->draw(surface, false);
+		frame->draw(surface, false, 0, 0);
 	} else {
 		// Draw frame
 		frame->drawReScaled(surface, false, _displacement);

Modified: scummvm/trunk/engines/draci/animation.h
===================================================================
--- scummvm/trunk/engines/draci/animation.h	2009-10-30 00:52:05 UTC (rev 45510)
+++ scummvm/trunk/engines/draci/animation.h	2009-10-30 01:41:57 UTC (rev 45511)
@@ -160,9 +160,9 @@
 	AnimationManager(DraciEngine *vm) : _vm(vm), _lastIndex(-1) {}
 	~AnimationManager() { deleteAll(); }
 
-	Animation *addAnimation(int id, uint z, bool playing = false);
-	Animation *addText(int id, bool playing = false);
-	Animation *addItem(int id, bool playing = false);
+	Animation *addAnimation(int id, uint z, bool playing);
+	Animation *addText(int id, bool playing);
+	Animation *addItem(int id, bool playing);
 	void addOverlay(Drawable *overlay, uint z);
 
 	void play(int id);

Modified: scummvm/trunk/engines/draci/font.h
===================================================================
--- scummvm/trunk/engines/draci/font.h	2009-10-30 00:52:05 UTC (rev 45510)
+++ scummvm/trunk/engines/draci/font.h	2009-10-30 01:41:57 UTC (rev 45511)
@@ -66,13 +66,13 @@
 	void drawChar(Surface *dst, uint8 chr, int tx, int ty, int with_colour) const;
 
 	void drawString(Surface *dst, const byte *str, uint len, int x, int y, int with_colour,
-	                int spacing, bool markDirty = true) const;
+	                int spacing, bool markDirty) const;
 	void drawString(Surface *dst, const Common::String &str,
-	                int x, int y, int with_colour, int spacing, bool markDirty = true) const;
+	                int x, int y, int with_colour, int spacing, bool markDirty) const;
 
-	uint getStringWidth(const Common::String &str, int spacing = 0) const;
+	uint getStringWidth(const Common::String &str, int spacing) const;
 	uint getStringHeight(const Common::String &str) const;
-	uint getLineWidth(const Common::String &str, uint startIndex, int spacing = 0) const;
+	uint getLineWidth(const Common::String &str, uint startIndex, int spacing) const;
 
 private:
 	uint8 _fontHeight;

Modified: scummvm/trunk/engines/draci/game.cpp
===================================================================
--- scummvm/trunk/engines/draci/game.cpp	2009-10-30 00:52:05 UTC (rev 45510)
+++ scummvm/trunk/engines/draci/game.cpp	2009-10-30 01:41:57 UTC (rev 45511)
@@ -186,12 +186,12 @@
 
 	// Initialize animation for object / room titles
 	Animation *titleAnim = _vm->_anims->addText(kTitleText, true);
-	Text *title = new Text("", _vm->_smallFont, kTitleColour, 0, 0);
+	Text *title = new Text("", _vm->_smallFont, kTitleColour, 0, 0, 0);
 	titleAnim->addFrame(title, NULL);
 
 	// Initialize animation for speech text
 	Animation *speechAnim = _vm->_anims->addText(kSpeechText, true);
-	Text *speech = new Text("", _vm->_bigFont, kFontColour1, 0, 0);
+	Text *speech = new Text("", _vm->_bigFont, kFontColour1, 0, 0, 0);
 	speechAnim->addFrame(speech, NULL);
 
 	// Initialize inventory animation
@@ -204,7 +204,7 @@
 
 	for (uint i = 0; i < kDialogueLines; ++i) {
 		_dialogueAnims[i] = _vm->_anims->addText(kDialogueLinesID - i, true);
-		Text *dialogueLine = new Text("", _vm->_smallFont, kLineInactiveColour, 0, 0);
+		Text *dialogueLine = new Text("", _vm->_smallFont, kLineInactiveColour, 0, 0, 0);
 		_dialogueAnims[i]->addFrame(dialogueLine, NULL);
 
 		_dialogueAnims[i]->setZ(254);
@@ -503,7 +503,7 @@
 			if (_currentItem == kNoItem) {
 				_vm->_mouse->setCursorType(kNormalCursor);
 			} else {
-				_vm->_mouse->loadItemCursor(_currentItem);
+				_vm->_mouse->loadItemCursor(_currentItem, false);
 			}
 		}
 
@@ -561,7 +561,7 @@
 		if (_currentItem == kNoItem) {
 			_vm->_mouse->setCursorType(kNormalCursor);
 		} else {
-			_vm->_mouse->loadItemCursor(_currentItem);
+			_vm->_mouse->loadItemCursor(_currentItem, false);
 		}
 	}
 }
@@ -667,7 +667,7 @@
 	const int anim_id = kInventoryItemsID - itemID;
 	Animation *anim = _vm->_anims->getAnimation(anim_id);
 	if (!anim) {
-		anim = _vm->_anims->addItem(anim_id);
+		anim = _vm->_anims->addItem(anim_id, false);
 		const BAFile *img = _vm->_itemImagesArchive->getFile(2 * itemID);
 		Sprite *sp = new Sprite(img->_data, img->_length, 0, 0, true);
 		anim->addFrame(sp, NULL);
@@ -982,7 +982,7 @@
 		return;
 
 	Surface *surface = _vm->_screen->getSurface();
-	_hero = _currentRoom._walkingMap.findNearestWalkable(x, y, surface->getRect());
+	_hero = _currentRoom._walkingMap.findNearestWalkable(x, y, surface->getDimensions());
 	debugC(3, kDraciLogicDebugLevel, "Walk to x: %d y: %d", _hero.x, _hero.y);
 	// FIXME: Need to add proper walking (this only warps the dragon to position)
 

Modified: scummvm/trunk/engines/draci/game.h
===================================================================
--- scummvm/trunk/engines/draci/game.h	2009-10-30 00:52:05 UTC (rev 45510)
+++ scummvm/trunk/engines/draci/game.h	2009-10-30 01:41:57 UTC (rev 45511)
@@ -220,7 +220,7 @@
 	int loadAnimation(uint animNum, uint z);
 	void loadOverlays();
 	void loadObject(uint numObj);
-	void loadWalkingMap(int mapID);
+	void loadWalkingMap(int mapID);		// <0 means the room's default walking map
 	void loadItem(int itemID);
 
 	uint getNumObjects() const;

Modified: scummvm/trunk/engines/draci/mouse.h
===================================================================
--- scummvm/trunk/engines/draci/mouse.h	2009-10-30 00:52:05 UTC (rev 45510)
+++ scummvm/trunk/engines/draci/mouse.h	2009-10-30 01:41:57 UTC (rev 45511)
@@ -58,7 +58,7 @@
 	void setPosition(uint16 x, uint16 y);
 	CursorType getCursorType() const { return _cursorType; }
 	void setCursorType(CursorType cur);
-	void loadItemCursor(int itemID, bool highlighted = false);
+	void loadItemCursor(int itemID, bool highlighted);
 	bool lButtonPressed() const { return _lButton; }
 	bool rButtonPressed() const { return _rButton; }
 	void lButtonSet(bool state) { _lButton = state; }

Modified: scummvm/trunk/engines/draci/script.cpp
===================================================================
--- scummvm/trunk/engines/draci/script.cpp	2009-10-30 00:52:05 UTC (rev 45510)
+++ scummvm/trunk/engines/draci/script.cpp	2009-10-30 01:41:57 UTC (rev 45511)
@@ -573,7 +573,7 @@
 
 	if (_vm->_game->getItemStatus(itemID) == 1) {
 		if (itemID != kNoItem) {
-			Animation *itemAnim = _vm->_anims->addItem(kInventoryItemsID - itemID);
+			Animation *itemAnim = _vm->_anims->addItem(kInventoryItemsID - itemID, false);
 			const BAFile *f = _vm->_itemImagesArchive->getFile(2 * itemID);
 			Sprite *sp = new Sprite(f->_data, f->_length, 0, 0, true);
 			itemAnim->addFrame(sp, NULL);
@@ -581,7 +581,7 @@
 
 		_vm->_game->setCurrentItem(itemID);
 
-		_vm->_mouse->loadItemCursor(itemID);
+		_vm->_mouse->loadItemCursor(itemID, false);
 
 		// TODO: This is probably not needed but I'm leaving it to be sure for now
 		// The original engine needed to turn off the mouse temporarily when changing
@@ -718,7 +718,7 @@
 		? NULL : _vm->_dubbingArchive->getSample(sentenceID, 0);
 
 	// Set the string and text colour
-	surface->markDirtyRect(speechFrame->getRect());
+	surface->markDirtyRect(speechFrame->getRect(kNoDisplacement));
 	if (_vm->_sound->showSubtitles() || !sample) {
 		speechFrame->setText(Common::String((const char *)f->_data+1, f->_length-1));
 	} else {
@@ -780,7 +780,7 @@
 	_vm->_game->loop();
 
 	// Delete the text
-	_vm->_screen->getSurface()->markDirtyRect(speechFrame->getRect());
+	_vm->_screen->getSurface()->markDirtyRect(speechFrame->getRect(kNoDisplacement));
 	speechFrame->setText("");
 
 	// Stop the playing sample and deallocate it.  Stopping should only be

Modified: scummvm/trunk/engines/draci/sprite.cpp
===================================================================
--- scummvm/trunk/engines/draci/sprite.cpp	2009-10-30 00:52:05 UTC (rev 45510)
+++ scummvm/trunk/engines/draci/sprite.cpp	2009-10-30 01:41:57 UTC (rev 45511)
@@ -332,7 +332,7 @@
 }
 
 void Text::draw(Surface *surface, bool markDirty, int relX, int relY) const {
-	_font->drawString(surface, _text, _x + relX, _y + relY, _colour, _spacing);
+	_font->drawString(surface, _text, _x + relX, _y + relY, _colour, _spacing, true);
 }
 
 // TODO: Handle scaled parameter properly by implementing Text scaling

Modified: scummvm/trunk/engines/draci/sprite.h
===================================================================
--- scummvm/trunk/engines/draci/sprite.h	2009-10-30 00:52:05 UTC (rev 45510)
+++ scummvm/trunk/engines/draci/sprite.h	2009-10-30 01:41:57 UTC (rev 45511)
@@ -44,8 +44,8 @@
 
 class Drawable {
 public:
-	virtual void draw(Surface *surface, bool markDirty, int relX=0, int relY=0) const = 0;
-	virtual void drawReScaled(Surface *surface, bool markDirty, const Displacement &displacement = kNoDisplacement) const = 0;
+	virtual void draw(Surface *surface, bool markDirty, int relX, int relY) const = 0;
+	virtual void drawReScaled(Surface *surface, bool markDirty, const Displacement &displacement) const = 0;
 
 	virtual ~Drawable() {};
 
@@ -69,7 +69,7 @@
 	void setDelay(int delay) { _delay = delay; }
 	int getDelay() const { return _delay; }
 
-	virtual Common::Rect getRect(const Displacement &displacement = kNoDisplacement) const = 0;
+	virtual Common::Rect getRect(const Displacement &displacement) const = 0;
 
 	virtual DrawableType getType() const = 0;
 
@@ -106,16 +106,16 @@
 
 	~Sprite();
 
-	void draw(Surface *surface, bool markDirty, int relX=0, int relY=0) const;
-	void drawReScaled(Surface *surface, bool markDirty, const Displacement &displacement = kNoDisplacement) const;
+	void draw(Surface *surface, bool markDirty, int relX, int relY) const;
+	void drawReScaled(Surface *surface, bool markDirty, const Displacement &displacement) const;
 
 	void setMirrorOn();
 	void setMirrorOff();
 
-	Common::Rect getRect(const Displacement &displacement = kNoDisplacement) const;
+	Common::Rect getRect(const Displacement &displacement) const;
 
 	const byte *getBuffer() const { return _data; }
-	int getPixel(int x, int y, const Displacement &displacement = kNoDisplacement) const;
+	int getPixel(int x, int y, const Displacement &displacement) const;
 
 	DrawableType getType() const { return kDrawableSprite; }
 
@@ -128,7 +128,7 @@
 
 public:
 	Text(const Common::String &str, const Font *font, byte fontColour,
-	    int x, int y, uint spacing = 0);
+	    int x, int y, uint spacing);
 	~Text() {};
 
 	void setText(const Common::String &str);
@@ -138,13 +138,13 @@
 
 	uint getLength() const;
 
-	void draw(Surface *surface, bool markDirty, int relX=0, int relY=0) const;
+	void draw(Surface *surface, bool markDirty, int relX, int relY) const;
 
 	// TODO: drawReScaled just calls draw so Text can be accessed through a Drawable pointer.
 	// Handle scaling text sometimes (not essential).
 
-	void drawReScaled(Surface *surface, bool markDirty, const Displacement &displacement = kNoDisplacement) const { draw(surface, markDirty, displacement.relX, displacement.relY); }
-	Common::Rect getRect(const Displacement &displacement = kNoDisplacement) const;
+	void drawReScaled(Surface *surface, bool markDirty, const Displacement &displacement) const { draw(surface, markDirty, displacement.relX, displacement.relY); }
+	Common::Rect getRect(const Displacement &displacement) const;
 
 	DrawableType getType() const { return kDrawableText; }
 private:

Modified: scummvm/trunk/engines/draci/surface.cpp
===================================================================
--- scummvm/trunk/engines/draci/surface.cpp	2009-10-30 00:52:05 UTC (rev 45510)
+++ scummvm/trunk/engines/draci/surface.cpp	2009-10-30 01:41:57 UTC (rev 45511)
@@ -168,7 +168,7 @@
 /**
  * @brief Returns a Common::Rect corresponding to the surface.
  */
-Common::Rect Surface::getRect() const {
+Common::Rect Surface::getDimensions() const {
 	return Common::Rect(w, h);
 }
 

Modified: scummvm/trunk/engines/draci/surface.h
===================================================================
--- scummvm/trunk/engines/draci/surface.h	2009-10-30 00:52:05 UTC (rev 45510)
+++ scummvm/trunk/engines/draci/surface.h	2009-10-30 01:41:57 UTC (rev 45511)
@@ -47,7 +47,7 @@
 	void fill(uint colour);
 	uint putAboveY(int y, int height) const;
 	uint centerOnX(int x, int width) const;
-	Common::Rect getRect() const;
+	Common::Rect getDimensions() const;
 
 private:
 	/** The current transparent colour of the surface. See getTransparentColour() and

Modified: scummvm/trunk/engines/draci/walking.h
===================================================================
--- scummvm/trunk/engines/draci/walking.h	2009-10-30 00:52:05 UTC (rev 45510)
+++ scummvm/trunk/engines/draci/walking.h	2009-10-30 01:41:57 UTC (rev 45511)
@@ -32,7 +32,8 @@
 
 class WalkingMap {
 public:
-	WalkingMap() : _realWidth(0), _realHeight(0), _mapWidth(0), _mapHeight(0), _byteWidth(0), _data(NULL) { }
+	WalkingMap() : _realWidth(0), _realHeight(0), _deltaX(1), _deltaY(1),
+		_mapWidth(0), _mapHeight(0), _byteWidth(0), _data(NULL) { }
 
 	void load(const byte *data, uint length);
 	bool isWalkable(int x, int y) const;
@@ -43,6 +44,8 @@
 	int _deltaX, _deltaY;
 	int _mapWidth, _mapHeight;
 	int _byteWidth;
+
+	// We don't own the pointer.  It points to the BArchive cache for this room.
 	const byte *_data;
 };
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list