[Scummvm-cvs-logs] scummvm master -> ae16ced5b6cc0bff5cfdd1e2416df8c387dfba7c
urukgit
urukgit at users.noreply.github.com
Tue Dec 17 12:45:02 CET 2013
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
ae16ced5b6 AVALANCHE: Implement text drawing and setup in Nim.
Commit: ae16ced5b6cc0bff5cfdd1e2416df8c387dfba7c
https://github.com/scummvm/scummvm/commit/ae16ced5b6cc0bff5cfdd1e2416df8c387dfba7c
Author: uruk (koppirnyo at gmail.com)
Date: 2013-12-17T03:44:15-08:00
Commit Message:
AVALANCHE: Implement text drawing and setup in Nim.
Changed paths:
engines/avalanche/graphics.h
engines/avalanche/nim.cpp
engines/avalanche/nim.h
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index d541602..20f8176 100644
--- a/engines/avalanche/graphics.h
+++ b/engines/avalanche/graphics.h
@@ -82,6 +82,8 @@ public:
void drawRectangle(Common::Rect rect, Color color);
void loadNim();
void drawNimStone(int x, int y);
+ // Maybe we'll be able to get rid of these two and squeeze them into loadNim() later
+ // since I am not sure that we'll need to redraw them any other times.
void drawNimInitials();
void drawNimLogo();
diff --git a/engines/avalanche/nim.cpp b/engines/avalanche/nim.cpp
index 0f83e9b..7e63397 100644
--- a/engines/avalanche/nim.cpp
+++ b/engines/avalanche/nim.cpp
@@ -131,13 +131,25 @@ void Nim::playNim() {
}
}
-void Nim::chalk(int x,int y, Common::String z) {
- warning("STUB: Nim::chalk()");
+void Nim::chalk(int x, int y, Common::String text) {
+ const Color greys[] = { kColorBlack, kColorDarkgray, kColorLightgray, kColorWhite };
+
+ for (int i = 0; i < 4; i++) {
+ _vm->_graphics->drawNormalText(text, _vm->_font, 8, x - i, y, greys[i]);
+ _vm->_graphics->refreshScreen();
+ int freq = i * 100 * text.size();
+ if (freq == 0)
+ _vm->_system->delayMillis(3);
+ else
+ _vm->_sound->playNote(freq, 3);
+ _vm->_system->delayMillis(30);
+ }
}
void Nim::setup() {
_vm->fadeIn();
_vm->_graphics->loadNim();
+
_vm->_graphics->drawFilledRectangle(Common::Rect(0, 0, 640, 200), kColorBlack);
// Upper left rectangle.
_vm->_graphics->drawRectangle(Common::Rect(10, 5, 381, 71), kColorRed);
@@ -148,10 +160,32 @@ void Nim::setup() {
_vm->_graphics->drawNimLogo();
_vm->_graphics->drawNimInitials();
+
+ _vm->_graphics->drawNormalText("SCOREBOARD:", _vm->_font, 8, 475, 45, kColorWhite);
+ _vm->_graphics->drawNormalText("Turn:", _vm->_font, 8, 420, 55, kColorYellow);
+ _vm->_graphics->drawNormalText("Player:", _vm->_font, 8, 490, 55, kColorYellow);
+ _vm->_graphics->drawNormalText("Move:", _vm->_font, 8, 570, 55, kColorYellow);
+ chalk(27, 7, "Take pieces away with:");
+ chalk(77, 17, "1) the mouse (click leftmost)");
+ chalk(53, 27, "or 2) the keyboard:");
+ chalk(220, 27, Common::String(24) + '/' + 25 + ": choose row,");
+ chalk(164, 37, Common::String("+/- or ") + 27 + '/' + 26 + ": more/fewer,");
+ chalk(204, 47, "Enter: take stones.");
+
_vm->_graphics->refreshScreen();
- warning("STUB: Nim::setup()");
+ for (int i = 0; i < 3; i++)
+ _stones[i] = i + 3;
+ _stonesLeft = 12;
+
+ _turns = 0;
+ _dogfoodsTurn = true;
+
+ _row = 1;
+ _number = 1;
+ for (int i = 0; i < 3; i++)
+ _old[i] = 0;
}
void Nim::plotStone(byte x,byte y) {
diff --git a/engines/avalanche/nim.h b/engines/avalanche/nim.h
index e3b4584..41ecb06 100644
--- a/engines/avalanche/nim.h
+++ b/engines/avalanche/nim.h
@@ -54,7 +54,7 @@ private:
int8 _mNum, _mRow;
byte _playedNim; // How many times you've played Nim.
- void chalk(int x,int y, Common::String z);
+ void chalk(int x, int y, Common::String text);
void setup();
void plotStone(byte x,byte y);
void board();
More information about the Scummvm-git-logs
mailing list