diff options
author | Vladimir Menshakov | 2009-09-26 15:04:09 +0000 |
---|---|---|
committer | Vladimir Menshakov | 2009-09-26 15:04:09 +0000 |
commit | 605b6fd885f0adbec016bcecac6d557b45873647 (patch) | |
tree | 3b9699951e53da487f97284a9ca1d0788520f701 /engines/teenagent/inventory.cpp | |
parent | 27a638fa824b624f425c3f548255b0736ddd9f6d (diff) | |
download | scummvm-rg350-605b6fd885f0adbec016bcecac6d557b45873647.tar.gz scummvm-rg350-605b6fd885f0adbec016bcecac6d557b45873647.tar.bz2 scummvm-rg350-605b6fd885f0adbec016bcecac6d557b45873647.zip |
removed packed structs/direct read/writes, so the game should work on big-endian archs.
svn-id: r44377
Diffstat (limited to 'engines/teenagent/inventory.cpp')
-rw-r--r-- | engines/teenagent/inventory.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/engines/teenagent/inventory.cpp b/engines/teenagent/inventory.cpp index d07ba52e6e..d8d40f64d3 100644 --- a/engines/teenagent/inventory.cpp +++ b/engines/teenagent/inventory.cpp @@ -49,7 +49,15 @@ void Inventory::init(TeenAgentEngine *engine) { for (byte i = 0; i < offsets; ++i) { offset[i] = items->readUint16LE(); } - objects = res->dseg.ptr(0xc4a4); + + for(byte i = 0; i < 92; ++i) { + InventoryObject io; + uint16 obj_addr = res->dseg.get_word(0xc4a4 + i * 2); + if (obj_addr != 0) + io.load(res->dseg.ptr(obj_addr)); + objects.push_back(io); + } + inventory = res->dseg.ptr(0xc48d); for (int y = 0; y < 4; ++y) @@ -138,7 +146,7 @@ bool Inventory::processEvent(const Common::Event &event) { graphics[i].hovered = graphics[i].rect.in(mouse); if (graphics[i].hovered) - hovered_obj = (InventoryObject *)res->dseg.ptr(READ_LE_UINT16(objects + item * 2)); + hovered_obj = &objects[item]; } return true; @@ -149,7 +157,7 @@ bool Inventory::processEvent(const Common::Event &event) { if (selected_obj == NULL) { activate(false); - _engine->displayMessage(hovered_obj->description()); + _engine->displayMessage(hovered_obj->description); return true; } @@ -202,7 +210,7 @@ bool Inventory::processEvent(const Common::Event &event) { selected_obj = hovered_obj; if (selected_obj) - debug(0, "selected object %s", selected_obj->name); + debug(0, "selected object %s", selected_obj->name.c_str()); return true; case Common::EVENT_KEYDOWN: @@ -275,7 +283,6 @@ void Inventory::render(Graphics::Surface *surface) { return; background.render(surface); - Resources *res = Resources::instance(); for (int y = 0; y < 4; y++) { for (int x = 0; x < 6; x++) { @@ -286,7 +293,7 @@ void Inventory::render(Graphics::Surface *surface) { //debug(0, "%d,%d -> %u", x0, y0, item); - InventoryObject *obj = (InventoryObject *)res->dseg.ptr(READ_LE_UINT16(objects + item * 2)); + InventoryObject *obj = &objects[item]; graphics[idx].render(this, obj, surface); } } |