[Scummvm-cvs-logs] scummvm master -> 96d4b67d417d836a43e9382b020fac5a81e02dca

urukgit urukgit at users.noreply.github.com
Wed Jan 15 18:00:33 CET 2014


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:
b5b0aa25e0 AVALANCHE: Implement setBackgroundColor().
96d4b67d41 AVALANCHE: Implement, rename, move zonk() and connected functions.


Commit: b5b0aa25e00c832289c62526290ca6cc78f8eaae
    https://github.com/scummvm/scummvm/commit/b5b0aa25e00c832289c62526290ca6cc78f8eaae
Author: uruk (koppirnyo at gmail.com)
Date: 2014-01-15T09:00:03-08:00

Commit Message:
AVALANCHE: Implement setBackgroundColor().

Changed paths:
    engines/avalanche/graphics.cpp
    engines/avalanche/graphics.h



diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index 4b8d667..ec90e96 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -811,9 +811,12 @@ void GraphicManager::setDialogColor(Color bg, Color text) {
 	_talkFontColor = text;
 }
 
-// Original name background()
-void GraphicManager::setBackgroundColor(Color x) {
-	warning("STUB: setBackgroundColor()");
+/**
+* Changes the black color of the palette to the selected one.
+* @remarks	Originally called 'background'
+*/
+void GraphicManager::setBackgroundColor(Color newColor) {
+	g_system->getPaletteManager()->setPalette(_egaPalette[kEgaPaletteIndex[newColor]], kColorBlack, 1);
 }
 
 } // End of namespace Avalanche
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index 0de2361..e19438f 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -107,7 +107,7 @@ public:
 	void refreshScreen();
 	void loadBackground(Common::File &file);
 	void refreshBackground();
-	void setBackgroundColor(Color x);
+	void setBackgroundColor(Color newColor);
 	void setDialogColor(Color bg, Color text);
 
 	void zoomOut(int16 x, int16 y);


Commit: 96d4b67d417d836a43e9382b020fac5a81e02dca
    https://github.com/scummvm/scummvm/commit/96d4b67d417d836a43e9382b020fac5a81e02dca
Author: uruk (koppirnyo at gmail.com)
Date: 2014-01-15T09:00:04-08:00

Commit Message:
AVALANCHE: Implement, rename, move zonk() and connected functions.

Implementations: zonk(), zl().
Renames: zonk() -> thunder(), zl() -> drawLightning().
Moved: the 2 above from Pingo to Animation.
Addition: GraphicManager::drawLine().

Changed paths:
    engines/avalanche/animation.cpp
    engines/avalanche/animation.h
    engines/avalanche/graphics.cpp
    engines/avalanche/graphics.h
    engines/avalanche/parser.cpp
    engines/avalanche/pingo.cpp
    engines/avalanche/pingo.h



diff --git a/engines/avalanche/animation.cpp b/engines/avalanche/animation.cpp
index 66097b2..9f9822e 100644
--- a/engines/avalanche/animation.cpp
+++ b/engines/avalanche/animation.cpp
@@ -1399,6 +1399,50 @@ void Animation::handleMoveKey(const Common::Event &event) {
 	}
 }
 
+/**
+* Draws a part of the lightning bolt for thunder().
+* @remarks	Originally called 'zl'
+*/
+void Animation::drawLightning(int16 x1, int16 y1, int16 x2, int16 y2) {
+	_vm->_graphics->drawLine(x1, y1 - 1, x2, y2 - 1, 1, 3, kColorBlue);
+	_vm->_graphics->drawLine(x1, y1, x2, y2, 1, 1, kColorLightcyan);
+}
+
+/**
+* Plays the actual thunder animation when Avvy (the player) swears too much.
+* @remarks	Originally called 'zonk'
+*/
+void Animation::thunder() {
+	_vm->_graphics->setBackgroundColor(kColorYellow);
+
+	_vm->_graphics->saveScreen();
+
+	int x = _vm->_animation->_sprites[0]->_x + _vm->_animation->_sprites[0]->_xLength / 2;
+	int y = _vm->_animation->_sprites[0]->_y;
+
+	for (int i = 0; i < 256; i++) {
+		_vm->_sound->playNote(270 - i, 1);
+
+		drawLightning(640, 0, 0, y / 4);
+		drawLightning(0, y / 4, 640, y / 2);
+		drawLightning(640, y / 2, x, y);
+		_vm->_graphics->refreshScreen();
+
+		_vm->_sound->playNote(2700 - 10 * i, 5);
+		_vm->_system->delayMillis(5);
+		_vm->_sound->playNote(270 - i, 1);
+
+		_vm->_graphics->restoreScreen();
+		_vm->_sound->playNote(2700 - 10 * i, 5);
+		_vm->_system->delayMillis(5);
+	}
+
+	_vm->_graphics->restoreScreen();
+	_vm->_graphics->removeBackup();
+
+	_vm->_graphics->setBackgroundColor(kColorBlack);
+}
+
 void Animation::setDirection(Direction dir) {
 	_direction = dir;
 }
