aboutsummaryrefslogtreecommitdiff
path: root/engines/groovie/script.cpp
diff options
context:
space:
mode:
authorHenry Bush2008-11-22 23:07:05 +0000
committerHenry Bush2008-11-22 23:07:05 +0000
commitd41ebfae814d6a687ba213a8da97c8c675b4a275 (patch)
tree72f43f9638bb5fd8b4bbcb8d4a3d225fa9a607bb /engines/groovie/script.cpp
parent056e6bcc9c80d9451f90239a2aef854368e1c4d2 (diff)
downloadscummvm-rg350-d41ebfae814d6a687ba213a8da97c8c675b4a275.tar.gz
scummvm-rg350-d41ebfae814d6a687ba213a8da97c8c675b4a275.tar.bz2
scummvm-rg350-d41ebfae814d6a687ba213a8da97c8c675b4a275.zip
T7G Microscope: Stauf now makes legal moves (though not good ones)
svn-id: r35154
Diffstat (limited to 'engines/groovie/script.cpp')
-rw-r--r--engines/groovie/script.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index 894e4d2c60..c1cdd1e7d4 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -1315,7 +1315,7 @@ void Script::o_sub() {
void Script::o_cellmove() {
uint16 arg = readScript8bits();
byte *scriptBoard = &_variables[0x19];
- byte board[7][7];
+ byte *board = (byte*) malloc (BOARDSIZE * BOARDSIZE * sizeof(byte));
byte startX, startY, endX, endY;
debugScript(1, true, "CELL MOVE var[0x%02X]", arg);
@@ -1323,22 +1323,23 @@ void Script::o_cellmove() {
// Arguments used by the original implementation: (2, arg, scriptBoard)
for (int y = 0; y < 7; y++) {
for (int x = 0; x < 7; x++) {
- board[x][y] = 0;
- if (*scriptBoard == 0x32) board[x][y] = 1;
- if (*scriptBoard == 0x42) board[x][y] = 2;
+ uint8 offset = x + BOARDSIZE * y;
+ *(board + offset) = 0;
+ if (*scriptBoard == 0x32) *(board + offset) = CELL_BLUE;
+ if (*scriptBoard == 0x42) *(board + offset) = CELL_GREEN;
scriptBoard++;
- debugScript(1, false, "%d", board[x][y]);
+ debugScript(1, false, "%d", *(board + offset));
}
debugScript(1, false, "\n");
}
CellGame staufsMove((byte*) board);
+ staufsMove.calcMove((byte*) board, CELL_GREEN, 2);
startX = staufsMove.getStartX();
startY = staufsMove.getStartY();
endX = staufsMove.getEndX();
endY = staufsMove.getEndY();
- //printf("Moving from %d,%d to %d,%d\n", startX, startY, endX, endY);
// Set the movement origin
setVariable(0, startY); // y
@@ -1346,6 +1347,8 @@ void Script::o_cellmove() {
// Set the movement destination
setVariable(2, endY);
setVariable(3, endX);
+
+ free (board);
}
void Script::o_returnscript() {