Fix for bug #1021538 (COMI: Graphic glitches in ship-to-ship fight)

svn-id: r14876
This commit is contained in:
Max Horn 2004-09-03 19:54:58 +00:00
parent 54a84da97c
commit 054460a170
3 changed files with 33 additions and 25 deletions

View File

@ -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() {

View File

@ -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();

View File

@ -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