aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authoruruk2013-12-17 12:44:15 +0100
committeruruk2013-12-17 12:44:15 +0100
commitae16ced5b6cc0bff5cfdd1e2416df8c387dfba7c (patch)
tree766db83fe03cf8c02a77e84aac1d185776440239 /engines
parentad9c247ae3e5650581451e6a6edf13b33caf9085 (diff)
downloadscummvm-rg350-ae16ced5b6cc0bff5cfdd1e2416df8c387dfba7c.tar.gz
scummvm-rg350-ae16ced5b6cc0bff5cfdd1e2416df8c387dfba7c.tar.bz2
scummvm-rg350-ae16ced5b6cc0bff5cfdd1e2416df8c387dfba7c.zip
AVALANCHE: Implement text drawing and setup in Nim.
Diffstat (limited to 'engines')
-rw-r--r--engines/avalanche/graphics.h2
-rw-r--r--engines/avalanche/nim.cpp40
-rw-r--r--engines/avalanche/nim.h2
3 files changed, 40 insertions, 4 deletions
diff --git a/engines/avalanche/graphics.h b/engines/avalanche/graphics.h
index d54160229a..20f8176294 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 0f83e9b91c..7e63397179 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 e3b4584645..41ecb0664d 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();