aboutsummaryrefslogtreecommitdiff
path: root/saga
diff options
context:
space:
mode:
authorEugene Sandulenko2005-10-07 05:31:13 +0000
committerEugene Sandulenko2005-10-07 05:31:13 +0000
commitfe48a005177228f7b63dbd1d73630336de5c15cd (patch)
treec932048f79b3472ddc688cf314ee08aa0e36ccb4 /saga
parent5f20bf11e6b694319d1d6a3e8df833008bbb56b7 (diff)
downloadscummvm-rg350-fe48a005177228f7b63dbd1d73630336de5c15cd.tar.gz
scummvm-rg350-fe48a005177228f7b63dbd1d73630336de5c15cd.tar.bz2
scummvm-rg350-fe48a005177228f7b63dbd1d73630336de5c15cd.zip
Draw acrtors (eriktorbjorn, rejoice).
It: o breaks intro, as now everything seems to be shifted. o Shows problem at our firt scene where there is no inventory drawn o Shows problem with our animation code, actor frames are wrong o Draws actors upside down and probably at wrong location o Due to incomplete implementation of whichObject() it crashes when you hover over characters. svn-id: r18952
Diffstat (limited to 'saga')
-rw-r--r--saga/actor.cpp21
-rw-r--r--saga/game.cpp2
-rw-r--r--saga/sfuncs.cpp3
-rw-r--r--saga/sprite.cpp34
4 files changed, 31 insertions, 29 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp
index f630bb659f..bb76f114a0 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -403,7 +403,7 @@ void Actor::loadActorList(int protagonistIdx, int actorCount, int actorsResource
_actorsCount = actorCount;
- if ((int)(actorListLength / ACTOR_INHM_SIZE) < _actorsCount) {
+ if (actorListLength != (uint)_actorsCount * ACTOR_INHM_SIZE) {
error("Actor::loadActorList wrong actorlist length");
}
@@ -412,9 +412,9 @@ void Actor::loadActorList(int protagonistIdx, int actorCount, int actorsResource
_actors = (ActorData **)malloc(_actorsCount * sizeof(*_actors));
for (i = 0; i < _actorsCount; i++) {
actor = _actors[i] = new ActorData();
- actor->_id = actorIndexToId(i);
+ actor->_id = objectIndexToId(kGameObjectActor, i); //actorIndexToId(i);
actor->_index = i;
- debug(9, "init actor id=%d index=%d", actor->_id, actor->_index);
+ debug(0, "init actor id=0x%x index=%d", actor->_id, actor->_index);
actorS.readUint32LE(); //next displayed
actorS.readByte(); //type
actor->_flags = actorS.readByte();
@@ -429,10 +429,7 @@ void Actor::loadActorList(int protagonistIdx, int actorCount, int actorsResource
actor->_frameListResourceId = actorS.readUint32LE();
debug(0, "%d: %d, %d", i, actor->_spriteListResourceId, actor->_frameListResourceId);
actor->_scriptEntrypointNumber = actorS.readUint32LE();
- actorS.readByte();
- actorS.readByte();
- actorS.readByte();
- actorS.readByte();
+ actorS.readUint32LE(); // xSprite *dSpr;
actorS.readUint16LE(); //LEFT
actorS.readUint16LE(); //RIGHT
actorS.readUint16LE(); //TOP
@@ -486,14 +483,7 @@ void Actor::loadActorList(int protagonistIdx, int actorCount, int actorsResource
for (i = 0; i < _actorsCount; i++) {
actor = _actors[i];
- if (actor->_flags & kExtended) {
- loadActorResources(actor);
-
- if (actor->_disabled) {
- warning("Disabling actor Id=%d index=%d", actor->_id, actor->_index);
- }
- break;
- }
+ loadActorResources(actor);
}
_centerActor = _protagonist = _actors[protagonistIdx];
@@ -1520,6 +1510,7 @@ void Actor::createDrawOrderList() {
_drawOrderList.clear();
for (i = 0; i < _actorsCount; i++) {
actor = _actors[i];
+
if (!actor->_inScene)
continue;
diff --git a/saga/game.cpp b/saga/game.cpp
index 9593f707d1..574f4df1a8 100644
--- a/saga/game.cpp
+++ b/saga/game.cpp
@@ -567,7 +567,7 @@ static GameDisplayInfo IHNM_DisplayInfo = { //TODO: fill it all
640, 480, // logical width&height
0, // scene path y offset
- 304, // scene height
+ 618, // scene height
0, // status x offset
304, // status y offset
diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp
index a0d955db12..286fd20901 100644
--- a/saga/sfuncs.cpp
+++ b/saga/sfuncs.cpp
@@ -1100,7 +1100,7 @@ void Script::sfPlaceActor(SCRIPTFUNC_PARAMS) {
frameType = thread->pop();
frameOffset = thread->pop();
- debug(1, "sfPlaceActor(id = %d, x=%d, y=%d, dir=%d, frameType=%d, frameOffset=%d)", actorId, actorLocation.x,
+ debug(1, "sfPlaceActor(id = 0x%x, x=%d, y=%d, dir=%d, frameType=%d, frameOffset=%d)", actorId, actorLocation.x,
actorLocation.y, actorDirection, frameType, frameOffset);
actor = _vm->_actor->getActor(actorId);
@@ -1122,7 +1122,6 @@ void Script::sfPlaceActor(SCRIPTFUNC_PARAMS) {
}
actor->_targetObject = ID_NOTHING;
-
}
// Script function #44 (0x2C) nonblocking
diff --git a/saga/sprite.cpp b/saga/sprite.cpp
index bdf2b6ff08..a2b9c64056 100644
--- a/saga/sprite.cpp
+++ b/saga/sprite.cpp
@@ -108,20 +108,32 @@ void Sprite::loadList(int resourceId, SpriteList &spriteList) {
spritePointer = spriteListData;
spritePointer += offset;
- MemoryReadStream readS2(spritePointer, (_vm->getFeatures() & GF_MAC_RESOURCES) ? 8 : 4);
+ MemoryReadStream readS2(spritePointer, (_vm->getFeatures() & GF_MAC_RESOURCES || _vm->getGameType() == GType_IHNM) ? 8 : 4);
- if (!(_vm->getFeatures() & GF_MAC_RESOURCES)) {
- spriteInfo->xAlign = readS2.readSByte();
- spriteInfo->yAlign = readS2.readSByte();
+ if (_vm->getGameType() == GType_ITE) {
+ if (!(_vm->getFeatures() & GF_MAC_RESOURCES)) {
+ spriteInfo->xAlign = readS2.readSByte();
+ spriteInfo->yAlign = readS2.readSByte();
- spriteInfo->width = readS2.readByte();
- spriteInfo->height = readS2.readByte();
+ spriteInfo->width = readS2.readByte();
+ spriteInfo->height = readS2.readByte();
+ } else {
+ spriteInfo->xAlign = readS2.readSint16BE();
+ spriteInfo->yAlign = readS2.readSint16BE();
+
+ spriteInfo->width = readS2.readUint16BE();
+ spriteInfo->height = readS2.readUint16BE();
+ }
} else {
- spriteInfo->xAlign = readS2.readSint16BE();
- spriteInfo->yAlign = readS2.readSint16BE();
+ spriteInfo->xAlign = readS2.readSint16LE();
+ spriteInfo->yAlign = readS2.readSint16LE();
+
+ spriteInfo->width = readS2.readUint16LE();
+ spriteInfo->height = readS2.readUint16LE();
- spriteInfo->width = readS2.readUint16BE();
- spriteInfo->height = readS2.readUint16BE();
+ if (spriteInfo->width > 100) { // FIXME: HACK
+ spriteInfo->width = spriteInfo->height = 0;
+ }
}
spriteDataPointer = spritePointer + readS2.pos();
outputLength = spriteInfo->width * spriteInfo->height;
@@ -156,7 +168,6 @@ void Sprite::getScaledSpriteBuffer(SpriteList &spriteList, int spriteNumber, int
width = spriteInfo->width;
buffer = spriteInfo->decodedBuffer;
}
-
}
void Sprite::drawClip(Surface *ds, const Rect &clipRect, const Point &spritePointer, int width, int height, const byte *spriteBuffer) {
@@ -219,6 +230,7 @@ void Sprite::draw(Surface *ds, const Rect &clipRect, SpriteList &spriteList, int
spritePointer.x = screenCoord.x + xAlign;
spritePointer.y = screenCoord.y + yAlign;
+
drawClip(ds, clipRect, spritePointer, width, height, spriteBuffer);
}