Moved most of inventory-related code inside classes Inventory and InventoryRenderer. Shift is not completed, as new code doesn't handle selections yet (falling back to existent code).

svn-id: r29060
This commit is contained in:
Nicola Mettifogo 2007-09-23 20:17:50 +00:00
parent 7da28f6129
commit 05abbf49a2
9 changed files with 384 additions and 270 deletions

View File

@ -641,13 +641,14 @@ void Parallaction_ns::jobToggleDoor(void *parm, Job *j) {
int16 Parallaction::pickupItem(Zone *z) {
int r = addInventoryItem(z->u.get->_icon);
if (r == 0)
if (r != -1)
addJob(kJobRemovePickedItem, z, kPriority17 );
return r;
return (r == -1);
}
void Parallaction_ns::jobRemovePickedItem(void *parm, Job *j) {
printf("picking up item\n");
Zone *z = (Zone*)parm;

View File

@ -47,72 +47,143 @@ namespace Parallaction {
#define INVENTORY_WIDTH (INVENTORY_ITEMS_PER_LINE*INVENTORYITEM_WIDTH)
#define INVENTORY_HEIGHT (INVENTORY_LINES*INVENTORYITEM_HEIGHT)
static byte *_buffer;
uint16 _numInvLines = 0;
static Common::Point _invPosition;
InventoryItem _inventory[INVENTORY_MAX_ITEMS] = {
{ kZoneDoor, 1 }, // open/close icon
{ kZoneExamine, 3 }, // examine icon
{ kZoneGet, 2 }, // pick up/use icon
{ kZoneSpeak, 4 }, // speak icon
{ 0, 0 }, // items...
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
{ 0, 0 }
};
int16 getNumUsedSlots() {
int16 num = 0;
while (num < INVENTORY_MAX_ITEMS && _inventory[num]._id != 0)
num++;
return num;
}
Inventory *_inv = 0;
InventoryRenderer *_re = 0;
// get inventory item index at position (x,y)
// in screen coordinates
//
int16 Parallaction::getHoverInventoryItem(int16 x, int16 y) {
int16 slot = getNumUsedSlots();
slot = (slot + 4) / INVENTORY_ITEMS_PER_LINE;
Common::Rect r(INVENTORY_WIDTH, _numInvLines * INVENTORYITEM_HEIGHT);
r.moveTo(_invPosition);
if (!r.contains(Common::Point(x,y)))
return -1;
return ((x - _invPosition.x) / INVENTORYITEM_WIDTH) + (INVENTORY_ITEMS_PER_LINE * ((y - _invPosition.y) / INVENTORYITEM_HEIGHT));
return _re->hitTest(Common::Point(x,y));
}
void drawInventoryItem(uint16 pos, InventoryItem *item) {
int Parallaction::addInventoryItem(ItemName item) {
return _inv->addItem(item);
}
int Parallaction::addInventoryItem(ItemName item, uint32 value) {
return _inv->addItem(item, value);
}
void Parallaction::dropItem(uint16 v) {
printf("dropItem: %i (# = %i)\n", v, _inv->getNumItems());
_inv->removeItem(v);
printf("# = %i\n", _inv->getNumItems());
}
bool Parallaction::isItemInInventory(int32 v) {
return (_inv->findItem(v) != -1);
}
const InventoryItem* getInventoryItem(int16 pos) {
return _inv->getItem(pos);
}
int16 getInventoryItemIndex(int16 pos) {
return _inv->getItemName(pos);
}
void initInventory() {
_inv = new Inventory(INVENTORY_MAX_ITEMS);
_re = new InventoryRenderer(_vm);
_re->bindInventory(_inv);
}
void destroyInventory() {
delete _inv;
delete _re;
}
void cleanInventory(bool keepVerbs) {
_inv->clear(keepVerbs);
}
void Parallaction_ns::jobShowInventory(void *parm, Job *j) {
Common::Rect r;
_re->getRect(r);
_gfx->copyRect(Gfx::kBitBack, r, _re->getData(), INVENTORY_WIDTH);
}
void Parallaction_ns::jobHideInventory(void *parm, Job *j) {
static uint16 count = 0;
_engineFlags |= kEngineBlockInput;
count++;
if (count == 2) {
count = 0;
j->_finished = 1;
_engineFlags &= ~kEngineBlockInput;
}
Common::Rect r;
_re->getRect(r);
_gfx->restoreBackground(r);
}
void openInventory() {
_re->showInventory();
}
void closeInventory() {
_re->hideInventory();
}
InventoryRenderer::InventoryRenderer(Parallaction *vm) : _vm(vm) {
_buffer = (byte*)malloc(INVENTORY_WIDTH * INVENTORY_HEIGHT);
}
InventoryRenderer::~InventoryRenderer() {
if (_buffer)
free(_buffer);
_buffer = 0;
}
void InventoryRenderer::showInventory() {
if (!_inv)
error("InventoryRenderer not bound to inventory");
_engineFlags |= kEngineInventory;
uint16 lines = getNumLines();
_pos.x = CLIP(_vm->_mousePos.x - (INVENTORY_WIDTH / 2), 0, (int)(_vm->_screenWidth - INVENTORY_WIDTH));
_pos.y = CLIP(_vm->_mousePos.y - 2 - (lines * INVENTORYITEM_HEIGHT), 0, (int)(_vm->_screenHeight - lines * INVENTORYITEM_HEIGHT));
refresh();
}
void InventoryRenderer::hideInventory() {
if (!_inv)
error("InventoryRenderer not bound to inventory");
_engineFlags &= ~kEngineInventory;
}
void InventoryRenderer::getRect(Common::Rect& r) const {
r.setWidth(INVENTORY_WIDTH);
r.setHeight(INVENTORYITEM_HEIGHT * getNumLines());
r.moveTo(_pos);
}
ItemPosition InventoryRenderer::hitTest(const Common::Point &p) const {
Common::Rect r;
getRect(r);
if (!r.contains(p))
return -1;
return ((p.x - _pos.x) / INVENTORYITEM_WIDTH) + (INVENTORY_ITEMS_PER_LINE * ((p.y - _pos.y) / INVENTORYITEM_HEIGHT));
}
void InventoryRenderer::drawItem(ItemPosition pos, ItemName name) {
uint16 line = pos / INVENTORY_ITEMS_PER_LINE;
uint16 col = pos % INVENTORY_ITEMS_PER_LINE;
@ -120,7 +191,8 @@ void drawInventoryItem(uint16 pos, InventoryItem *item) {
_vm->_char._objs->getRect(0, r);
// FIXME: this will end up in a general blit function
byte* s = _vm->_char._objs->getData(item->_index);
byte* s = _vm->_char._objs->getData(name);
byte* d = _buffer + col * INVENTORYITEM_WIDTH + line * r.height() * INVENTORY_WIDTH;
for (uint32 i = 0; i < INVENTORYITEM_HEIGHT; i++) {
memcpy(d, s, INVENTORYITEM_WIDTH);
@ -128,61 +200,21 @@ void drawInventoryItem(uint16 pos, InventoryItem *item) {
d += INVENTORY_WIDTH;
s += INVENTORYITEM_PITCH;
}
}
return;
int16 InventoryRenderer::getNumLines() const {
int16 num = _inv->getNumItems();
return (num / INVENTORY_ITEMS_PER_LINE) + ((num % INVENTORY_ITEMS_PER_LINE) > 0 ? 1 : 0);
}
void refreshInventory() {
for (uint16 i = 0; i < INVENTORY_MAX_ITEMS; i++)
drawInventoryItem(i, &_inventory[i]);
return;
}
int Parallaction::addInventoryItem(uint16 item) {
int16 slot = getNumUsedSlots();
if (slot == INVENTORY_MAX_ITEMS)
return -1;
_inventory[slot]._id = MAKE_INVENTORY_ID(item);
_inventory[slot]._index = item;
return 0;
}
void Parallaction::dropItem(uint16 v) {
bool found = false;
for (uint16 slot = 0; slot < INVENTORY_MAX_ITEMS - 1; slot++) {
if (v == _inventory[slot]._index) {
found = true;
}
if (!found) continue;
memcpy(&_inventory[slot], &_inventory[slot+1], sizeof(InventoryItem));
void InventoryRenderer::refresh() {
for (uint16 i = 0; i < INVENTORY_MAX_ITEMS; i++) {
ItemName name = _inv->getItemName(i);
drawItem(i, name);
}
return;
}
int16 Parallaction::isItemInInventory(int32 v) {
for (uint16 slot = 0; slot < INVENTORY_MAX_ITEMS; slot++) {
if (_inventory[slot]._id == (uint)v)
return 1;
}
return 0;
}
void drawBorder(const Common::Rect& r, byte *buffer, byte color) {
byte *d = buffer + r.left + INVENTORY_WIDTH * r.top;
@ -203,12 +235,14 @@ void drawBorder(const Common::Rect& r, byte *buffer, byte color) {
//
// draws a color border around the specified position in the inventory
//
void highlightInventoryItem(int16 pos, byte color) {
void highlightInventoryItem(ItemPosition pos, byte color) {
if (color != 12) color = 19;
if (pos == -1) return;
printf("highlight item: %i\n", pos);
uint16 line = pos / INVENTORY_ITEMS_PER_LINE;
uint16 col = pos % INVENTORY_ITEMS_PER_LINE;
@ -217,102 +251,104 @@ void highlightInventoryItem(int16 pos, byte color) {
r.setWidth(INVENTORYITEM_WIDTH);
r.moveTo(col * INVENTORYITEM_WIDTH, line * r.height());
drawBorder(r, _buffer, color);
drawBorder(r, _re->getData(), color);
return;
}
int16 getInventoryItemIndex(int16 pos) {
Inventory::Inventory(uint16 maxItems) : _maxItems(maxItems), _numItems(0) {
_items = (InventoryItem*)calloc(_maxItems, sizeof(InventoryItem));
addItem(1, kZoneDoor);
addItem(3, kZoneExamine);
addItem(2, kZoneGet);
addItem(4, kZoneSpeak);
}
Inventory::~Inventory() {
free(_items);
}
ItemPosition Inventory::addItem(ItemName name, uint32 value) {
if (_numItems == INVENTORY_MAX_ITEMS)
return -1;
if (name == 0)
return -1;
_items[_numItems]._id = value;
_items[_numItems]._index = name;
_numItems++;
return _numItems;
}
ItemPosition Inventory::addItem(ItemName name) {
return addItem(name, MAKE_INVENTORY_ID(name));
}
ItemPosition Inventory::findItem(ItemName name) const {
for (ItemPosition slot = 0; slot < _numItems; slot++) {
if (name == _items[slot]._index)
return slot;
}
return -1;
}
void Inventory::removeItem(ItemName name) {
ItemPosition pos = findItem(name);
if (pos == -1) {
printf("removeItem: name %i not found\n", name);
return;
}
_numItems--;
if (_numItems != pos) {
memcpy(&_items[pos], &_items[pos+1], (_numItems - pos) * sizeof(InventoryItem));
}
_items[_numItems]._id = 0;
_items[_numItems]._index = 0;
}
void Inventory::clear(bool keepVerbs) {
uint first = (keepVerbs ? INVENTORY_FIRST_ITEM : 0);
for (uint16 slot = first; slot < _maxItems; slot++) {
_items[slot]._id = 0;
_items[slot]._index = 0;
}
_numItems = first;
}
ItemName Inventory::getItemName(ItemPosition pos) const {
// TODO: should assert against the number of items actually contained,
// not the theoretical limit.
assert(pos >= 0 && pos < INVENTORY_MAX_ITEMS);
return _inventory[pos]._index;
return _items[pos]._index;
}
const InventoryItem* Inventory::getItem(ItemPosition pos) const {
return &_items[pos];
}
void Parallaction_ns::jobShowInventory(void *parm, Job *j) {
// printf("job_showInventory()...");
int16 slot = getNumUsedSlots();
_numInvLines = (slot + 4) / INVENTORY_ITEMS_PER_LINE;
Common::Rect r(INVENTORY_WIDTH, _numInvLines * INVENTORYITEM_HEIGHT);
r.moveTo(_invPosition);
_gfx->copyRect(Gfx::kBitBack, r, _buffer, INVENTORY_WIDTH);
return;
}
void Parallaction_ns::jobHideInventory(void *parm, Job *j) {
// printf("job_hideInventory()\n");
static uint16 count = 0;
_engineFlags |= kEngineBlockInput;
count++;
if (count == 2) {
count = 0;
j->_finished = 1;
_engineFlags &= ~kEngineBlockInput;
}
Common::Rect r(INVENTORY_WIDTH, _numInvLines * INVENTORYITEM_HEIGHT);
r.moveTo(_invPosition);
_gfx->restoreBackground(r);
return;
}
void openInventory() {
_engineFlags |= kEngineInventory;
int16 slot = getNumUsedSlots();
uint16 lines = (slot + 4) / INVENTORY_ITEMS_PER_LINE;
_invPosition.x = CLIP(_vm->_mousePos.x - (INVENTORY_WIDTH / 2), 0, (int)(_vm->_screenWidth - INVENTORY_WIDTH));
_invPosition.y = CLIP(_vm->_mousePos.y - 2 - (lines * INVENTORYITEM_HEIGHT), 0, (int)(_vm->_screenHeight - lines * INVENTORYITEM_HEIGHT));
refreshInventory();
return;
}
void closeInventory() {
_engineFlags &= ~kEngineInventory;
}
void initInventory() {
_buffer = (byte*)malloc(INVENTORY_WIDTH * INVENTORY_HEIGHT);
}
void destroyInventory() {
if (_buffer)
free(_buffer);
_buffer = 0;
}
void cleanInventory() {
for (uint16 slot = INVENTORY_FIRST_ITEM; slot < INVENTORY_MAX_ITEMS; slot++) {
_inventory[slot]._id = 0;
_inventory[slot]._index = 0;
}
return;
}
} // namespace Parallaction

View File

@ -30,6 +30,7 @@
namespace Parallaction {
class Parallaction;
struct InventoryItem {
uint32 _id; // object name (lowest 16 bits are always zero)
@ -42,20 +43,77 @@ struct InventoryItem {
#define MAKE_INVENTORY_ID(x) (((x) & 0xFFFF) << 16)
extern InventoryItem _inventory[];
void initInventory();
void destroyInventory();
void openInventory();
void closeInventory();
void cleanInventory();
void addInventoryItem(uint16 item);
int16 getInventoryItemIndex(int16 pos);
void highlightInventoryItem(int16 pos, byte color);
void cleanInventory(bool keepVerbs = true);
const InventoryItem* getInventoryItem(int16 pos);
int16 getInventoryItemIndex(int16 pos);
typedef int16 ItemPosition;
typedef uint16 ItemName;
class Inventory {
protected:
InventoryItem *_items;
uint16 _maxItems;
uint16 _numItems;
public:
Inventory(uint16 maxItems);
virtual ~Inventory();
ItemPosition addItem(ItemName name, uint32 value);
ItemPosition addItem(ItemName item);
void removeItem(ItemName name);
void clear(bool keepVerbs = true);
const InventoryItem* getItem(ItemPosition pos) const;
ItemName getItemName(ItemPosition pos) const;
ItemPosition findItem(ItemName name) const;
int16 getNumItems() const { return _numItems; }
};
class InventoryRenderer {
Parallaction *_vm;
Inventory *_inv;
Common::Point _pos;
byte *_buffer;
protected:
void drawItem(ItemPosition pos, ItemName name);
void refresh();
public:
InventoryRenderer(Parallaction *vm);
virtual ~InventoryRenderer();
void bindInventory(Inventory *inv) { _inv = inv; }
void showInventory();
void hideInventory();
ItemPosition hitTest(const Common::Point &p) const;
byte* getData() const { return _buffer; }
void getRect(Common::Rect &r) const;
int16 getNumLines() const;
};
} // namespace Parallaction
#endif

View File

@ -198,7 +198,7 @@ uint16 Menu::chooseLanguage() {
_vm->showSlide("lingua");
_vm->_gfx->displayString(60, 30, "SELECT LANGUAGE", 1);
_vm->changeCursor(kCursorArrow);
_vm->setArrowCursor();
do {
_vm->updateInput();
@ -335,7 +335,7 @@ void Menu::selectCharacter() {
Graphics::Surface v14;
v14.create(BLOCK_WIDTH, BLOCK_HEIGHT, 1);
_vm->changeCursor(kCursorArrow);
_vm->setArrowCursor();
_vm->_soundMan->stopMusic();
_vm->_gfx->setFont(_vm->_menuFont);

View File

@ -303,7 +303,7 @@ void Parallaction::runGame() {
if (_hasLocationSound)
_soundMan->playSfx(_locationSound, 0, true);
changeCursor(kCursorArrow);
_vm->setArrowCursor();
if (_location._aCommands.size() > 0)
runCommands(_location._aCommands);
@ -413,7 +413,7 @@ void Parallaction::processInput(InputData *data) {
_hoverZone = NULL;
hideLabel(kPriority2);
if (hitZone(kZoneYou, _mousePos.x, _mousePos.y) == 0) {
changeCursor(kCursorArrow);
setArrowCursor();
}
removeJob(_jRunScripts);
_jDrawInventory = addJob(kJobShowInventory, 0, kPriority2);
@ -422,10 +422,7 @@ void Parallaction::processInput(InputData *data) {
case kEvCloseInventory: // closes inventory and possibly select item
closeInventory();
if ((data->_inventoryIndex != -1) && (_inventory[data->_inventoryIndex]._id != 0)) {
// activates item
changeCursor(data->_inventoryIndex);
}
setInventoryCursor(data->_inventoryIndex);
_jRunScripts = addJob(kJobRunScripts, 0, kPriority15);
addJob(kJobHideInventory, 0, kPriority20);
removeJob(_jDrawInventory);
@ -437,12 +434,11 @@ void Parallaction::processInput(InputData *data) {
_procCurrentHoverItem = data->_inventoryIndex;
break;
case kEvWalk: {
case kEvWalk:
debugC(2, kDebugInput, "processInput: kEvWalk");
_hoverZone = NULL;
changeCursor(kCursorArrow);
setArrowCursor();
_char.scheduleWalk(data->_mousePos.x, data->_mousePos.y);
}
break;
case kEvQuitGame:
@ -452,13 +448,13 @@ void Parallaction::processInput(InputData *data) {
case kEvSaveGame:
_hoverZone = NULL;
saveGame();
changeCursor(kCursorArrow);
setArrowCursor();
break;
case kEvLoadGame:
_hoverZone = NULL;
loadGame();
changeCursor(kCursorArrow);
setArrowCursor();
break;
}
@ -552,7 +548,7 @@ Parallaction::InputData *Parallaction::translateInput() {
}
// beep();
changeCursor(kCursorArrow);
setArrowCursor();
return &_input;
}
@ -573,11 +569,11 @@ Parallaction::InputData *Parallaction::translateInput() {
if ((_engineFlags & kEngineDragging) == 0) return &_input;
_engineFlags &= ~kEngineDragging;
Zone *z = hitZone(kZoneMerge, _activeItem._index, _inventory[_input._inventoryIndex]._index);
Zone *z = hitZone(kZoneMerge, _activeItem._index, getInventoryItemIndex(_input._inventoryIndex));
if (z != NULL) {
dropItem(z->u.merge->_obj1 - 4);
dropItem(z->u.merge->_obj2 - 4);
dropItem(z->u.merge->_obj1);
dropItem(z->u.merge->_obj2);
addInventoryItem(z->u.merge->_obj3);
runCommands(z->_commands);
}
@ -623,29 +619,6 @@ void Parallaction::showCursor(bool visible) {
g_system->showMouse(visible);
}
// changes the mouse pointer
// index 0 means standard pointer (from pointer.cnv)
// index > 0 means inventory item
//
void Parallaction::changeCursor(int32 index) {
if (index == kCursorArrow) { // standard mouse pointer
debugC(1, kDebugInput, "changeCursor(%i), label: %p", index, (const void*)_jDrawLabel);
hideLabel(kPriority15);
_activeItem._id = 0;
} else {
_activeItem._id = _inventory[index]._id;
}
setMousePointer(index);
return;
}
void Parallaction::freeCharacter() {

View File

@ -398,7 +398,6 @@ public:
} _instRunCtxt;
void changeCursor(int32 index);
void showCursor(bool visible);
Job *addJob(uint functionId, void *parm, uint16 tag);
@ -553,17 +552,20 @@ protected: // members
void freeCharacter();
int addInventoryItem(uint16 item);
void dropItem(uint16 item);
int addInventoryItem(ItemName item, uint32 value);
int addInventoryItem(ItemName item);
void dropItem(ItemName item);
int16 pickupItem(Zone *z);
int16 isItemInInventory(int32 v);
bool isItemInInventory(int32 v);
int16 getHoverInventoryItem(int16 x, int16 y);
public:
virtual void callFunction(uint index, void* parm) { }
virtual void renderLabel(Graphics::Surface *cnv, char *text) { }
virtual void setMousePointer(int16 index) = 0;
virtual void setArrowCursor() = 0;
virtual void setInventoryCursor(int pos) = 0;
virtual void parseLocation(const char* name) = 0;
@ -603,7 +605,7 @@ public:
virtual void callFunction(uint index, void* parm);
void renderLabel(Graphics::Surface *cnv, char *text);
void setMousePointer(int16 index);
void setMousePointer(uint32 value);
void initJobs();
@ -626,6 +628,10 @@ private:
void changeLocation(char *location);
void changeCharacter(const char *name);
void setArrowCursor();
void setInventoryCursor(int pos);
void doLoadGame(uint16 slot);
void doSaveGame(uint16 slot, const char* name);
int buildSaveFileList(Common::StringList& l);
@ -908,6 +914,10 @@ private:
void initParsers();
void initJobs();
void setArrowCursor();
void setInventoryCursor(int pos);
typedef void (Parallaction_br::*JobFn)(void*, Job*);
const JobFn *_jobsFn;
JobOpcode* createJobOpcode(uint functionId, Job *job);

View File

@ -386,4 +386,17 @@ JobOpcode* Parallaction_br::createJobOpcode(uint functionId, Job *job) {
return new OpcodeImpl2<Parallaction_br>(this, _jobsFn[functionId], job);
}
void Parallaction_br::setArrowCursor() {
}
void Parallaction_br::setInventoryCursor(int pos) {
}
} // namespace Parallaction

View File

@ -139,34 +139,48 @@ void Parallaction_ns::initCursors() {
return;
}
void Parallaction_ns::setMousePointer(int16 index) {
void Parallaction_ns::setArrowCursor() {
if (index == kCursorArrow) { // standard mouse pointer
debugC(1, kDebugInput, "setting mouse cursor to arrow");
_system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
_system->showMouse(true);
// this stuff is needed to avoid artifacts with labels and selected items when switching cursors
hideLabel(kPriority15);
_activeItem._id = 0;
} else {
// inventory item pointer
byte *v8 = (byte*)_mouseComposedArrow->pixels;
_system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
_system->showMouse(true);
// FIXME: destination offseting is not clear
byte* s = _char._objs->getData(getInventoryItemIndex(index));
byte* d = v8 + 7 + MOUSECOMBO_WIDTH * 7;
}
for (uint i = 0; i < INVENTORYITEM_HEIGHT; i++) {
memcpy(d, s, INVENTORYITEM_WIDTH);
void Parallaction_ns::setInventoryCursor(int pos) {
s += INVENTORYITEM_PITCH;
d += MOUSECOMBO_WIDTH;
}
if (pos == -1)
return;
_system->setMouseCursor(v8, MOUSECOMBO_WIDTH, MOUSECOMBO_HEIGHT, 0, 0, 0);
const InventoryItem *item = getInventoryItem(pos);
if (item->_index == 0)
return;
_activeItem._id = item->_id;
byte *v8 = (byte*)_mouseComposedArrow->pixels;
// FIXME: destination offseting is not clear
byte* s = _char._objs->getData(item->_index);
byte* d = v8 + 7 + MOUSECOMBO_WIDTH * 7;
for (uint i = 0; i < INVENTORYITEM_HEIGHT; i++) {
memcpy(d, s, INVENTORYITEM_WIDTH);
s += INVENTORYITEM_PITCH;
d += MOUSECOMBO_WIDTH;
}
return;
_system->setMouseCursor(v8, MOUSECOMBO_WIDTH, MOUSECOMBO_HEIGHT, 0, 0, 0);
}
void Parallaction_ns::callFunction(uint index, void* parm) {
assert(index < 25); // magic value 25 is maximum # of callables for Nippon Safes
@ -238,7 +252,7 @@ void Parallaction_ns::changeLocation(char *location) {
_hoverZone = NULL;
if (_engineFlags & kEngineBlockInput) {
changeCursor( kCursorArrow );
setArrowCursor();
}
_animations.remove(&_char._ani);

View File

@ -136,12 +136,19 @@ void Parallaction_ns::doLoadGame(uint16 slot) {
}
_locationNames[_si][0] = '\0';
cleanInventory(false);
ItemName name;
uint32 value;
for (_si = 0; _si < 30; _si++) {
f->readLine(s, 15);
_inventory[_si]._id = atoi(s);
value = atoi(s);
f->readLine(s, 15);
_inventory[_si]._index = atoi(s);
name = atoi(s);
printf("loadGame: inv[%i].id = %i, inv[%i].index = %i\n", _si, value, _si, name);
addInventoryItem(name, value);
}
delete f;
@ -203,8 +210,10 @@ void Parallaction_ns::doSaveGame(uint16 slot, const char* name) {
f->writeString(s);
}
const InventoryItem *item;
for (uint16 _si = 0; _si < 30; _si++) {
sprintf(s, "%u\n%d\n", _inventory[_si]._id, _inventory[_si]._index);
item = getInventoryItem(_si);
sprintf(s, "%u\n%d\n", item->_id, item->_index);
f->writeString(s);
}
@ -373,7 +382,7 @@ void Parallaction_ns::loadGame() {
GUI::TimedMessageDialog dialog("Loading game...", 1500);
dialog.runModal();
changeCursor(kCursorArrow);
setArrowCursor();
return;
}