aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Howell2006-04-17 01:31:02 +0000
committerTravis Howell2006-04-17 01:31:02 +0000
commit2c5874e9256b78bab5e532c7760b815003bb02e0 (patch)
tree3ab5f074f065baaebb8f4942600fb578feafde6f
parent3497bab17cc2a10d5200a274ac3b2932797b6c97 (diff)
downloadscummvm-rg350-2c5874e9256b78bab5e532c7760b815003bb02e0.tar.gz
scummvm-rg350-2c5874e9256b78bab5e532c7760b815003bb02e0.tar.bz2
scummvm-rg350-2c5874e9256b78bab5e532c7760b815003bb02e0.zip
Handle unsigned variableArray reads better in FF, fixes more missing subroutines
svn-id: r21958
-rw-r--r--engines/simon/simon.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/engines/simon/simon.cpp b/engines/simon/simon.cpp
index 5f8205b957..c7331851d4 100644
--- a/engines/simon/simon.cpp
+++ b/engines/simon/simon.cpp
@@ -998,10 +998,7 @@ uint SimonEngine::getVarOrWord() {
uint a = READ_BE_UINT16(_codePtr);
_codePtr += 2;
if (a >= 30000 && a < 30512) {
- if (getGameType() == GType_FF)
- return (uint16)readVariable(a - 30000);
- else
- return readVariable(a - 30000);
+ return readVariable(a - 30000);
}
return a;
}
@@ -1079,10 +1076,14 @@ uint SimonEngine::readVariable(uint variable) {
if (variable >= 255)
error("Variable %d out of range in read", variable);
- if (getGameType() == GType_FF && getBitFlag(83))
- return _variableArray2[variable];
- else
- return _variableArray[variable];
+ if (getGameType() == GType_FF) {
+ if (getBitFlag(83))
+ return (uint16)_variableArray2[variable];
+ else
+ return (uint16)_variableArray[variable];
+ } else {
+ return _variableArray[variable];
+ }
}
void SimonEngine::writeNextVarContents(uint16 contents) {
@@ -1368,7 +1369,8 @@ Subroutine *SimonEngine::getSubroutineByID(uint subroutine_id) {
return cur;
}
- debug(0,"getSubroutineByID: subroutine %d not found", subroutine_id);
+ if (subroutine_id != 160)
+ debug(0,"getSubroutineByID: subroutine %d not found", subroutine_id);
return NULL;
}
@@ -1989,7 +1991,7 @@ void SimonEngine::hitarea_stuff_helper() {
time_t cur_time;
if (getGameType() == GType_SIMON1) {
- uint subr_id = _variableArray[254];
+ uint subr_id = (uint16)_variableArray[254];
if (subr_id != 0) {
Subroutine *sub = getSubroutineByID(subr_id);
if (sub != NULL) {
@@ -2018,7 +2020,7 @@ void SimonEngine::hitarea_stuff_helper_2() {
uint subr_id;
Subroutine *sub;
- subr_id = _variableArray[249];
+ subr_id = (uint16)_variableArray[249];
if (subr_id != 0) {
sub = getSubroutineByID(subr_id);
if (sub != NULL) {
@@ -2029,7 +2031,7 @@ void SimonEngine::hitarea_stuff_helper_2() {
_variableArray[249] = 0;
}
- subr_id = _variableArray[254];
+ subr_id = (uint16)_variableArray[254];
if (subr_id != 0) {
sub = getSubroutineByID(subr_id);
if (sub != NULL) {