diff options
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/actor.cpp | 44 | ||||
-rw-r--r-- | scumm/intern.h | 2 | ||||
-rw-r--r-- | scumm/scumm.h | 2 |
3 files changed, 29 insertions, 19 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index 7903527a7a..559e28571f 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -1297,29 +1297,37 @@ int ScummEngine::getActorFromPos(int x, int y) { if (!testGfxAnyUsageBits(x / 8)) return 0; - if (_heversion >= 70) { - int result = 0; - - for (i = 1; i < _numActors; i++) { - if (testGfxUsageBit(x / 8, i) && !getClass(i, kObjectClassUntouchable) - && y >= _actors[i]._top && y <= _actors[i]._bottom && _actors[i]._pos.y > _actors[result]._pos.y) { - if (_version > 2 || i != VAR(VAR_EGO)) { - result = i; - } - } + for (i = 1; i < _numActors; i++) { + if (testGfxUsageBit(x / 8, i) && !getClass(i, kObjectClassUntouchable) + && y >= _actors[i]._top && y <= _actors[i]._bottom) { + if (_version > 2 || i != VAR(VAR_EGO)) + return i; } - return result; - } else { - for (i = 1; i < _numActors; i++) { - if (testGfxUsageBit(x / 8, i) && !getClass(i, kObjectClassUntouchable) - && y >= _actors[i]._top && y <= _actors[i]._bottom) { - if (_version > 2 || i != VAR(VAR_EGO)) - return i; + } + + return 0; +} + +#ifndef DISABLE_HE +int ScummEngine_v70he::getActorFromPos(int x, int y) { + int i; + int result = 0; + + if (!testGfxAnyUsageBits(x / 8)) + return 0; + + for (i = 1; i < _numActors; i++) { + if (testGfxUsageBit(x / 8, i) && !getClass(i, kObjectClassUntouchable) + && y >= _actors[i]._top && y <= _actors[i]._bottom && _actors[i]._pos.y > _actors[result]._pos.y) { + if (_version > 2 || i != VAR(VAR_EGO)) { + result = i; } } - return 0; } + + return result; } +#endif #ifndef DISABLE_SCUMM_7_8 void ScummEngine_v7::actorTalk(const byte *msg) { diff --git a/scumm/intern.h b/scumm/intern.h index daf6e581c3..67031bb0b1 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -830,6 +830,8 @@ protected: virtual void readGlobalObjects(); virtual void readIndexBlock(uint32 blocktype, uint32 itemsize); + virtual int getActorFromPos(int x, int y); + int getStringCharWidth(byte chr); virtual int setupStringArray(int size); void appendSubstring(int dst, int src, int len2, int len); diff --git a/scumm/scumm.h b/scumm/scumm.h index 6af29e1287..989fd67084 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -842,7 +842,7 @@ protected: void resetActorBgs(); virtual void processActors(); void processUpperActors(); - int getActorFromPos(int x, int y); + virtual int getActorFromPos(int x, int y); public: /* Actor talking stuff */ |