diff options
author | Max Horn | 2004-09-03 19:54:58 +0000 |
---|---|---|
committer | Max Horn | 2004-09-03 19:54:58 +0000 |
commit | 054460a170d60d6b74114882e15af22b284f3066 (patch) | |
tree | 83e424514385a99b75b4b70fd828278d6a67e969 /scumm | |
parent | 54a84da97c1aab75ed1cec46f65691a00d4ff87a (diff) | |
download | scummvm-rg350-054460a170d60d6b74114882e15af22b284f3066.tar.gz scummvm-rg350-054460a170d60d6b74114882e15af22b284f3066.tar.bz2 scummvm-rg350-054460a170d60d6b74114882e15af22b284f3066.zip |
Fix for bug #1021538 (COMI: Graphic glitches in ship-to-ship fight)
svn-id: r14876
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/actor.cpp | 39 | ||||
-rw-r--r-- | scumm/actor.h | 4 | ||||
-rw-r--r-- | scumm/script_v8.cpp | 15 |
3 files changed, 33 insertions, 25 deletions
diff --git a/scumm/actor.cpp b/scumm/actor.cpp index 5dcaa334df..54c847099c 100644 --- a/scumm/actor.cpp +++ b/scumm/actor.cpp @@ -986,11 +986,13 @@ void ScummEngine::processUpperActors() { } } -void Actor::drawActorCostume() { - if (!needRedraw) - return; - - needRedraw = false; +void Actor::drawActorCostume(bool hitTestMode) { + if (!hitTestMode) { + if (!needRedraw) + return; + + needRedraw = false; + } setupActorScale(); @@ -1055,9 +1057,9 @@ void Actor::drawActorCostume() { } - bcr->_draw_top = top = 0x7fffffff; + bcr->_draw_top = 0x7fffffff; + bcr->_draw_bottom = 0; - bcr->_draw_bottom = bottom = 0; bcr->_skipLimb = (skipLimb != 0); // If the actor is partially hidden, redraw it next frame. @@ -1066,9 +1068,26 @@ void Actor::drawActorCostume() { needRedraw = (_vm->_version <= 6); } - // Record the vertical extent of the drawn actor - top = bcr->_draw_top; - bottom = bcr->_draw_bottom; + if (!hitTestMode) { + // Record the vertical extent of the drawn actor + top = bcr->_draw_top; + bottom = bcr->_draw_bottom; + } +} + +bool Actor::actorHitTest(int x, int y) { + AkosRenderer *ar = (AkosRenderer *)_vm->_costumeRenderer; + + ar->_actorHitX = x; + ar->_actorHitY = y; + ar->_actorHitMode = true; + ar->_actorHitResult = false; + + drawActorCostume(true); + + ar->_actorHitMode = false; + + return ar->_actorHitResult; } void Actor::animateCostume() { diff --git a/scumm/actor.h b/scumm/actor.h index 40c4f5cd6b..58bf6505cd 100644 --- a/scumm/actor.h +++ b/scumm/actor.h @@ -156,12 +156,14 @@ public: void turnToDirection(int newdir); void walkActor(); void walkActorOld(); - void drawActorCostume(); + void drawActorCostume(bool hitTestMode = false); void animateCostume(); void setActorCostume(int c); void animateLimb(int limb, int f); + bool actorHitTest(int x, int y); + byte *getActorName(); void startWalkActor(int x, int y, int dir); void stopActorMoving(); diff --git a/scumm/script_v8.cpp b/scumm/script_v8.cpp index ae7e7507ce..5f924163e6 100644 --- a/scumm/script_v8.cpp +++ b/scumm/script_v8.cpp @@ -1402,20 +1402,7 @@ void ScummEngine_v8::o8_kernelGetFunctions() { case 0xD9: { // actorHit - used, for example, to detect ship collision // during ship-to-ship combat. Actor *a = derefActor(args[1], "actorHit"); - AkosRenderer *ar = (AkosRenderer *) _costumeRenderer; - bool old_need_redraw = a->needRedraw; - - ar->_actorHitX = args[2]; - ar->_actorHitY = args[3] + _screenTop; - ar->_actorHitMode = true; - ar->_actorHitResult = false; - - a->needRedraw = true; - a->drawActorCostume(); - a->needRedraw = old_need_redraw; - - ar->_actorHitMode = false; - push(ar->_actorHitResult); + push(a->actorHitTest(args[2], args[3] + _screenTop)); break; } case 0xDA: // lipSyncWidth |