mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-24 03:24:50 +00:00
ACCESS: Beginnings of character/converse manager
This commit is contained in:
parent
6343ff72c4
commit
7aa2c7fe5c
@ -34,6 +34,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
|
||||
_useItem(_flags[100]), _startup(_flags[170]), _manScaleOff(_flags[172]) {
|
||||
_animation = nullptr;
|
||||
_bubbleBox = nullptr;
|
||||
_char = nullptr;
|
||||
_debugger = nullptr;
|
||||
_events = nullptr;
|
||||
_files = nullptr;
|
||||
@ -106,6 +107,7 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
|
||||
AccessEngine::~AccessEngine() {
|
||||
delete _animation;
|
||||
delete _bubbleBox;
|
||||
delete _char;
|
||||
delete _debugger;
|
||||
delete _events;
|
||||
delete _files;
|
||||
@ -147,6 +149,7 @@ void AccessEngine::initialize() {
|
||||
ASurface::init();
|
||||
_animation = new AnimationManager(this);
|
||||
_bubbleBox = new BubbleBox(this);
|
||||
_char = new CharManager(this);
|
||||
_debugger = new Debugger(this);
|
||||
_events = new EventsManager(this);
|
||||
_files = new FileManager(this);
|
||||
@ -197,7 +200,7 @@ int AccessEngine::getRandomNumber(int maxNumber) {
|
||||
return _randomSource.getRandomNumber(maxNumber);
|
||||
}
|
||||
|
||||
void AccessEngine::loadCells(Common::Array<RoomInfo::CellIdent> &cells) {
|
||||
void AccessEngine::loadCells(Common::Array<CellIdent> &cells) {
|
||||
for (uint i = 0; i < cells.size(); ++i) {
|
||||
byte *spriteData = _files->loadFile(cells[i]._fileNum, cells[i]._subfile);
|
||||
_objectsTable[cells[i]._cell] = new SpriteResource(this,
|
||||
@ -371,4 +374,8 @@ void AccessEngine::freeChar() {
|
||||
_animation->freeAnimationData();
|
||||
}
|
||||
|
||||
void AccessEngine::loadChar(int charId) {
|
||||
|
||||
}
|
||||
|
||||
} // End of namespace Access
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "graphics/surface.h"
|
||||
#include "access/animation.h"
|
||||
#include "access/bubble_box.h"
|
||||
#include "access/char.h"
|
||||
#include "access/data.h"
|
||||
#include "access/debugger.h"
|
||||
#include "access/events.h"
|
||||
@ -108,6 +109,7 @@ protected:
|
||||
public:
|
||||
AnimationManager *_animation;
|
||||
BubbleBox *_bubbleBox;
|
||||
CharManager *_char;
|
||||
Debugger *_debugger;
|
||||
EventsManager *_events;
|
||||
FileManager *_files;
|
||||
@ -122,6 +124,7 @@ public:
|
||||
ASurface *_current;
|
||||
ASurface _buffer1;
|
||||
ASurface _buffer2;
|
||||
Common::Array<CharEntry *> _charTable;
|
||||
SpriteResource *_objectsTable[100];
|
||||
int _establishTable[100];
|
||||
bool _establishFlag;
|
||||
@ -204,7 +207,7 @@ public:
|
||||
|
||||
int getRandomNumber(int maxNumber);
|
||||
|
||||
void loadCells(Common::Array<RoomInfo::CellIdent> &cells);
|
||||
void loadCells(Common::Array<CellIdent> &cells);
|
||||
|
||||
/**
|
||||
* Free the sprites list
|
||||
@ -236,6 +239,8 @@ public:
|
||||
void doLoadSave();
|
||||
|
||||
void freeChar();
|
||||
|
||||
void loadChar(int charId);
|
||||
};
|
||||
|
||||
} // End of namespace Access
|
||||
|
89
engines/access/char.cpp
Normal file
89
engines/access/char.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
/* 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 "common/memstream.h"
|
||||
#include "access/access.h"
|
||||
#include "access/char.h"
|
||||
#include "access/amazon/amazon_resources.h"
|
||||
|
||||
namespace Access {
|
||||
|
||||
CharEntry::CharEntry(const byte *data) {
|
||||
Common::MemoryReadStream s(data, 999);
|
||||
|
||||
_charFlag = s.readByte();
|
||||
_estabFlag = s.readSint16LE();
|
||||
_screenFile._fileNum = s.readSint16LE();
|
||||
_screenFile._subfile = s.readSint16LE();
|
||||
|
||||
_paletteFile._fileNum = s.readSint16LE();
|
||||
_paletteFile._subfile = s.readUint16LE();
|
||||
_startColor = s.readUint16LE();
|
||||
_numColors = s.readUint16LE();
|
||||
|
||||
// Load cells
|
||||
for (byte cell = s.readByte(); cell != 0xff; cell = s.readByte()) {
|
||||
CellIdent ci;
|
||||
ci._cell = cell;
|
||||
ci._fileNum = s.readSint16LE();
|
||||
ci._subfile = s.readUint16LE();
|
||||
|
||||
_cells.push_back(ci);
|
||||
}
|
||||
|
||||
_animFile._fileNum = s.readSint16LE();
|
||||
_animFile._subfile = s.readUint16LE();
|
||||
_scriptFile._fileNum = s.readSint16LE();
|
||||
_scriptFile._subfile = s.readUint16LE();
|
||||
|
||||
for (int16 v = s.readSint16LE(); v != -1; v = s.readSint16LE()) {
|
||||
ExtraCell ec;
|
||||
ec._vidTable = v;
|
||||
ec._vidTable1 = s.readSint16LE();
|
||||
ec._vidSTable = s.readSint16LE();
|
||||
ec._vidSTable1 = s.readSint16LE();
|
||||
|
||||
_extraCells.push_back(ec);
|
||||
}
|
||||
}
|
||||
|
||||
CharEntry::CharEntry() {
|
||||
_charFlag = 0;
|
||||
_estabFlag = 0;
|
||||
_startColor = _numColors = 0;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
CharManager::CharManager(AccessEngine *vm) : Manager(vm) {
|
||||
switch (vm->getGameID()) {
|
||||
case GType_Amazon:
|
||||
// Setup character list
|
||||
for (int i = 0; i < 37; ++i)
|
||||
_charTable.push_back(CharEntry(Amazon::CHARTBL[i]));
|
||||
break;
|
||||
default:
|
||||
error("Unknown game");
|
||||
}
|
||||
}
|
||||
|
||||
} // End of namespace Access
|
58
engines/access/char.h
Normal file
58
engines/access/char.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* 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_CHAR_H
|
||||
#define ACCESS_CHAR_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
#include "common/array.h"
|
||||
#include "access/data.h"
|
||||
|
||||
namespace Access {
|
||||
|
||||
class CharEntry {
|
||||
public:
|
||||
int _charFlag;
|
||||
int _estabFlag;
|
||||
FileIdent _screenFile;
|
||||
FileIdent _paletteFile;
|
||||
int _startColor, _numColors;
|
||||
Common::Array<CellIdent> _cells;
|
||||
FileIdent _animFile;
|
||||
FileIdent _scriptFile;
|
||||
Common::Array<ExtraCell> _extraCells;
|
||||
public:
|
||||
CharEntry(const byte *data);
|
||||
|
||||
CharEntry();
|
||||
};
|
||||
|
||||
class CharManager: public Manager {
|
||||
public:
|
||||
Common::Array<CharEntry> _charTable;
|
||||
public:
|
||||
CharManager(AccessEngine *vm);
|
||||
};
|
||||
|
||||
} // End of namespace Access
|
||||
|
||||
#endif /* ACCESS_CHAR_H */
|
@ -40,6 +40,20 @@ public:
|
||||
Manager(AccessEngine *vm) : _vm(vm) {}
|
||||
};
|
||||
|
||||
struct FileIdent {
|
||||
int _fileNum;
|
||||
int _subfile;
|
||||
|
||||
FileIdent() {
|
||||
_fileNum = -1;
|
||||
_subfile = 0;
|
||||
}
|
||||
};
|
||||
|
||||
struct CellIdent : FileIdent {
|
||||
byte _cell;
|
||||
};
|
||||
|
||||
struct TimerEntry {
|
||||
int _initTm;
|
||||
int _timer;
|
||||
|
@ -5,6 +5,7 @@ MODULE_OBJS := \
|
||||
asurface.o \
|
||||
access.o \
|
||||
bubble_box.o \
|
||||
char.o \
|
||||
data.o \
|
||||
debugger.o \
|
||||
decompress.o \
|
||||
|
@ -227,13 +227,8 @@ void Room::loadRoomData(const byte *roomData) {
|
||||
|
||||
// Load extra cells
|
||||
_vm->_extraCells.clear();
|
||||
for (uint i = 0; i < roomInfo._vidTable.size(); ++i) {
|
||||
ExtraCell ec;
|
||||
ec._vidTable = roomInfo._vidTable[i] & 0xffff;
|
||||
ec._vidTable1 = roomInfo._vidTable[i] >> 16;
|
||||
|
||||
_vm->_extraCells.push_back(ec);
|
||||
}
|
||||
for (uint i = 0; i < roomInfo._extraCells.size(); ++i)
|
||||
_vm->_extraCells.push_back(roomInfo._extraCells[i]);
|
||||
|
||||
// Load sounds for the scene
|
||||
_vm->_sound->loadSounds(roomInfo._sounds);
|
||||
@ -726,34 +721,34 @@ RoomInfo::RoomInfo(const byte *data, int gameType) {
|
||||
_roomFlag = stream.readByte();
|
||||
|
||||
if (gameType != GType_MartianMemorandum)
|
||||
_estIndex = (int16)stream.readUint16LE();
|
||||
_estIndex = stream.readSint16LE();
|
||||
else
|
||||
_estIndex = -1;
|
||||
|
||||
_musicFile._fileNum = (int16)stream.readUint16LE();
|
||||
_musicFile._fileNum = stream.readSint16LE();
|
||||
_musicFile._subfile = stream.readUint16LE();
|
||||
_scaleH1 = stream.readByte();
|
||||
_scaleH2 = stream.readByte();
|
||||
_scaleN1 = stream.readByte();
|
||||
_playFieldFile._fileNum = (int16)stream.readUint16LE();
|
||||
_playFieldFile._fileNum = stream.readSint16LE();
|
||||
_playFieldFile._subfile = stream.readUint16LE();
|
||||
|
||||
for (byte cell = stream.readByte(); cell != 0xff; cell = stream.readByte()) {
|
||||
CellIdent ci;
|
||||
ci._cell = cell;
|
||||
ci._fileNum = (int16)stream.readUint16LE();
|
||||
ci._fileNum = stream.readSint16LE();
|
||||
ci._subfile = stream.readUint16LE();
|
||||
|
||||
_cells.push_back(ci);
|
||||
}
|
||||
|
||||
_scriptFile._fileNum = (int16)stream.readUint16LE();
|
||||
_scriptFile._fileNum = stream.readSint16LE();
|
||||
_scriptFile._subfile = stream.readUint16LE();
|
||||
_animFile._fileNum = (int16)stream.readUint16LE();
|
||||
_animFile._fileNum = stream.readSint16LE();
|
||||
_animFile._subfile = stream.readUint16LE();
|
||||
_scaleI = stream.readByte();
|
||||
_scrollThreshold = stream.readByte();
|
||||
_paletteFile._fileNum = (int16)stream.readUint16LE();
|
||||
_paletteFile._fileNum = stream.readSint16LE();
|
||||
_paletteFile._subfile = stream.readUint16LE();
|
||||
if (_paletteFile._fileNum == -1) {
|
||||
_startColor = _numColors = 0;
|
||||
@ -762,15 +757,18 @@ RoomInfo::RoomInfo(const byte *data, int gameType) {
|
||||
_numColors = stream.readUint16LE();
|
||||
}
|
||||
|
||||
for (int16 v = (int16)stream.readUint16LE(); v != -1;
|
||||
v = (int16)stream.readUint16LE()) {
|
||||
uint16 v2 = stream.readUint16LE();
|
||||
for (int16 v = stream.readSint16LE(); v != -1; v = stream.readSint16LE()) {
|
||||
ExtraCell ec;
|
||||
ec._vidTable = v;
|
||||
ec._vidTable1 = stream.readSint16LE();
|
||||
ec._vidSTable = stream.readSint16LE();
|
||||
ec._vidSTable1 = stream.readSint16LE();
|
||||
|
||||
_vidTable.push_back(v | ((uint32)v2 << 16));
|
||||
_extraCells.push_back(ec);
|
||||
}
|
||||
|
||||
for (int16 fileNum = (int16)stream.readUint16LE(); fileNum != -1;
|
||||
fileNum = (int16)stream.readUint16LE()) {
|
||||
for (int16 fileNum = stream.readSint16LE(); fileNum != -1;
|
||||
fileNum = stream.readSint16LE()) {
|
||||
SoundIdent fi;
|
||||
fi._fileNum = fileNum;
|
||||
fi._subfile = stream.readUint16LE();
|
||||
|
@ -156,15 +156,6 @@ public:
|
||||
|
||||
class RoomInfo {
|
||||
public:
|
||||
struct FileIdent {
|
||||
int _fileNum;
|
||||
int _subfile;
|
||||
};
|
||||
|
||||
struct CellIdent : FileIdent {
|
||||
byte _cell;
|
||||
};
|
||||
|
||||
struct SoundIdent : FileIdent {
|
||||
int _priority;
|
||||
};
|
||||
@ -184,7 +175,7 @@ public:
|
||||
FileIdent _paletteFile;
|
||||
int _startColor;
|
||||
int _numColors;
|
||||
Common::Array<uint32> _vidTable;
|
||||
Common::Array<ExtraCell> _extraCells;
|
||||
Common::Array<SoundIdent> _sounds;
|
||||
public:
|
||||
RoomInfo(const byte *data, int gameType);
|
||||
|
@ -99,7 +99,7 @@ void Scripts::executeCommand(int commandIndex) {
|
||||
&Scripts::cmdPrint, &Scripts::cmdRetPos, &Scripts::cmdAnim,
|
||||
&Scripts::cmdSetFlag, &Scripts::cmdCheckFlag, &Scripts::cmdGoto,
|
||||
&Scripts::cmdSetInventory, &Scripts::cmdSetInventory, &Scripts::cmdCheckInventory,
|
||||
&Scripts::cmdSetTex, &Scripts::cmdNewRoom, &Scripts::CMDCONVERSE,
|
||||
&Scripts::cmdSetTex, &Scripts::cmdNewRoom, &Scripts::cmdConverse,
|
||||
&Scripts::cmdCheckFrame, &Scripts::cmdCheckAnim, &Scripts::cmdSnd,
|
||||
&Scripts::cmdRetNeg, &Scripts::cmdRetPos, &Scripts::cmdCheckLoc,
|
||||
&Scripts::cmdSetAnim, &Scripts::cmdDispInv, &Scripts::cmdSetTimer,
|
||||
@ -309,7 +309,22 @@ void Scripts::cmdNewRoom() {
|
||||
cmdRetPos();
|
||||
}
|
||||
|
||||
void Scripts::CMDCONVERSE() { error("TODO CMDCONVERSE"); }
|
||||
void Scripts::cmdConverse() {
|
||||
_vm->_conversation = _data->readUint16LE();
|
||||
_vm->_room->clearRoom();
|
||||
_vm->freeChar();
|
||||
_vm->loadChar(_vm->_conversation);
|
||||
_vm->_events->setCursor(CURSOR_ARROW);
|
||||
|
||||
_vm->_images.clear();
|
||||
_vm->_oldRects.clear();
|
||||
_sequence = 0;
|
||||
searchForSequence();
|
||||
|
||||
if (_vm->_screen->_vesaMode) {
|
||||
_vm->_converseMode = 1;
|
||||
}
|
||||
}
|
||||
|
||||
void Scripts::cmdCheckFrame() {
|
||||
int id = _data->readUint16LE();
|
||||
|
@ -79,7 +79,7 @@ protected:
|
||||
void cmdCheckInventory();
|
||||
void cmdSetTex();
|
||||
void cmdNewRoom();
|
||||
void CMDCONVERSE();
|
||||
void cmdConverse();
|
||||
void cmdCheckFrame();
|
||||
void cmdCheckAnim();
|
||||
void cmdSnd();
|
||||
|
Loading…
x
Reference in New Issue
Block a user