mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-18 16:03:05 +00:00
fixed wrong tile drawing above actors
svn-id: r17129
This commit is contained in:
parent
f6d0d6bdf1
commit
7e256531fd
@ -1094,8 +1094,7 @@ void Actor::handleActions(int msec, bool setup) {
|
||||
hitZone = NULL;
|
||||
// tiled stuff
|
||||
if (_vm->_scene->getFlags() & kSceneFlagISO) {
|
||||
hitPoint.x = actor->location.u();
|
||||
hitPoint.y = actor->location.v();
|
||||
actor->location.toScreenPointUV(hitPoint);
|
||||
} else {
|
||||
actor->location.toScreenPointXY(hitPoint);
|
||||
}
|
||||
@ -1259,7 +1258,7 @@ int Actor::drawActors() {
|
||||
|
||||
|
||||
if (_vm->_scene->getFlags() & kSceneFlagISO) {
|
||||
_vm->_isoMap->drawSprite(back_buf,*spriteList, frameNumber, drawObject->location, drawObject->screenPosition, drawObject->screenScale);
|
||||
_vm->_isoMap->drawSprite(back_buf, *spriteList, frameNumber, drawObject->location, drawObject->screenPosition, drawObject->screenScale);
|
||||
} else {
|
||||
_vm->_sprite->drawOccluded(back_buf, *spriteList, frameNumber, drawObject->screenPosition, drawObject->screenScale, drawObject->screenDepth);
|
||||
}
|
||||
|
@ -152,6 +152,9 @@ struct Location {
|
||||
int v() const {
|
||||
return y;
|
||||
}
|
||||
int uv() const {
|
||||
return u() + v();
|
||||
}
|
||||
void delta(const Location &location, Location &result) const {
|
||||
result.x = x - location.x;
|
||||
result.y = y - location.y;
|
||||
@ -171,6 +174,10 @@ struct Location {
|
||||
screenPoint.x = x / ACTOR_LMULT;
|
||||
screenPoint.y = y / ACTOR_LMULT;
|
||||
}
|
||||
void toScreenPointUV(Point &screenPoint) const {
|
||||
screenPoint.x = u();
|
||||
screenPoint.y = v();
|
||||
}
|
||||
void toScreenPointXYZ(Point &screenPoint) const {
|
||||
screenPoint.x = x / ACTOR_LMULT;
|
||||
screenPoint.y = y / ACTOR_LMULT - z;
|
||||
|
@ -129,9 +129,9 @@ void IsoMap::loadImages(const byte *resourcePointer, size_t resourceLength) {
|
||||
for (i = 0; i < _tilesCount; i++) {
|
||||
tileData = &_tilesTable[i];
|
||||
tileData->height = readS.readByte();
|
||||
tileData->attributes = readS.readByte();
|
||||
tileData->attributes = readS.readSByte();
|
||||
tileData->offset = readS.readUint16();
|
||||
tileData->terrainMask = readS.readSint16();
|
||||
tileData->terrainMask = readS.readUint16();
|
||||
tileData->FGDBGDAttr = readS.readByte();
|
||||
readS.readByte(); //skip
|
||||
}
|
||||
@ -638,7 +638,7 @@ void IsoMap::drawSpritePlatform(SURFACE *ds, uint16 platformIndex, const Point &
|
||||
tileIndex = findMulti(tileIndex, absU + u, absU + v, absH);
|
||||
}
|
||||
|
||||
drawTile(ds, tileIndex, s, &location);
|
||||
drawTile(ds, tileIndex, s, ©Location);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -791,17 +791,17 @@ void IsoMap::drawTile(SURFACE *ds, uint16 tileIndex, const Point &point, const L
|
||||
}
|
||||
break;
|
||||
case kMaskRuleYMIN:
|
||||
if (location->u() + location->v() < THRESH0 * 2) {
|
||||
if (location->uv() < THRESH0 * 2) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case kMaskRuleYMID:
|
||||
if (location->u() + location->v() < THRESH8 * 2) {
|
||||
if (location->uv() < THRESH8 * 2) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case kMaskRuleYMAX:
|
||||
if (location->u() + location->v() < THRESH16 * 2) {
|
||||
if (location->uv() < THRESH16 * 2) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
@ -91,19 +91,19 @@ struct IsoTileData {
|
||||
size_t offset;
|
||||
uint16 terrainMask;
|
||||
byte FGDBGDAttr;
|
||||
int8 GetMaskRule() {
|
||||
int8 GetMaskRule() const {
|
||||
return attributes & 0x0F;
|
||||
}
|
||||
byte GetFGDAttr() {
|
||||
byte GetFGDAttr() const {
|
||||
return FGDBGDAttr >> 4;
|
||||
}
|
||||
byte GetBGDAttr() {
|
||||
byte GetBGDAttr() const {
|
||||
return FGDBGDAttr & 0x0F;
|
||||
}
|
||||
uint16 GetFGDMask() {
|
||||
uint16 GetFGDMask() const {
|
||||
return 1 << GetFGDAttr();
|
||||
}
|
||||
uint16 GetBGDMask() {
|
||||
uint16 GetBGDMask() const {
|
||||
return 1 << GetBGDAttr();
|
||||
}
|
||||
};
|
||||
@ -160,7 +160,7 @@ public:
|
||||
void adjustScroll(bool jump);
|
||||
void tileCoordsToScreenPoint(const Location &location, Point &position) {
|
||||
position.x = location.u() - location.v() + (128 * SAGA_TILEMAP_W) - _viewScroll.x + 16;
|
||||
position.y = -((location.u() + location.v()) >> 1) + (128 * SAGA_TILEMAP_W) - _viewScroll.y - location.z;
|
||||
position.y = -(location.uv() >> 1) + (128 * SAGA_TILEMAP_W) - _viewScroll.y - location.z;
|
||||
}
|
||||
void screenPointToTileCoords(const Point &position, Location &location);
|
||||
void placeOnTileMap(const Location &start, Location &result, int16 distance, uint16 direction);
|
||||
|
Loading…
x
Reference in New Issue
Block a user