Get rid of unused variables and removed them from the save data ; FloodFill.unk1C and _curExecScript.

Concerning _curExecScript, I checked several interpreters (even one with windex compiled in), the only function where it's used is runAllScripts.

svn-id: r19977
This commit is contained in:
Gregory Montoir 2006-01-10 21:39:14 +00:00
parent 10936be5f6
commit f6c6196295
10 changed files with 13 additions and 20 deletions

View File

@ -912,7 +912,7 @@ void ScummEngine::playActorSounds() {
Actor *ScummEngine::derefActor(int id, const char *errmsg) const {
if (id == 0)
debugC(DEBUG_ACTORS, "derefActor(0, \"%s\") in script %d, opcode 0x%x",
errmsg, vm.slot[_curExecScript].number, _opcode);
errmsg, vm.slot[_currentScript].number, _opcode);
if (id < 0 || id >= _numActors || _actors[id]._number != id) {
if (errmsg)
@ -926,11 +926,11 @@ Actor *ScummEngine::derefActor(int id, const char *errmsg) const {
Actor *ScummEngine::derefActorSafe(int id, const char *errmsg) const {
if (id == 0)
debugC(DEBUG_ACTORS, "derefActorSafe(0, \"%s\") in script %d, opcode 0x%x",
errmsg, vm.slot[_curExecScript].number, _opcode);
errmsg, vm.slot[_currentScript].number, _opcode);
if (id < 0 || id >= _numActors || _actors[id]._number != id) {
debugC(DEBUG_ACTORS, "Invalid actor %d in %s (script %d, opcode 0x%x)",
id, errmsg, vm.slot[_curExecScript].number, _opcode);
id, errmsg, vm.slot[_currentScript].number, _opcode);
return NULL;
}
return &_actors[id];

View File

@ -32,7 +32,6 @@ struct FloodFillParameters {
int32 x;
int32 y;
int32 flags;
int32 unk1C; /* unused */
};
struct FloodFillLine {

View File

@ -37,8 +37,8 @@
namespace Scumm {
ResExtractor::ResExtractor(ScummEngine_v70he *scumm) {
_vm = scumm;
ResExtractor::ResExtractor(ScummEngine_v70he *scumm)
: _vm(scumm) {
_fileName[0] = 0;
memset(_cursorCache, 0, sizeof(_cursorCache));

View File

@ -701,7 +701,7 @@ void ScummEngine::saveOrLoad(Serializer *s) {
MKARRAY_OLD(ScummEngine, _charsetData[0][0], sleByte, 10 * 16, VER(8), VER(9)),
MKARRAY(ScummEngine, _charsetData[0][0], sleByte, 15 * 16, VER(10)),
MKLINE(ScummEngine, _curExecScript, sleUint16, VER(8)),
MK_OBSOLETE(ScummEngine, _curExecScript, sleUint16, VER(8), VER(62)),
MKLINE(ScummEngine, camera._dest.x, sleInt16, VER(8)),
MKLINE(ScummEngine, camera._dest.y, sleInt16, VER(8)),
@ -1280,7 +1280,7 @@ void ScummEngine_v90he::saveOrLoad(Serializer *s) {
MKLINE(FloodFillParameters, x, sleInt32, VER(51)),
MKLINE(FloodFillParameters, y, sleInt32, VER(51)),
MKLINE(FloodFillParameters, flags, sleInt32, VER(51)),
MKLINE(FloodFillParameters, unk1C, sleInt32, VER(51)),
MK_OBSOLETE(FloodFillParameters, unk1C, sleInt32, VER(51), VER(62)),
MKEND()
};

View File

@ -45,7 +45,7 @@ namespace Scumm {
* only saves/loads those which are valid for the version of the savegame
* which is being loaded/saved currently.
*/
#define CURRENT_VER 62
#define CURRENT_VER 63
/**
* An auxillary macro, used to specify savegame versions. We use this instead

View File

@ -889,17 +889,13 @@ void ScummEngine::runAllScripts() {
for (i = 0; i < NUM_SCRIPT_SLOT; i++)
vm.slot[i].didexec = 0;
// FIXME - why is _curExecScript?!? The only place it is ever set is here.
// The outer world will only see it as consequence of the calls made in the following
// for loop. But in that case, _curExecScript will be equal to _currentScript. Hence
// it would seem we can replace all occurances of _curExecScript by _currentScript.
_currentScript = 0xFF;
int numCycles = (_heversion >= 90) ? VAR(VAR_NUM_SCRIPT_CYCLES) : 1;
for (int cycle = 1; cycle <= numCycles; cycle++) {
for (_curExecScript = 0; _curExecScript < NUM_SCRIPT_SLOT; _curExecScript++) {
if (vm.slot[_curExecScript].cycle == cycle && vm.slot[_curExecScript].status == ssRunning && vm.slot[_curExecScript].didexec == 0) {
_currentScript = (byte)_curExecScript;
for (i = 0; i < NUM_SCRIPT_SLOT; i++) {
if (vm.slot[i].cycle == cycle && vm.slot[i].status == ssRunning && vm.slot[i].didexec == 0) {
_currentScript = (byte)i;
getScriptBaseAddress();
getScriptEntryPoint();
executeScript();

View File

@ -887,7 +887,7 @@ void ScummEngine_v100he::o100_floodFill() {
_floodFillParams.flags = pop();
break;
case 67:
_floodFillParams.unk1C = pop();
pop();
break;
case 92:
floodFill(&_floodFillParams, this);

View File

@ -1767,7 +1767,7 @@ void ScummEngine_v90he::o90_floodFill() {
switch (subOp) {
case 0:
_floodFillParams.unk1C = pop();
pop();
break;
case 3:
memset(&_floodFillParams, 0, sizeof(_floodFillParams));

View File

@ -1104,7 +1104,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS
_scriptOrgPointer = NULL;
_opcode = 0;
vm.numNestedScripts = 0;
_curExecScript = 0;
_lastCodePtr = NULL;
_resultVarNumber = 0;
_scummStackPos = 0;

View File

@ -616,7 +616,6 @@ protected:
uint32 _localScriptOffsets[1024];
const byte *_scriptPointer, *_scriptOrgPointer;
byte _opcode, _currentScript;
uint16 _curExecScript;
const byte * const *_lastCodePtr;
int _resultVarNumber, _scummStackPos;
int _vmStack[150];