T7G: Add framework for microscope puzzle AI

svn-id: r35122
This commit is contained in:
Henry Bush 2008-11-19 00:37:20 +00:00
parent 1ec33154fd
commit 04b048a9c3
5 changed files with 126 additions and 8 deletions

55
engines/groovie/cell.cpp Normal file
View File

@ -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

51
engines/groovie/cell.h Normal file
View File

@ -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

View File

@ -1,6 +1,7 @@
MODULE := engines/groovie
MODULE_OBJS := \
cell.o \
cursor.o \
debug.o \
detection.o \

View File

@ -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,

View File

@ -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();