diff --git a/engines/avalanche/animation.h b/engines/avalanche/animation.h
index cda5f05..d3b52c7 100644
--- a/engines/avalanche/animation.h
+++ b/engines/avalanche/animation.h
@@ -125,6 +125,10 @@ public:
 	void handleMoveKey(const Common::Event &event);
 	void hideInCupboard();
 
+	// These 2 functions are responsible for playing the thunder animation when the player swears too much.
+	void drawLightning(int16 x1, int16 y1, int16 x2, int16 y2);
+	void thunder();
+
 	void setDirection(Direction dir);
 	void setOldDirection(Direction dir);
 	Direction getDirection();
diff --git a/engines/avalanche/graphics.cpp b/engines/avalanche/graphics.cpp
index ec90e96..fec483b 100644
--- a/engines/avalanche/graphics.cpp
+++ b/engines/avalanche/graphics.cpp
@@ -281,6 +281,10 @@ Common::Point GraphicManager::drawArc(Graphics::Surface &surface, int16 x, int16
 	return endPoint;
 }
 
+void GraphicManager::drawLine(int x1, int y1, int x2, int y2, int penX, int penY, Color color) {
+	_surface.drawThickLine(x1, y1, x2, y2, penX, penY, color);
+}
+
 Common::Point GraphicManager::drawScreenArc(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color) {
 	return drawArc(_surface, x, y, stAngle, endAngle, radius, color);
 }
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index e19438f..4c811e5 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -58,6 +58,7 @@ public:
 	void loadDigits();
 	void loadMouse(byte which);
 
+	void drawLine(int x1, int y1, int x2, int y2, int penX, int penY, Color color);
 	Common::Point drawScreenArc(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color);
 	void drawPieSlice(int16 x, int16 y, int16 stAngle, int16 endAngle, uint16 radius, Color color);
 	void drawTriangle(Common::Point *p, Color color);
@@ -115,8 +116,8 @@ public:
 	void getNaturalPicture(SpriteType &sprite);
 
 	void saveScreen();
-	void removeBackup();
 	void restoreScreen();
+	void removeBackup();
 
 private:
 	static const uint16 kBackgroundWidth = kScreenWidth;
diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp
index 7ba482f..362c818 100644
--- a/engines/avalanche/parser.cpp
+++ b/engines/avalanche/parser.cpp
@@ -2108,7 +2108,7 @@ void Parser::doThat() {
 			}
 			break;
 		default: {
-			_vm->_pingo->zonk();
+			_vm->_animation->thunder();
 			Common::String tmpStr = Common::String::format("A crack of lightning shoots from the sky, and fries you." \
 				"%c%c(`Such is the anger of the gods, Avvy!\")", kControlNewLine, kControlNewLine);
 			_vm->_dialogs->displayText(tmpStr);
diff --git a/engines/avalanche/pingo.cpp b/engines/avalanche/pingo.cpp
index 433924f..d8550f9 100644
--- a/engines/avalanche/pingo.cpp
+++ b/engines/avalanche/pingo.cpp
@@ -60,14 +60,6 @@ void Pingo::wobble() {
 	warning("STUB: Pingo::wobble()");
 }
 
-void Pingo::zl(int16 x1, int16 y1, int16 x2, int16 y2) {
-	warning("STUB: Pingo::zl()");
-}
-
-void Pingo::zonk() {
-	warning("STUB: Pingo::zonk()");
-}
-
 void Pingo::winningPic() {
 	Common::File f;
 	_vm->fadeOut();
diff --git a/engines/avalanche/pingo.h b/engines/avalanche/pingo.h
index 72fdb54..e3a516c 100644
--- a/engines/avalanche/pingo.h
+++ b/engines/avalanche/pingo.h
@@ -44,14 +44,12 @@ public:
 	void copy03();
 	void copyPage(byte frp, byte top);
 	void wobble();
-	void zonk();
 	void winningPic();
 
 private:
 	AvalancheEngine *_vm;
 
 	void dPlot(int16 x, int16 y, Common::String z);
-	void zl(int16 x1, int16 y1, int16 x2, int16 y2);
 };
 
 } // End of namespace Avalanche.






More information about the Scummvm-git-logs mailing list