From 4d0c43520f8019746192a26d08f18d44d7bb1c3d Mon Sep 17 00:00:00 2001 From: James Brown Date: Wed, 13 Mar 2002 04:57:33 +0000 Subject: Fix an OB1 and typecast. Need to find out cause of invalid object index to begin with.. svn-id: r3738 --- object.cpp | 5 ----- script_v1.cpp | 9 +++++---- scumm.h | 4 ++-- sound/fmopl.cpp | 2 +- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/object.cpp b/object.cpp index 32b0e14788..df857cbb6b 100644 --- a/object.cpp +++ b/object.cpp @@ -94,11 +94,6 @@ int Scumm::whereIsObject(int object) { if (object >= _numGlobalObjects) return WIO_NOT_FOUND; - if (object < 0) { - warning("FIXME! Negative object index! Very bad.."); - return WIO_NOT_FOUND; - } - if (_objectOwnerTable[object] != OF_OWNER_ROOM) { for (i=0; i<_maxInventoryItems; i++) if (_inventory[i] == object) diff --git a/script_v1.cpp b/script_v1.cpp index ec4155f34c..82c98e3409 100644 --- a/script_v1.cpp +++ b/script_v1.cpp @@ -1294,7 +1294,7 @@ void Scumm::o5_getObjectOwner() { void Scumm::o5_getObjectState() { if(_features & GF_SMALL_HEADER) { - if((getState(getVarOrDirectWord(0x80)) &0x0F >>4) != getVarOrDirectByte(0x40)) + if((getState(getVarOrDirectWord(0x80)) &0x0F >>4) != (int)getVarOrDirectByte(0x40)) o5_jumpRelative(); else ignoreScriptWord(); @@ -1319,6 +1319,7 @@ void Scumm::o5_getVerbEntrypoint() { getResultPos(); a = getVarOrDirectWord(0x80); b = getVarOrDirectWord(0x40); + setResult(getVerbEntrypoint(a, b)); } @@ -2377,13 +2378,13 @@ int Scumm::getWordVararg(int16 *ptr) { return i; } -int Scumm::getVarOrDirectWord(byte mask) { +uint Scumm::getVarOrDirectWord(byte mask) { if (_opcode&mask) return readVar(fetchScriptWord()); - return (int16)fetchScriptWord(); + return (uint16)fetchScriptWord(); } -int Scumm::getVarOrDirectByte(byte mask) { +uint Scumm::getVarOrDirectByte(byte mask) { if (_opcode&mask) return readVar(fetchScriptWord()); return fetchScriptByte(); diff --git a/scumm.h b/scumm.h index d315f574a4..5a1ed38160 100644 --- a/scumm.h +++ b/scumm.h @@ -1320,8 +1320,8 @@ struct Scumm { int fetchScriptWord(); void ignoreScriptWord() { fetchScriptWord(); } void ignoreScriptByte() { fetchScriptByte(); } - int getVarOrDirectWord(byte mask); - int getVarOrDirectByte(byte mask); + uint getVarOrDirectWord(byte mask); + uint getVarOrDirectByte(byte mask); int readVar(uint var); void writeVar(uint var, int value); void getResultPos(); diff --git a/sound/fmopl.cpp b/sound/fmopl.cpp index 55da77e793..880ee992bd 100644 --- a/sound/fmopl.cpp +++ b/sound/fmopl.cpp @@ -558,7 +558,7 @@ static void init_timetables( FM_OPL *OPL , int ARRATE , int DRRATE ) OPL->AR_TABLE[i] = (int) (rate / ARRATE); OPL->DR_TABLE[i] = (int) (rate / DRRATE); } - for (i = 60;i < 76;i++) + for (i = 60;i < 75;i++) { OPL->AR_TABLE[i] = EG_AED-1; OPL->DR_TABLE[i] = OPL->DR_TABLE[60]; -- cgit v1.2.3