From 02d4001f578c72cd23d22dfd9d10c5e37d151737 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Fri, 2 Mar 2007 22:23:02 +0000 Subject: added inventory objects loader routine svn-id: r25936 --- engines/parallaction/disk.cpp | 16 ++++++++++++++++ engines/parallaction/disk.h | 3 +++ engines/parallaction/inventory.cpp | 17 +++-------------- 3 files changed, 22 insertions(+), 14 deletions(-) (limited to 'engines/parallaction') diff --git a/engines/parallaction/disk.cpp b/engines/parallaction/disk.cpp index 86674be31e..ff4487fbf6 100644 --- a/engines/parallaction/disk.cpp +++ b/engines/parallaction/disk.cpp @@ -116,4 +116,20 @@ void loadFont(const char* name, Cnv* cnv) { _vm->_graphics->loadExternalCnv(path, cnv); } +// loads character's icons set + +void openObjects(const char *name, Cnv* cnv) { + + if (!scumm_strnicmp("mini", name, 4)) { + name += 4; + } + + char path[PATH_LEN]; + sprintf(path, "%sobj", name); + + _vm->_graphics->loadExternalCnv(path, cnv); + + return; +} + } // namespace Parallaction diff --git a/engines/parallaction/disk.h b/engines/parallaction/disk.h index 362439037b..c1d3b2f811 100644 --- a/engines/parallaction/disk.h +++ b/engines/parallaction/disk.h @@ -74,9 +74,12 @@ public: void openLocation(const char *name, char* script); void openTalk(const char *name, Cnv *cnv); +void openObjects(const char *name, Cnv *cnv); void loadPointer(StaticCnv* cnv); void loadHead(const char* name, StaticCnv* cnv); void loadFont(const char* name, Cnv* cnv); + + } // namespace Parallaction diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp index c43f13e44b..d3e046ff2e 100644 --- a/engines/parallaction/inventory.cpp +++ b/engines/parallaction/inventory.cpp @@ -22,6 +22,7 @@ #include "parallaction/parallaction.h" +#include "parallaction/disk.h" #include "parallaction/zone.h" #include "parallaction/graphics.h" #include "parallaction/inventory.h" @@ -368,22 +369,10 @@ void cleanInventory() { } -// loads character's icons set -void loadCharacterItems(const char *character) { - - if (!scumm_strnicmp("mini", character, 4)) character += 4; - - char filename[PATH_LEN]; - sprintf(filename, "%sobj", character); - - _vm->_graphics->loadExternalCnv(filename, &_characterInventory); - - return; -} void refreshInventory(const char *character) { - loadCharacterItems(character); + openObjects(character, &_characterInventory); redrawInventory(); _vm->_graphics->freeCnv(&_characterInventory); @@ -392,7 +381,7 @@ void refreshInventory(const char *character) { void refreshInventoryItem(const char *character, uint16 index) { - loadCharacterItems(character); + openObjects(character, &_characterInventory); drawInventoryItem(index, &_inventory[index]); _vm->_graphics->freeCnv(&_characterInventory); -- cgit v1.2.3