From 04b048a9c3592a6a0dc492b937b5a4ed4851a14d Mon Sep 17 00:00:00 2001 From: Henry Bush Date: Wed, 19 Nov 2008 00:37:20 +0000 Subject: T7G: Add framework for microscope puzzle AI svn-id: r35122 --- engines/groovie/cell.cpp | 55 ++++++++++++++++++++++++++++++++++++++++++++++ engines/groovie/cell.h | 51 ++++++++++++++++++++++++++++++++++++++++++ engines/groovie/module.mk | 1 + engines/groovie/script.cpp | 24 ++++++++++++++------ engines/groovie/script.h | 3 ++- 5 files changed, 126 insertions(+), 8 deletions(-) create mode 100644 engines/groovie/cell.cpp create mode 100644 engines/groovie/cell.h (limited to 'engines/groovie') diff --git a/engines/groovie/cell.cpp b/engines/groovie/cell.cpp new file mode 100644 index 0000000000..5ec060c2d9 --- /dev/null +++ b/engines/groovie/cell.cpp @@ -0,0 +1,55 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/engines/groovie/script.cpp $ + * $Id: script.cpp 35096 2008-11-16 20:20:31Z lordhoto $ + * + */ + +#include "groovie/cell.h" + +namespace Groovie { + +CellGame::CellGame(byte *board) : + _board(board) { + + //printf ("*** In cellgame constructor ***"); +} + +byte CellGame::getStartX() { + return 0; // TODO: implement something here +} + +byte CellGame::getStartY() { + return 6; // TODO: implement something here +} + +byte CellGame::getEndX() { + return 1; // TODO: implement something here +} + +byte CellGame::getEndY() { + return 6; // TODO: implement something here +} + +CellGame::~CellGame() { +} + +} // End of Groovie namespace diff --git a/engines/groovie/cell.h b/engines/groovie/cell.h new file mode 100644 index 0000000000..862500938d --- /dev/null +++ b/engines/groovie/cell.h @@ -0,0 +1,51 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL: https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk/engines/groovie/script.h $ + * $Id: script.h 35095 2008-11-16 19:20:30Z spookypeanut $ + * + */ + +#ifndef GROOVIE_CELL_H +#define GROOVIE_CELL_H + +#include "common/file.h" + +namespace Groovie { + +class GroovieEngine; +class Script; + +class CellGame { +public: + CellGame(byte *board); + ~CellGame(); + byte getStartX(); + byte getStartY(); + byte getEndX(); + byte getEndY(); + +private: + byte *_board; +}; + +} // End of Groovie namespace + +#endif // GROOVIE_CELL_H diff --git a/engines/groovie/module.mk b/engines/groovie/module.mk index 1779c9786e..4a5d79cfb8 100644 --- a/engines/groovie/module.mk +++ b/engines/groovie/module.mk @@ -1,6 +1,7 @@ MODULE := engines/groovie MODULE_OBJS := \ + cell.o \ cursor.o \ debug.o \ detection.o \ diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp index 154f4e5d9f..894e4d2c60 100644 --- a/engines/groovie/script.cpp +++ b/engines/groovie/script.cpp @@ -27,6 +27,7 @@ #include "groovie/music.h" #include "groovie/script.h" #include "groovie/groovie.h" +#include "groovie/cell.h" #include "common/config-manager.h" #include "common/endian.h" @@ -1311,12 +1312,13 @@ void Script::o_sub() { setVariable(varnum1, _variables[varnum1] - _variables[varnum2]); } -void Script::o_othello() { +void Script::o_cellmove() { uint16 arg = readScript8bits(); byte *scriptBoard = &_variables[0x19]; byte board[7][7]; + byte startX, startY, endX, endY; - debugScript(1, true, "OTHELLO var[0x%02X]", arg); + debugScript(1, true, "CELL MOVE var[0x%02X]", arg); // Arguments used by the original implementation: (2, arg, scriptBoard) for (int y = 0; y < 7; y++) { @@ -1330,12 +1332,20 @@ void Script::o_othello() { debugScript(1, false, "\n"); } + CellGame staufsMove((byte*) board); + 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, 6); // y - setVariable(1, 0); // x + setVariable(0, startY); // y + setVariable(1, startX); // x // Set the movement destination - setVariable(2, 6); - setVariable(3, 1); + setVariable(2, endY); + setVariable(3, endX); } void Script::o_returnscript() { @@ -1525,7 +1535,7 @@ Script::OpcodeFunc Script::_opcodes[NUM_OPCODES] = { &Script::o_loadscript, &Script::o_setvideoorigin, // 0x40 &Script::o_sub, - &Script::o_othello, + &Script::o_cellmove, &Script::o_returnscript, &Script::o_sethotspotright, // 0x44 &Script::o_sethotspotleft, diff --git a/engines/groovie/script.h b/engines/groovie/script.h index abc7c49494..b39553b0a6 100644 --- a/engines/groovie/script.h +++ b/engines/groovie/script.h @@ -30,6 +30,7 @@ #include "common/rect.h" #include "groovie/font.h" +#include "groovie/cell.h" namespace Groovie { @@ -193,7 +194,7 @@ private: void o_loadscript(); void o_setvideoorigin(); void o_sub(); - void o_othello(); + void o_cellmove(); void o_returnscript(); void o_sethotspotright(); void o_sethotspotleft(); -- cgit v1.2.3