aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Sandulenko2005-04-18 10:26:43 +0000
committerEugene Sandulenko2005-04-18 10:26:43 +0000
commit769b2fed4625828e7572f96d95727f79ad34f79e (patch)
tree6dc1a50557690c49c23ea5cd5872e421e9aea2b4
parent0ca8095e95b53e593b833d48fb9b3cee52f4fbbb (diff)
downloadscummvm-rg350-769b2fed4625828e7572f96d95727f79ad34f79e.tar.gz
scummvm-rg350-769b2fed4625828e7572f96d95727f79ad34f79e.tar.bz2
scummvm-rg350-769b2fed4625828e7572f96d95727f79ad34f79e.zip
o Unstubbed sfPreDialog -- we have enough code for that
o Started to restore inventory functionality svn-id: r17666
-rw-r--r--saga/actor.cpp2
-rw-r--r--saga/actor.h1
-rw-r--r--saga/interface.cpp7
-rw-r--r--saga/sfuncs.cpp37
-rw-r--r--saga/sprite.cpp2
-rw-r--r--saga/sprite.h2
6 files changed, 25 insertions, 26 deletions
diff --git a/saga/actor.cpp b/saga/actor.cpp
index 0e7b5eb16b..fdd0649e5c 100644
--- a/saga/actor.cpp
+++ b/saga/actor.cpp
@@ -260,6 +260,8 @@ Actor::Actor(SagaEngine *vm) : _vm(vm) {
obj->location.y = ITE_ObjectTable[i].y;
obj->location.z = ITE_ObjectTable[i].z;
obj->disabled = false;
+
+ obj->spritelistRn = 0;
}
} else {
diff --git a/saga/actor.h b/saga/actor.h
index 7696bdaf2a..f9051cfad8 100644
--- a/saga/actor.h
+++ b/saga/actor.h
@@ -216,6 +216,7 @@ typedef SortedList<CommonObjectDataPointer> CommonObjectOrderList;
class ObjectData: public CommonObjectData {
public:
uint16 interactBits;
+ int32 spritelistRn;
};
class ActorData: public CommonObjectData {
diff --git a/saga/interface.cpp b/saga/interface.cpp
index 59913ad018..825fa98258 100644
--- a/saga/interface.cpp
+++ b/saga/interface.cpp
@@ -533,7 +533,6 @@ void Interface::removeFromInventory(int sprite) {
void Interface::drawInventory() {
if (_panelMode != kPanelMain)
return;
-/*
SURFACE *back_buf = _vm->_gfx->getBackBuffer();
// TODO: Inventory scrolling
@@ -548,14 +547,14 @@ void Interface::drawInventory() {
Point drawPoint;
for (int i = 0; i < _inventoryCount; i++) {
- if (_inventory[i] >= ARRAYSIZE(ObjectTable)) {
+ if (!_vm->_actor->validObjId(_vm->_actor->objIndexToId(_inventory[i]))) {
continue;
}
drawPoint.x = x + col * width;
drawPoint.y = y + row * height;
_vm->_sprite->draw(back_buf, _vm->_sprite->_mainSprites,
- ObjectTable[_inventory[i]].spritelistRn,
+ _vm->_actor->getObj(_vm->_actor->objIndexToId(_inventory[i]))->spritelistRn,
drawPoint, 256);
if (++col >= _vm->getDisplayInfo().inventoryColumns) {
@@ -564,7 +563,7 @@ void Interface::drawInventory() {
}
col = 0;
}
- }*/
+ }
}
int Interface::inventoryTest(const Point& imousePt, int *ibutton) {
diff --git a/saga/sfuncs.cpp b/saga/sfuncs.cpp
index 863d5617e4..32bd103318 100644
--- a/saga/sfuncs.cpp
+++ b/saga/sfuncs.cpp
@@ -186,7 +186,7 @@ void Script::sfTakeObject(SCRIPTFUNC_PARAMS) {
obj = _vm->_actor->getObj(objectId);
if (obj->sceneNumber != ITE_SCENE_INV) {
obj->sceneNumber = ITE_SCENE_INV;
- //_vm->_interface->addToInventory(index); TODO: do it
+ _vm->_interface->addToInventory(objectId);
}
}
@@ -370,14 +370,12 @@ void Script::sfLockUser(SCRIPTFUNC_PARAMS) {
// Disables mouse input, etc.
void Script::sfPreDialog(SCRIPTFUNC_PARAMS) {
_vm->_interface->deactivate();
- ; // clear converse text
+ _vm->_interface->converseClear();
if (_vm->_interface->isInMainMode())
_vm->_interface->setMode(kPanelConverse);
else
- ; // display zero text
+ _vm->_interface->converseDisplayText(0);
_vm->_interface->setMode(kPanelNull);
-
- debug(0, "STUB: SF_preDialog()");
}
// Script function #13 (0x0D)
@@ -732,28 +730,27 @@ void Script::sfSceneEq(SCRIPTFUNC_PARAMS) {
// Script function #32 (0x20)
void Script::SF_dropObject(SCRIPTFUNC_PARAMS) {
- error("SF_dropObject Not implemented");
-
-/* ScriptDataWord obj_param = thread->pop();
- ScriptDataWord sprite_param = thread->pop();
- ScriptDataWord x_param = thread->pop();
- ScriptDataWord y_param = thread->pop();
+ uint16 obj_param = thread->pop();
+ uint16 sprite_param = thread->pop();
+ int16 x_param = thread->pop();
+ int16 y_param = thread->pop();
+ ObjectData *obj;
int index = obj_param & 0x1FFF;
- if (index >= ARRAYSIZE(ObjectTable)) {
- return FAILURE;
- }
+ if (!_vm->_actor->validObjId(_vm->_actor->objIndexToId(index)))
+ return;
- if (ObjectTable[index].sceneIndex == -1) {
+ obj = _vm->_actor->getObj(_vm->_actor->objIndexToId(index));
+
+ if (obj->sceneNumber == -1) {
_vm->_interface->removeFromInventory(index);
}
- ObjectTable[index].sceneIndex = _vm->_scene->currentSceneNumber();
- ObjectTable[index].spritelistRn = 9 + sprite_param;
- ObjectTable[index].x = x_param;
- ObjectTable[index].y = y_param;
-*/
+ obj->sceneNumber = _vm->_scene->currentSceneNumber();
+ obj->spritelistRn = 9 + sprite_param;
+ obj->location.x = x_param;
+ obj->location.y = y_param;
}
// Script function #33 (0x21)
diff --git a/saga/sprite.cpp b/saga/sprite.cpp
index 46a55d73d7..d272ed791a 100644
--- a/saga/sprite.cpp
+++ b/saga/sprite.cpp
@@ -217,7 +217,7 @@ void Sprite::drawClip(SURFACE *ds, Rect clip, const Point &spritePointer, int wi
}
}
-int Sprite::draw(SURFACE *ds, SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale) {
+int Sprite::draw(SURFACE *ds, SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale) {
const byte *spriteBuffer;
int width;
int height;
diff --git a/saga/sprite.h b/saga/sprite.h
index 4907754c8b..69f93331fd 100644
--- a/saga/sprite.h
+++ b/saga/sprite.h
@@ -70,7 +70,7 @@ public:
Sprite(SagaEngine *vm);
~Sprite(void);
int loadList(int resourceId, SpriteList &spriteList); // load or append spriteList
- int draw(SURFACE *ds, SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale);
+ int draw(SURFACE *ds, SpriteList &spriteList, int32 spriteNumber, const Point &screenCoord, int scale);
int drawOccluded(SURFACE *ds, SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, int depth);
bool hitTest(SpriteList &spriteList, int spriteNumber, const Point &screenCoord, int scale, const Point &testPoint);
void getScaledSpriteBuffer(SpriteList &spriteList, int spriteNumber, int scale, int &width, int &height, int &xAlign, int &yAlign, const byte *&buffer);