mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-04 09:56:30 +00:00
fixed sfDropObject implementation
svn-id: r17767
This commit is contained in:
parent
40c3fdddc7
commit
edad36ee60
@ -634,9 +634,9 @@ void Interface::updateInventory(int pos) {
|
||||
}
|
||||
}
|
||||
|
||||
void Interface::addToInventory(int sprite, int pos) {
|
||||
void Interface::addToInventory(int objectId, int pos) {
|
||||
if (pos != -1) {
|
||||
_inventory[pos] = sprite;
|
||||
_inventory[pos] = objectId;
|
||||
_inventoryCount = MAX(_inventoryCount, pos + 1);
|
||||
return;
|
||||
}
|
||||
@ -649,7 +649,7 @@ void Interface::addToInventory(int sprite, int pos) {
|
||||
_inventory[i] = _inventory[i - 1];
|
||||
}
|
||||
|
||||
_inventory[0] = sprite;
|
||||
_inventory[0] = objectId;
|
||||
_inventoryCount++;
|
||||
|
||||
_inventoryPos = 0;
|
||||
@ -658,15 +658,15 @@ void Interface::addToInventory(int sprite, int pos) {
|
||||
draw();
|
||||
}
|
||||
|
||||
void Interface::removeFromInventory(int sprite) {
|
||||
int j = inventoryItemPosition(sprite);
|
||||
void Interface::removeFromInventory(int objectId) {
|
||||
int j = inventoryItemPosition(objectId);
|
||||
if (j == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
int i;
|
||||
|
||||
for (i = j; i < _inventoryCount; i++) {
|
||||
for (i = j; i < _inventoryCount - 1; i++) {
|
||||
_inventory[i] = _inventory[i + 1];
|
||||
}
|
||||
|
||||
@ -684,9 +684,9 @@ void Interface::clearInventory() {
|
||||
updateInventory(0);
|
||||
}
|
||||
|
||||
int Interface::inventoryItemPosition(int sprite) {
|
||||
int Interface::inventoryItemPosition(int objectId) {
|
||||
for (int i = 0; i < _inventoryCount; i++)
|
||||
if (_inventory[i] == sprite)
|
||||
if (_inventory[i] == objectId)
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
|
@ -165,10 +165,10 @@ public:
|
||||
|
||||
void inventoryChangePos(int chg);
|
||||
void inventorySetPos(int key);
|
||||
void addToInventory(int sprite, int pos = -1);
|
||||
void removeFromInventory(int sprite);
|
||||
void addToInventory(int objectId, int pos = -1);
|
||||
void removeFromInventory(int objectId);
|
||||
void clearInventory();
|
||||
int inventoryItemPosition(int sprite);
|
||||
int inventoryItemPosition(int objectId);
|
||||
void drawInventory();
|
||||
void updateInventory(int pos);
|
||||
int getInventoryContentByPanelButton(PanelButton * panelButton) {
|
||||
|
@ -494,7 +494,7 @@ private:
|
||||
void sfSetActorState(SCRIPTFUNC_PARAMS);
|
||||
void sfScriptMoveTo(SCRIPTFUNC_PARAMS);
|
||||
void sfSceneEq(SCRIPTFUNC_PARAMS);
|
||||
void SF_dropObject(SCRIPTFUNC_PARAMS);
|
||||
void sfDropObject(SCRIPTFUNC_PARAMS);
|
||||
void sfFinishBgdAnim(SCRIPTFUNC_PARAMS);
|
||||
void sfSwapActors(SCRIPTFUNC_PARAMS);
|
||||
void sfSimulSpeech(SCRIPTFUNC_PARAMS);
|
||||
|
@ -82,7 +82,7 @@ void Script::setupScriptFuncList(void) {
|
||||
OPCODE(sfSetActorState),
|
||||
OPCODE(sfScriptMoveTo),
|
||||
OPCODE(sfSceneEq),
|
||||
OPCODE(SF_dropObject),
|
||||
OPCODE(sfDropObject),
|
||||
OPCODE(sfFinishBgdAnim),
|
||||
OPCODE(sfSwapActors),
|
||||
OPCODE(sfSimulSpeech),
|
||||
@ -735,28 +735,28 @@ void Script::sfSceneEq(SCRIPTFUNC_PARAMS) {
|
||||
}
|
||||
|
||||
// Script function #32 (0x20)
|
||||
void Script::SF_dropObject(SCRIPTFUNC_PARAMS) {
|
||||
uint16 obj_param = thread->pop();
|
||||
uint16 sprite_param = thread->pop();
|
||||
int16 x_param = thread->pop();
|
||||
int16 y_param = thread->pop();
|
||||
void Script::sfDropObject(SCRIPTFUNC_PARAMS) {
|
||||
uint16 objectId;
|
||||
uint16 spriteId;
|
||||
int16 x;
|
||||
int16 y;
|
||||
ObjectData *obj;
|
||||
|
||||
int index = obj_param & 0x1FFF;
|
||||
objectId = thread->pop();
|
||||
spriteId = thread->pop();
|
||||
x = thread->pop();
|
||||
y = thread->pop();
|
||||
|
||||
if (!_vm->_actor->validObjId(_vm->_actor->objIndexToId(index)))
|
||||
return;
|
||||
obj = _vm->_actor->getObj(objectId);
|
||||
|
||||
obj = _vm->_actor->getObj(_vm->_actor->objIndexToId(index));
|
||||
|
||||
if (obj->sceneNumber == -1) {
|
||||
_vm->_interface->removeFromInventory(index);
|
||||
if (obj->sceneNumber == ITE_SCENE_INV) {
|
||||
_vm->_interface->removeFromInventory(objectId);
|
||||
}
|
||||
|
||||
obj->sceneNumber = _vm->_scene->currentSceneNumber();
|
||||
obj->spriteListResourceId = 9 + sprite_param;
|
||||
obj->location.x = x_param;
|
||||
obj->location.y = y_param;
|
||||
obj->spriteListResourceId = 9 + spriteId;
|
||||
obj->location.x = x;
|
||||
obj->location.y = y;
|
||||
}
|
||||
|
||||
// Script function #33 (0x21)
|
||||
|
Loading…
x
Reference in New Issue
Block a user