patch #696030: CMI: More actor direction fixes

svn-id: r6662
This commit is contained in:
Max Horn 2003-03-02 15:51:56 +00:00
parent 73fa5d7b3a
commit f6bac973f8
2 changed files with 4 additions and 3 deletions

View file

@ -112,7 +112,7 @@ void Actor::setActorWalkSpeed(uint newSpeedX, uint newSpeedY)
int Scumm::getAngleFromPos(int x, int y) int Scumm::getAngleFromPos(int x, int y)
{ {
if (_gameId == GID_DIG) { if (_gameId == GID_DIG || _gameId == GID_CMI) {
double temp = atan2((double)x, (double)-y); double temp = atan2((double)x, (double)-y);
return normalizeAngle((int)(temp * 180 / 3.1415926535)); return normalizeAngle((int)(temp * 180 / 3.1415926535));
} else { } else {

View file

@ -218,7 +218,7 @@ void Scumm::getObjectXYPos(int object, int &x, int &y, int &dir)
y = od->walk_y; y = od->walk_y;
} }
if (_features & GF_AFTER_V8) if (_features & GF_AFTER_V8)
dir = od->actordir; dir = fromSimpleDir(1, od->actordir);
else else
dir = oldDirToNewDir(od->actordir & 3); dir = oldDirToNewDir(od->actordir & 3);
} }
@ -657,7 +657,8 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room, byte *searchptr)
od->y_pos = (int)READ_LE_UINT32(&imhd->v8.y_pos); od->y_pos = (int)READ_LE_UINT32(&imhd->v8.y_pos);
od->width = (uint)READ_LE_UINT32(&imhd->v8.width); od->width = (uint)READ_LE_UINT32(&imhd->v8.width);
od->height = (uint)READ_LE_UINT32(&imhd->v8.height); od->height = (uint)READ_LE_UINT32(&imhd->v8.height);
od->actordir = (byte)READ_LE_UINT32(&imhd->v8.actordir); // HACK: This is done sinec an angle doesn't fit into a byte (360 > 256)
od->actordir = toSimpleDir(1, READ_LE_UINT32(&imhd->v8.actordir));
} else if (_features & GF_AFTER_V7) { } else if (_features & GF_AFTER_V7) {
od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id)); od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id));