From 34747b792a42e8129af60371541e9b7321d4d55f Mon Sep 17 00:00:00 2001 From: Ludvig Strigeus Date: Thu, 11 Apr 2002 15:22:02 +0000 Subject: various code cleanups svn-id: r3907 --- actor.cpp | 8 ++++---- object.cpp | 22 +++++----------------- resource.cpp | 13 ++++++++----- script.cpp | 5 +---- script_v1.cpp | 27 ++++++--------------------- v3/resource_v3.cpp | 26 +++++++++++--------------- 6 files changed, 35 insertions(+), 66 deletions(-) diff --git a/actor.cpp b/actor.cpp index 1cc13c08dd..4f727fecd3 100644 --- a/actor.cpp +++ b/actor.cpp @@ -465,7 +465,7 @@ AdjustBoxResult Scumm::adjustXYToBeInBox(Actor *a, int x, int y, int pathfrom) { AdjustBoxResult abr,tmp; uint threshold; uint best; - int box, iterations = 0; /* Use inerations for those odd times we get stuck in the loop */ + int box, iterations = 0; /* Use iterations for those odd times we get stuck in the loop */ int firstValidBox,j; byte flags, b; @@ -478,12 +478,12 @@ AdjustBoxResult Scumm::adjustXYToBeInBox(Actor *a, int x, int y, int pathfrom) { abr.y = y; abr.dist = 0; + if ((_features & GF_SMALL_HEADER) && getClass(a->number, 21)) + return abr; + if (a && a->ignoreBoxes==0) { threshold = 30; - if ((_features & GF_SMALL_HEADER) && (_classData[a->number] & 0x200000)) - return abr; - while(1) { iterations++; if (iterations > 1000) return abr; /* Safety net */ diff --git a/object.cpp b/object.cpp index 3c32a5bd5e..8a3aaa6a25 100644 --- a/object.cpp +++ b/object.cpp @@ -29,14 +29,10 @@ bool Scumm::getClass(int obj, int cls) { checkRange(32,1,cls,"Class %d out of range in getClass"); if (_features & GF_SMALL_HEADER) { - byte *oldClass = (byte*)&_classData[obj]; if (cls == 32) // CLASS_TOUCHABLE cls = 23; - - return (oldClass[cls/8] & bit_table[cls&0x07]) != 0; - } else { - return (_classData[obj] & (1<<(cls-1))) != 0; } + return (_classData[obj] & (1<<(cls-1))) != 0; } void Scumm::putClass(int obj, int cls, bool set) { @@ -45,21 +41,13 @@ void Scumm::putClass(int obj, int cls, bool set) { checkRange(32,1,cls,"Class %d out of range in getClass"); if (_features & GF_SMALL_HEADER) { - byte *oldClass = (byte*)&_classData[obj]; if (cls == 32) // CLASS_TOUCHABLE cls = 23; - - if (set) - oldClass[cls/8] |= bit_table[cls&0x07]; - else - oldClass[cls/8] &= bit_table[cls&0x07]^0xff; - - } else { - if (set) - _classData[obj] |= (1<<(cls-1)); - else - _classData[obj] &= ~(1<<(cls-1)); } + if (set) + _classData[obj] |= (1<<(cls-1)); + else + _classData[obj] &= ~(1<<(cls-1)); } int Scumm::getOwner(int obj) { diff --git a/resource.cpp b/resource.cpp index 438f90e887..27f6babda8 100644 --- a/resource.cpp +++ b/resource.cpp @@ -272,13 +272,14 @@ void Scumm::readIndexFile() { } } fileRead(_fileHandle, _classData, num * sizeof(uint32)); - -/* #if defined(SCUMM_BIG_ENDIAN) - for (i=0; i> OF_STATE_SHL; } -/*#if defined(SCUMM_BIG_ENDIAN) - for (i=0; i