mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-24 11:36:22 +00:00
ACCESS: Beginnings of inventory management
This commit is contained in:
parent
00633b94be
commit
d04a6d2d7a
@ -35,6 +35,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
|
||||
_debugger = nullptr;
|
||||
_events = nullptr;
|
||||
_files = nullptr;
|
||||
_inventory = nullptr;
|
||||
_player = nullptr;
|
||||
_room = nullptr;
|
||||
_screen = nullptr;
|
||||
@ -56,10 +57,6 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
|
||||
_music = nullptr;
|
||||
_title = nullptr;
|
||||
_converseMode = 0;
|
||||
_startInvItem = 0;
|
||||
_startAboutItem = 0;
|
||||
_startTravelItem = 0;
|
||||
_startInvBox = 0;
|
||||
_startAboutBox = 0;
|
||||
_startTravelBox = 0;
|
||||
_numImages = 0;
|
||||
@ -104,7 +101,6 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
|
||||
_antFlag = false;
|
||||
_allenFlag = false;
|
||||
_noSound = false;
|
||||
Common::fill(&inv[0], &inv[85], 0);
|
||||
Common::fill(&_help1[0], &_help1[366], 0);
|
||||
Common::fill(&_help2[0], &_help2[366], 0);
|
||||
Common::fill(&_help1[0], &_help3[366], 0);
|
||||
@ -126,6 +122,7 @@ AccessEngine::~AccessEngine() {
|
||||
delete _debugger;
|
||||
delete _events;
|
||||
delete _files;
|
||||
delete _inventory;
|
||||
delete _player;
|
||||
delete _room;
|
||||
delete _screen;
|
||||
@ -170,6 +167,7 @@ void AccessEngine::initialize() {
|
||||
_debugger = new Debugger(this);
|
||||
_events = new EventsManager(this);
|
||||
_files = new FileManager(this);
|
||||
_inventory = new InventoryManager(this);
|
||||
_player = new Player(this);
|
||||
_screen = new Screen(this);
|
||||
_sound = new SoundManager(this, _mixer);
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "access/debugger.h"
|
||||
#include "access/events.h"
|
||||
#include "access/files.h"
|
||||
#include "access/inventory.h"
|
||||
#include "access/player.h"
|
||||
#include "access/room.h"
|
||||
#include "access/screen.h"
|
||||
@ -105,6 +106,7 @@ public:
|
||||
Debugger *_debugger;
|
||||
EventsManager *_events;
|
||||
FileManager *_files;
|
||||
InventoryManager *_inventory;
|
||||
Player *_player;
|
||||
Room *_room;
|
||||
Screen *_screen;
|
||||
@ -139,10 +141,8 @@ public:
|
||||
byte *_music;
|
||||
byte *_title;
|
||||
int _converseMode;
|
||||
int _startInvItem;
|
||||
int _startAboutItem;
|
||||
int _startTravelItem;
|
||||
int _startInvBox;
|
||||
int _startAboutBox;
|
||||
int _startTravelBox;
|
||||
bool _currentCharFlag;
|
||||
@ -164,7 +164,7 @@ public:
|
||||
int _intTim[3];
|
||||
int _timer[3];
|
||||
bool _timerFlag;
|
||||
byte _flags[99];
|
||||
Common::Array<int> _flags;
|
||||
byte _useItem[23];
|
||||
int _guardLoc;
|
||||
int _guardFind;
|
||||
@ -181,7 +181,6 @@ public:
|
||||
bool _antFlag;
|
||||
bool _allenFlag;
|
||||
bool _noSound;
|
||||
int inv[85];
|
||||
byte _help1[366];
|
||||
byte _help2[366];
|
||||
byte _help3[366];
|
||||
|
@ -47,6 +47,7 @@ AmazonEngine::AmazonEngine(OSystem *syst, const AccessGameDescription *gameDesc)
|
||||
_rawInactiveY = 0;
|
||||
_inactiveYOff = 0;
|
||||
Common::fill(&_esTabTable[0], &_esTabTable[100], 0);
|
||||
_flags.resize(122);
|
||||
}
|
||||
|
||||
AmazonEngine::~AmazonEngine() {
|
||||
|
@ -986,6 +986,27 @@ extern const byte *CHARTBL[] = {
|
||||
CRACK, LETTER
|
||||
};
|
||||
|
||||
const char *const INVENTORY_NAMES[] = {
|
||||
"RAT", "ALCOHOL", "SAFE COMBINATION", "BEAKER", "MICROFILM",
|
||||
"VAULT KEY", "BOLT CUTTERS", "BLOWGUN", "LOVE POTION", "MONEY",
|
||||
"DARTS", "TAPE", "JUNGLE POTION", "MOVIE", "CABINET KEY",
|
||||
"DISPLAY CASE KEY", "FLITCH', 27h, 'S CAR KEYS", "COAT HANGER",
|
||||
"CROWBAR", "COMPASS", "MAP", "LETTER OPENER", "LETTER",
|
||||
"DECODER", "DIPPED DART", "LOADED BLOWGUN", "CARD", "JERRYCAN",
|
||||
"CIGARETTES", "BIKE PUMP", "PARACHUTE", "PESO", "PEPPERS",
|
||||
"MACHETE", "POISON ROOT", "AMMUNITION", "PADDLE", "FISHING NET",
|
||||
"RAT TRAP", "CHEESE", "LOADED TRAP", "KNIFE", "CHOPPED PEPPERS",
|
||||
"LIGHTER", "LADDER", "SMALL POLE", "JEEP KEY", "CHAIN", "ARROW",
|
||||
"FILLED JERRY CAN", "EXPLOSIVES", "GEIGER COUNTER", "VINE",
|
||||
"GOLD NUGGET", "HOLLOW REED", "AMAZON QUEEN KEYS", "FISHING POLE",
|
||||
"HARPOON", "RAG", "BOTTLE OF RUM", "RAG IN BOTTLE", "MOLOTOV COCKTAIL",
|
||||
"JUNGLE PLANT", "LADLE", "WORM", "FISH", "FIREWORKS", "BAITED POLE",
|
||||
"FILLED LADLE", "EMERALD", "SMALL KEY", "SCROLL", "LIT EXPLOSIVES",
|
||||
"LIGHTER", "BROKEN SPEAR", "SHOE LACES", "TORCH", "LACES AND SPEAR",
|
||||
"KNIFE SPEAR", "GARBAGE CAN", "RAFT", "INFLATED RAFT",
|
||||
"JASON'S CAR KEYS", "PESO BILLS", "PLANK"
|
||||
};
|
||||
|
||||
} // End of namespace Amazon
|
||||
|
||||
} // End of namespace Access
|
||||
|
@ -39,6 +39,8 @@ extern const byte *ROOM_TABLE[];
|
||||
|
||||
extern const byte *CHARTBL[];
|
||||
|
||||
extern const char *const INVENTORY_NAMES[];
|
||||
|
||||
} // End of namespace Amazon
|
||||
|
||||
} // End of namespace Access
|
||||
|
61
engines/access/inventory.cpp
Normal file
61
engines/access/inventory.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "access/inventory.h"
|
||||
#include "access/access.h"
|
||||
#include "access/amazon/amazon_resources.h"
|
||||
|
||||
namespace Access {
|
||||
|
||||
InventoryManager::InventoryManager(AccessEngine *vm) : Manager(vm) {
|
||||
_startInvItem = 0;
|
||||
_startInvBox = 0;
|
||||
_invChangeFlag = true;
|
||||
_startAboutItem = 0;
|
||||
_startTravelItem = 0;
|
||||
|
||||
const char *const *names = Amazon::INVENTORY_NAMES;
|
||||
switch (vm->getGameID()) {
|
||||
case GType_Amazon:
|
||||
_inv.resize(85);
|
||||
break;
|
||||
default:
|
||||
error("Unknown game");
|
||||
}
|
||||
|
||||
for (uint i = 0; i < _inv.size(); ++i)
|
||||
_names.push_back(names[i]);
|
||||
}
|
||||
|
||||
int &InventoryManager::operator[](int idx) {
|
||||
return _inv[idx];
|
||||
}
|
||||
|
||||
int InventoryManager::useItem() {
|
||||
return _vm->_flags[USE_ITEM_FLAG_INDEX];
|
||||
}
|
||||
|
||||
void InventoryManager::setUseItem(int itemId) {
|
||||
_vm->_flags[USE_ITEM_FLAG_INDEX] = itemId;
|
||||
}
|
||||
|
||||
} // End of namespace Access
|
56
engines/access/inventory.h
Normal file
56
engines/access/inventory.h
Normal file
@ -0,0 +1,56 @@
|
||||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ACCESS_INVENTORY_H
|
||||
#define ACCESS_INVENTORY_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/array.h"
|
||||
#include "common/rect.h"
|
||||
#include "common/str-array.h"
|
||||
#include "access/data.h"
|
||||
|
||||
namespace Access {
|
||||
|
||||
#define USE_ITEM_FLAG_INDEX 100
|
||||
|
||||
class InventoryManager : public Manager {
|
||||
public:
|
||||
Common::Array<int> _inv;
|
||||
Common::StringArray _names;
|
||||
int _startInvItem;
|
||||
int _startInvBox;
|
||||
bool _invChangeFlag;
|
||||
int _startAboutItem;
|
||||
int _startTravelItem;
|
||||
public:
|
||||
InventoryManager(AccessEngine *vm);
|
||||
|
||||
int &operator[](int idx);
|
||||
|
||||
int useItem();
|
||||
void setUseItem(int itemId);
|
||||
};
|
||||
|
||||
} // End of namespace Access
|
||||
|
||||
#endif /* ACCESS_INVENTORY_H */
|
@ -10,6 +10,7 @@ MODULE_OBJS := \
|
||||
detection.o \
|
||||
events.o \
|
||||
files.o \
|
||||
inventory.o \
|
||||
player.o \
|
||||
resources.o \
|
||||
room.o \
|
||||
|
@ -87,7 +87,7 @@ void Scripts::executeCommand(int commandIndex) {
|
||||
&Scripts::cmdJumpUse, &Scripts::cmdJumpTalk, &Scripts::cmdNull,
|
||||
&Scripts::CMDPRINT, &Scripts::cmdRetPos, &Scripts::CMDANIM,
|
||||
&Scripts::cmdSetFlag, &Scripts::CMDCHECKFLAG, &Scripts::cmdGoto,
|
||||
&Scripts::CMDSETINV, &Scripts::CMDSETINV, &Scripts::CMDCHECKINV,
|
||||
&Scripts::cmdSetInventory, &Scripts::cmdSetInventory, &Scripts::cmdCheckInventory,
|
||||
&Scripts::CMDSETTEX, &Scripts::CMDNEWROOM, &Scripts::CMDCONVERSE,
|
||||
&Scripts::CMDCHECKFRAME, &Scripts::CMDCHECKANIM, &Scripts::CMDSND,
|
||||
&Scripts::CMDRETNEG, &Scripts::cmdRetPos, &Scripts::cmdCheckLoc,
|
||||
@ -175,7 +175,7 @@ void Scripts::CMDANIM() { }
|
||||
void Scripts::cmdSetFlag() {
|
||||
int flagNum = _data->readByte();
|
||||
byte flagVal = _data->readByte();
|
||||
assert(flagNum < 100);
|
||||
|
||||
_vm->_flags[flagNum] = flagVal;
|
||||
}
|
||||
|
||||
@ -195,8 +195,26 @@ void Scripts::cmdGoto() {
|
||||
searchForSequence();
|
||||
}
|
||||
|
||||
void Scripts::CMDSETINV() { }
|
||||
void Scripts::CMDCHECKINV() { }
|
||||
void Scripts::cmdSetInventory() {
|
||||
int itemId = _data->readByte();
|
||||
int itemVal = _data->readByte();
|
||||
|
||||
(*_vm->_inventory)[itemId] = itemVal;
|
||||
_vm->_inventory->_startInvItem = 0;
|
||||
_vm->_inventory->_startInvBox = 0;
|
||||
_vm->_inventory->_invChangeFlag = true;
|
||||
}
|
||||
|
||||
void Scripts::cmdCheckInventory() {
|
||||
int itemId = _data->readUint16LE();
|
||||
int itemVal = _data->readUint16LE();
|
||||
|
||||
if ((*_vm->_inventory)[itemId] == itemVal)
|
||||
cmdGoto();
|
||||
else
|
||||
_data->skip(2);
|
||||
}
|
||||
|
||||
void Scripts::CMDSETTEX() { }
|
||||
void Scripts::CMDNEWROOM() { }
|
||||
void Scripts::CMDCONVERSE() { }
|
||||
|
@ -61,8 +61,8 @@ protected:
|
||||
*/
|
||||
void cmdGoto();
|
||||
|
||||
void CMDSETINV();
|
||||
void CMDCHECKINV();
|
||||
void cmdSetInventory();
|
||||
void cmdCheckInventory();
|
||||
void CMDSETTEX();
|
||||
void CMDNEWROOM();
|
||||
void CMDCONVERSE();
|
||||
|
Loading…
x
Reference in New Issue
Block a user