mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-06 10:17:14 +00:00
MADS: Migrate engine to Path
This commit is contained in:
parent
cd9c525b6d
commit
f50a364ee8
@ -193,11 +193,11 @@ Animation::~Animation() {
|
||||
}
|
||||
|
||||
void Animation::load(MSurface &backSurface, DepthSurface &depthSurface,
|
||||
const Common::String &resName, int flags, Common::Array<PaletteCycle> *palCycles,
|
||||
const Common::Path &resName, int flags, Common::Array<PaletteCycle> *palCycles,
|
||||
SceneInfo *sceneInfo) {
|
||||
Common::String resourceName = resName;
|
||||
if (!resourceName.contains("."))
|
||||
resourceName += ".AA";
|
||||
Common::Path resourceName = resName;
|
||||
if (!resourceName.baseName().contains("."))
|
||||
resourceName.appendInPlace(".AA");
|
||||
|
||||
File f(resourceName);
|
||||
MadsPack madsPack(&f);
|
||||
@ -297,14 +297,14 @@ void Animation::load(MSurface &backSurface, DepthSurface &depthSurface,
|
||||
// Skip over field, since it's manually loaded
|
||||
_spriteSets[i] = nullptr;
|
||||
} else {
|
||||
_spriteSets[i] = new SpriteAsset(_vm, _header._spriteSetNames[i], flags);
|
||||
_spriteSets[i] = new SpriteAsset(_vm, Common::Path(_header._spriteSetNames[i]), flags);
|
||||
_spriteListIndexes[i] = _vm->_game->_scene._sprites.add(_spriteSets[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (_header._manualFlag) {
|
||||
Common::String assetResName = "*" + _header._spriteSetNames[_header._spritesIndex];
|
||||
SpriteAsset *sprites = new SpriteAsset(_vm, assetResName, flags);
|
||||
SpriteAsset *sprites = new SpriteAsset(_vm, Common::Path(assetResName), flags);
|
||||
_spriteSets[_header._spritesIndex] = sprites;
|
||||
|
||||
_spriteListIndexes[_header._spritesIndex] = _scene->_sprites.add(sprites);
|
||||
@ -328,7 +328,7 @@ void Animation::load(MSurface &backSurface, DepthSurface &depthSurface,
|
||||
f.close();
|
||||
}
|
||||
|
||||
void Animation::preLoad(const Common::String &resName, int level) {
|
||||
void Animation::preLoad(const Common::Path &resName, int level) {
|
||||
// No implementation in ScummVM, since access is fast enough that data
|
||||
// doesn't need to be preloaded
|
||||
}
|
||||
@ -401,7 +401,7 @@ void Animation::loadBackground(MSurface &backSurface, DepthSurface &depthSurface
|
||||
}
|
||||
} else if (header._bgType == ANIMBG_INTERFACE) {
|
||||
// Load a scene interface
|
||||
Common::String resourceName = "*" + header._backgroundFile;
|
||||
Common::Path resourceName = Common::Path("*").appendInPlace(header._backgroundFile);
|
||||
backSurface.load(resourceName);
|
||||
|
||||
if (palCycles)
|
||||
|
@ -201,13 +201,13 @@ public:
|
||||
/**
|
||||
* Loads animation data
|
||||
*/
|
||||
void load(MSurface &backSurface, DepthSurface &depthSurface, const Common::String &resName,
|
||||
void load(MSurface &backSurface, DepthSurface &depthSurface, const Common::Path &resName,
|
||||
int flags, Common::Array<PaletteCycle> *palCycles, SceneInfo *sceneInfo);
|
||||
|
||||
/**
|
||||
* Preload animation data for the scene
|
||||
*/
|
||||
void preLoad(const Common::String &resName, int level);
|
||||
void preLoad(const Common::Path &resName, int level);
|
||||
|
||||
/**
|
||||
* Setups up a loaded animation for playback
|
||||
|
@ -26,10 +26,11 @@
|
||||
|
||||
namespace MADS {
|
||||
|
||||
SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int flags) : _vm(vm) {
|
||||
Common::String resName = resourceName;
|
||||
if (!resName.hasSuffix(".SS") && !resName.hasSuffix(".ss"))
|
||||
resName += ".SS";
|
||||
SpriteAsset::SpriteAsset(MADSEngine *vm, const Common::Path &resourceName, int flags) : _vm(vm) {
|
||||
Common::Path resName = resourceName;
|
||||
Common::String baseName(resName.baseName());
|
||||
if (!baseName.hasSuffix(".SS") && !baseName.hasSuffix(".ss"))
|
||||
resName.appendInPlace(".SS");
|
||||
_srcSize = 0;
|
||||
|
||||
File file(resName);
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
SpriteAsset(MADSEngine *vm, const Common::String &resourceName, int flags);
|
||||
SpriteAsset(MADSEngine *vm, const Common::Path &resourceName, int flags);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -65,7 +65,7 @@ void AudioPlayer::setDefaultSoundGroup() {
|
||||
}
|
||||
}
|
||||
|
||||
void AudioPlayer::setSoundGroup(const Common::String &filename) {
|
||||
void AudioPlayer::setSoundGroup(const Common::Path &filename) {
|
||||
if (_filename != filename) {
|
||||
_dsrEntries.clear();
|
||||
|
||||
|
@ -42,7 +42,7 @@ public:
|
||||
AudioPlayer(Audio::Mixer *mixer, uint32 gameID);
|
||||
~AudioPlayer();
|
||||
|
||||
void setSoundGroup(const Common::String &filename);
|
||||
void setSoundGroup(const Common::Path &filename);
|
||||
void setDefaultSoundGroup();
|
||||
void playSound(int soundIndex, bool loop = false);
|
||||
void stop();
|
||||
@ -55,7 +55,7 @@ public:
|
||||
uint32 _gameID;
|
||||
|
||||
File _dsrFile;
|
||||
Common::String _filename;
|
||||
Common::Path _filename;
|
||||
Common::Array<DSREntry> _dsrEntries;
|
||||
};
|
||||
|
||||
|
@ -44,7 +44,7 @@ MadsPack::MadsPack(Common::SeekableReadStream *stream) {
|
||||
initialize(stream);
|
||||
}
|
||||
|
||||
MadsPack::MadsPack(const Common::String &resourceName, MADSEngine *vm) {
|
||||
MadsPack::MadsPack(const Common::Path &resourceName, MADSEngine *vm) {
|
||||
File file(resourceName);
|
||||
initialize(&file);
|
||||
file.close();
|
||||
|
@ -50,7 +50,7 @@ private:
|
||||
public:
|
||||
static bool isCompressed(Common::SeekableReadStream *stream);
|
||||
MadsPack(Common::SeekableReadStream *stream);
|
||||
MadsPack(const Common::String &resourceName, MADSEngine *_vm);
|
||||
MadsPack(const Common::Path &resourceName, MADSEngine *_vm);
|
||||
~MadsPack();
|
||||
|
||||
int getCount() const { return _count; }
|
||||
|
@ -71,11 +71,11 @@ void GameConversations::load(int id) {
|
||||
_conversations[slotIndex]._convId = id;
|
||||
|
||||
// Load the conversation data
|
||||
Common::String cnvFilename = Common::String::format("CONV%03d.CNV", id);
|
||||
Common::Path cnvFilename(Common::String::format("CONV%03d.CNV", id));
|
||||
_conversations[slotIndex]._data.load(cnvFilename);
|
||||
|
||||
// Load the conversation's CND data
|
||||
Common::String cndFilename = Common::String::format("CONV%03d.CND", id);
|
||||
Common::Path cndFilename(Common::String::format("CONV%03d.CND", id));
|
||||
_conversations[slotIndex]._cnd.load(cndFilename);
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ void GameConversations::run(int id) {
|
||||
|
||||
// Load sprite data for speaker portraits
|
||||
for (uint idx = 0; idx < _runningConv->_data._speakerCount; ++idx) {
|
||||
const Common::String &portraitName = _runningConv->_data._portraits[idx];
|
||||
const Common::Path &portraitName = _runningConv->_data._portraits[idx];
|
||||
_speakerSeries[idx] = _vm->_game->_scene._sprites.addSprites(portraitName, PALFLAG_RESERVED);
|
||||
|
||||
if (_speakerSeries[idx] > 0) {
|
||||
@ -607,7 +607,7 @@ bool GameConversations::scriptNode(ScriptEntry &scrEntry) {
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
void ConversationData::load(const Common::String &filename) {
|
||||
void ConversationData::load(const Common::Path &filename) {
|
||||
Common::File inFile;
|
||||
char buffer[16];
|
||||
|
||||
@ -740,7 +740,7 @@ ConversationConditionals::ConversationConditionals() : _numImports(0) {
|
||||
_currentNode = -1;
|
||||
}
|
||||
|
||||
void ConversationConditionals::load(const Common::String &filename) {
|
||||
void ConversationConditionals::load(const Common::Path &filename) {
|
||||
Common::File inFile;
|
||||
Common::SeekableReadStream *convFile;
|
||||
|
||||
|
@ -252,9 +252,9 @@ struct ConversationData {
|
||||
int _textSize;
|
||||
int _commandsSize;
|
||||
|
||||
Common::String _portraits[MAX_SPEAKERS];
|
||||
Common::Path _portraits[MAX_SPEAKERS];
|
||||
int _speakerFrame[MAX_SPEAKERS];
|
||||
Common::String _speechFile;
|
||||
Common::Path _speechFile;
|
||||
Common::Array<ConvMessage> _messages;
|
||||
Common::StringArray _textLines;
|
||||
Common::Array<ConvNode> _nodes;
|
||||
@ -263,7 +263,7 @@ struct ConversationData {
|
||||
/**
|
||||
* Load the specified conversation resource file
|
||||
*/
|
||||
void load(const Common::String &filename);
|
||||
void load(const Common::Path &filename);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -289,7 +289,7 @@ struct ConversationConditionals {
|
||||
/**
|
||||
* Load the specified conversation conditionals resource file
|
||||
*/
|
||||
void load(const Common::String &filename);
|
||||
void load(const Common::Path &filename);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -356,12 +356,12 @@ bool Debugger::Cmd_PlayAnim(int argc, const char **argv) {
|
||||
debugPrintf("Usage: %s <anim name>\n", argv[0]);
|
||||
return true;
|
||||
} else {
|
||||
Common::String resName = argv[1];
|
||||
if (resName.hasPrefix("@"))
|
||||
resName.deleteChar(0);
|
||||
Common::Path resName(argv[1]);
|
||||
if (argv[1][0] == '@')
|
||||
resName = Common::Path(argv[1] + 1);
|
||||
|
||||
Common::File f;
|
||||
if (f.exists(resName) || f.exists(resName + ".res")) {
|
||||
if (f.exists(resName) || f.exists(resName.append(".res"))) {
|
||||
AnimationView::execute(_vm, resName);
|
||||
return false;
|
||||
} else {
|
||||
@ -376,12 +376,12 @@ bool Debugger::Cmd_PlayText(int argc, const char **argv) {
|
||||
debugPrintf("Usage: %s <text name>\n", argv[0]);
|
||||
return true;
|
||||
} else {
|
||||
Common::String resName = argv[1];
|
||||
if (resName.hasPrefix("@"))
|
||||
resName.deleteChar(0);
|
||||
Common::Path resName(argv[1]);
|
||||
if (argv[1][0] == '@')
|
||||
resName = Common::Path(argv[1] + 1);
|
||||
|
||||
Common::File f;
|
||||
if (f.exists(resName) || f.exists(resName + ".txr")) {
|
||||
if (f.exists(resName) || f.exists(resName.append(".txr"))) {
|
||||
TextView::execute(_vm, resName);
|
||||
return false;
|
||||
} else {
|
||||
|
@ -194,7 +194,7 @@ DragonsphereScene::DragonsphereScene(MADSEngine *vm) : SceneLogic(vm),
|
||||
_action(vm->_game->_scene._action) {
|
||||
}
|
||||
|
||||
Common::String DragonsphereScene::formAnimName(char sepChar, int suffixNum) {
|
||||
Common::Path DragonsphereScene::formAnimName(char sepChar, int suffixNum) {
|
||||
return Resources::formatName(_scene->_currentSceneId, sepChar, suffixNum,
|
||||
EXT_NONE, "");
|
||||
}
|
||||
@ -203,7 +203,7 @@ Common::String DragonsphereScene::formAnimName(char sepChar, int suffixNum) {
|
||||
|
||||
void SceneInfoDragonsphere::loadCodes(BaseSurface &depthSurface, int variant) {
|
||||
Common::String ext = Common::String::format(".WW%d", variant);
|
||||
Common::String fileName = Resources::formatName(RESPREFIX_RM, _sceneId, ext);
|
||||
Common::Path fileName = Resources::formatName(RESPREFIX_RM, _sceneId, ext);
|
||||
if (!Common::File::exists(fileName))
|
||||
return;
|
||||
|
||||
|
@ -628,7 +628,7 @@ protected:
|
||||
/**
|
||||
* Forms an animation resource name
|
||||
*/
|
||||
Common::String formAnimName(char sepChar, int suffixNum);
|
||||
Common::Path formAnimName(char sepChar, int suffixNum);
|
||||
|
||||
/**
|
||||
* Plays appropriate sound for entering varous rooms
|
||||
|
@ -51,7 +51,7 @@ EventsManager::~EventsManager() {
|
||||
freeCursors();
|
||||
}
|
||||
|
||||
void EventsManager::loadCursors(const Common::String &spritesName) {
|
||||
void EventsManager::loadCursors(const Common::Path &spritesName) {
|
||||
delete _cursorSprites;
|
||||
_cursorSprites = new SpriteAsset(_vm, spritesName, 0x4000);
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public:
|
||||
/**
|
||||
* Loads the sprite set containing the cursors
|
||||
*/
|
||||
void loadCursors(const Common::String &spritesName);
|
||||
void loadCursors(const Common::Path &spritesName);
|
||||
|
||||
/**
|
||||
* Sets the cursor
|
||||
|
@ -55,7 +55,7 @@ Font *Font::getFont(const Common::String &fontName) {
|
||||
if (_fonts->contains(fontName)) {
|
||||
return _fonts->getVal(fontName);
|
||||
} else {
|
||||
Font *font = new Font(fontName);
|
||||
Font *font = new Font(Common::Path(fontName));
|
||||
_fonts->setVal(fontName, font);
|
||||
return font;
|
||||
}
|
||||
@ -68,7 +68,7 @@ Font::Font() {
|
||||
setFont(FONT_INTERFACE);
|
||||
}
|
||||
|
||||
Font::Font(const Common::String &filename) {
|
||||
Font::Font(const Common::Path &filename) {
|
||||
_charWidths = nullptr;
|
||||
_charOffs = nullptr;
|
||||
_charData = nullptr;
|
||||
@ -81,16 +81,16 @@ Font::~Font() {
|
||||
delete[] _charData;
|
||||
}
|
||||
|
||||
void Font::setFont(const Common::String &filename) {
|
||||
void Font::setFont(const Common::Path &filename) {
|
||||
if (!_filename.empty() && (filename == _filename))
|
||||
// Already using specified font, so don't bother reloading
|
||||
return;
|
||||
|
||||
_filename = filename;
|
||||
|
||||
Common::String resName = filename;
|
||||
if (!resName.hasSuffix(".FF"))
|
||||
resName += ".FF";
|
||||
Common::Path resName = filename;
|
||||
if (!resName.baseName().hasSuffix(".FF"))
|
||||
resName.appendInPlace(".FF");
|
||||
|
||||
MadsPack fontData(resName, _vm);
|
||||
Common::SeekableReadStream *fontFile = fontData.getItemStream(0);
|
||||
|
@ -69,14 +69,14 @@ private:
|
||||
uint8 *_charWidths;
|
||||
uint16 *_charOffs;
|
||||
uint8 *_charData;
|
||||
Common::String _filename;
|
||||
Common::Path _filename;
|
||||
|
||||
int getBpp(int charWidth);
|
||||
|
||||
void setFont(const Common::String &filename);
|
||||
void setFont(const Common::Path &filename);
|
||||
public:
|
||||
Font();
|
||||
Font(const Common::String &filename);
|
||||
Font(const Common::Path &filename);
|
||||
virtual ~Font();
|
||||
|
||||
void setColors(uint8 v1, uint8 v2, uint8 v3, uint8 v4);
|
||||
|
@ -463,7 +463,14 @@ void Game::synchronize(Common::Serializer &s, bool phase1) {
|
||||
s.syncAsSint16LE(_trigger);
|
||||
s.syncAsUint16LE(_triggerSetupMode);
|
||||
s.syncAsUint16LE(_triggerMode);
|
||||
s.syncString(_aaName);
|
||||
if (s.isSaving()) {
|
||||
Common::String name(_aaName.toString('/'));
|
||||
s.syncString(name);
|
||||
} else {
|
||||
Common::String name;
|
||||
s.syncString(name);
|
||||
_aaName = Common::Path(name, '/');
|
||||
}
|
||||
s.syncAsSint16LE(_lastSave);
|
||||
|
||||
_scene.synchronize(s);
|
||||
|
@ -143,7 +143,7 @@ public:
|
||||
TriggerMode _triggerMode;
|
||||
TriggerMode _triggerSetupMode;
|
||||
uint32 _priorFrameTimer;
|
||||
Common::String _aaName;
|
||||
Common::Path _aaName;
|
||||
int _winStatus;
|
||||
int _widepipeCtr;
|
||||
int _loadGameSlot;
|
||||
|
@ -80,7 +80,7 @@ bool MenuView::onEvent(Common::Event &event) {
|
||||
}
|
||||
|
||||
Common::String MenuView::getResourceName() {
|
||||
Common::String s(_filename);
|
||||
Common::String s(_filename.baseName());
|
||||
s.toLowercase();
|
||||
while (s.contains('.'))
|
||||
s.deleteLastChar();
|
||||
@ -96,9 +96,9 @@ char TextView::_resourceName[100];
|
||||
#define TV_NUM_FADE_STEPS 40
|
||||
#define TV_FADE_DELAY_MILLI 50
|
||||
|
||||
void TextView::execute(MADSEngine *vm, const Common::String &resName) {
|
||||
assert(resName.size() < 100);
|
||||
Common::strlcpy(_resourceName, resName.c_str(), sizeof(_resourceName));
|
||||
void TextView::execute(MADSEngine *vm, const Common::Path &resName) {
|
||||
assert(resName.toString('/').size() < 100);
|
||||
Common::strlcpy(_resourceName, resName.toString('/').c_str(), sizeof(_resourceName));
|
||||
vm->_dialogs->_pendingDialog = DIALOG_TEXTVIEW;
|
||||
}
|
||||
|
||||
@ -127,8 +127,8 @@ TextView::~TextView() {
|
||||
}
|
||||
|
||||
void TextView::load() {
|
||||
Common::String scriptName(_resourceName);
|
||||
scriptName += ".txr";
|
||||
Common::Path scriptName(_resourceName);
|
||||
scriptName.appendInPlace(".txr");
|
||||
|
||||
_filename = scriptName;
|
||||
if (!_script.open(scriptName))
|
||||
@ -454,9 +454,9 @@ void TextView::scriptDone() {
|
||||
|
||||
char AnimationView::_resourceName[100];
|
||||
|
||||
void AnimationView::execute(MADSEngine *vm, const Common::String &resName) {
|
||||
assert(resName.size() < 100);
|
||||
Common::strlcpy(_resourceName, resName.c_str(), sizeof(_resourceName));
|
||||
void AnimationView::execute(MADSEngine *vm, const Common::Path &resName) {
|
||||
assert(resName.toString('/').size() < 100);
|
||||
Common::strlcpy(_resourceName, resName.toString('/').c_str(), sizeof(_resourceName));
|
||||
vm->_dialogs->_pendingDialog = DIALOG_ANIMVIEW;
|
||||
}
|
||||
|
||||
@ -500,13 +500,13 @@ AnimationView::~AnimationView() {
|
||||
}
|
||||
|
||||
void AnimationView::load() {
|
||||
Common::String resName(_resourceName);
|
||||
if (!resName.hasSuffix("."))
|
||||
resName += ".res";
|
||||
Common::Path resName(_resourceName);
|
||||
if (!resName.baseName().hasSuffix("."))
|
||||
resName.appendInPlace(".res");
|
||||
|
||||
_filename = resName;
|
||||
if (!_script.open(resName))
|
||||
error("Could not open resource %s", resName.c_str());
|
||||
error("Could not open resource %s", resName.toString().c_str());
|
||||
|
||||
processLines();
|
||||
}
|
||||
@ -628,7 +628,7 @@ void AnimationView::loadNextResource() {
|
||||
// Set the sound data for the animation
|
||||
_vm->_sound->setEnabled(resEntry._soundFlag);
|
||||
|
||||
Common::String dsrName = _currentAnimation->_header._dsrName;
|
||||
Common::Path dsrName(_currentAnimation->_header._dsrName);
|
||||
if (!dsrName.empty())
|
||||
_vm->_audio->setSoundGroup(dsrName);
|
||||
|
||||
@ -704,7 +704,7 @@ void AnimationView::processLines() {
|
||||
}
|
||||
|
||||
// Add resource into list along with any set state information
|
||||
_resources.push_back(ResourceEntry(resName, _sfx, _soundFlag,
|
||||
_resources.push_back(ResourceEntry(Common::Path(resName), _sfx, _soundFlag,
|
||||
_bgLoadFlag, _showWhiteBars));
|
||||
|
||||
// Fx resets between resource entries
|
||||
|
@ -35,7 +35,7 @@ class MenuView: public FullScreenDialog {
|
||||
protected:
|
||||
bool _breakFlag;
|
||||
bool _redrawFlag;
|
||||
Common::String _filename;
|
||||
Common::Path _filename;
|
||||
|
||||
virtual void doFrame() = 0;
|
||||
|
||||
@ -125,7 +125,7 @@ public:
|
||||
/**
|
||||
* Queue the given text resource for display
|
||||
*/
|
||||
static void execute(MADSEngine *vm, const Common::String &resName);
|
||||
static void execute(MADSEngine *vm, const Common::Path &resName);
|
||||
|
||||
TextView(MADSEngine *vm);
|
||||
|
||||
@ -135,14 +135,14 @@ public:
|
||||
enum ResyncMode { NEVER, ALWAYS, BEGINNING };
|
||||
|
||||
struct ResourceEntry {
|
||||
Common::String _resourceName;
|
||||
Common::Path _resourceName;
|
||||
int _fx;
|
||||
bool _soundFlag;
|
||||
bool _bgFlag;
|
||||
bool _showWhiteBars;
|
||||
|
||||
ResourceEntry() {}
|
||||
ResourceEntry(const Common::String &resName, int fx, bool soundFlag,
|
||||
ResourceEntry(const Common::Path &resName, int fx, bool soundFlag,
|
||||
bool bgFlag, bool showWhiteBars) {
|
||||
_resourceName = resName;
|
||||
_fx = fx;
|
||||
@ -220,7 +220,7 @@ public:
|
||||
/**
|
||||
* Queue the given text resource for display
|
||||
*/
|
||||
static void execute(MADSEngine *vm, const Common::String &resName);
|
||||
static void execute(MADSEngine *vm, const Common::Path &resName);
|
||||
|
||||
AnimationView(MADSEngine *vm);
|
||||
|
||||
|
@ -50,7 +50,7 @@ MpsInstaller* MpsInstaller::open(const Common::Path& baseName) {
|
||||
filecnt = (indexSize - 12) / kEntryLength;
|
||||
|
||||
for (uint i = 0; i < filecnt; i++) {
|
||||
Common::String name = indexFile.readString('\0', kNameFieldLength);
|
||||
Common::Path name(indexFile.readString('\0', kNameFieldLength));
|
||||
uint16 compression = indexFile.readUint16LE();
|
||||
uint16 volumeNumber = indexFile.readUint16LE();
|
||||
uint32 offsetInVolume = indexFile.readUint32LE();
|
||||
@ -89,7 +89,7 @@ Common::SharedArchiveContents MpsInstaller::readContentsForPath(const Common::Pa
|
||||
FileDescriptor desc = _files.getVal(translated);
|
||||
|
||||
if (desc._compressionAlgo != 0 && desc._compressionAlgo != 1) {
|
||||
debug ("Unsupported compression algorithm %d for %s", desc._compressionAlgo, desc._fileName.c_str());
|
||||
debug ("Unsupported compression algorithm %d for %s", desc._compressionAlgo, desc._fileName.toString().c_str());
|
||||
return Common::SharedArchiveContents();
|
||||
}
|
||||
|
||||
@ -103,14 +103,14 @@ Common::SharedArchiveContents MpsInstaller::readContentsForPath(const Common::Pa
|
||||
Common::File fvol;
|
||||
Common::Path volumePath = _baseName.append(Common::String::format(".%03d", vol));
|
||||
if (!fvol.open(volumePath)) {
|
||||
error("Failed to open volume %s.%03d", volumePath.toString().c_str(), vol);
|
||||
error("Failed to open volume %s.%03d", volumePath.toString(Common::Path::kNativeSeparator).c_str(), vol);
|
||||
delete[] compressedBuf;
|
||||
return Common::SharedArchiveContents();
|
||||
}
|
||||
fvol.seek(off);
|
||||
int32 actual = fvol.read(outptr, rem);
|
||||
if (actual <= 0) {
|
||||
warning("Read failure in volume %s.%03d", volumePath.toString().c_str(), vol);
|
||||
warning("Read failure in volume %s.%03d", volumePath.toString(Common::Path::kNativeSeparator).c_str(), vol);
|
||||
delete[] compressedBuf;
|
||||
return Common::SharedArchiveContents();
|
||||
}
|
||||
@ -137,7 +137,7 @@ Common::SharedArchiveContents MpsInstaller::readContentsForPath(const Common::Pa
|
||||
if (!Common::decompressDCL(&compressedReadStream, uncompressedBuf, desc._compressedSize, uncompressedSize)) {
|
||||
delete[] compressedBuf;
|
||||
delete[] uncompressedBuf;
|
||||
error("Unable to decompress %s", desc._fileName.c_str());
|
||||
error("Unable to decompress %s", desc._fileName.toString().c_str());
|
||||
return Common::SharedArchiveContents();
|
||||
}
|
||||
delete[] compressedBuf;
|
||||
|
@ -50,7 +50,7 @@ private:
|
||||
_offsetInVolume(0),
|
||||
_volumeNumber(0) {}
|
||||
protected:
|
||||
FileDescriptor(const Common::String& name,
|
||||
FileDescriptor(const Common::Path &name,
|
||||
uint16 compression,
|
||||
uint16 volumeNumber,
|
||||
uint32 offsetInVolume,
|
||||
@ -63,7 +63,7 @@ private:
|
||||
_compressedSize(compressedSize),
|
||||
_uncompressedSize(uncompressedSize) {}
|
||||
|
||||
Common::String _fileName;
|
||||
Common::Path _fileName;
|
||||
uint _compressionAlgo;
|
||||
uint _volumeNumber;
|
||||
uint32 _offsetInVolume;
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
/**
|
||||
* Base method for descendents to load their contents
|
||||
*/
|
||||
virtual void load(const Common::String &resName) {}
|
||||
virtual void load(const Common::Path &resName) {}
|
||||
public:
|
||||
/**
|
||||
* Basic constructor
|
||||
|
@ -568,7 +568,7 @@ void PictureDialog::save() {
|
||||
_vm->_screen->translate(map);
|
||||
|
||||
// Load the inventory picture
|
||||
Common::String setName = Common::String::format("*OB%.3d.SS", _objectId);
|
||||
Common::Path setName(Common::String::format("*OB%.3d.SS", _objectId));
|
||||
SpriteAsset *asset = new SpriteAsset(_vm, setName, 0x8000);
|
||||
palette.setFullPalette(palette._mainPalette);
|
||||
|
||||
|
@ -75,7 +75,7 @@ void MainMenu::display() {
|
||||
|
||||
// Load each of the menu item assets and add to the scene sprites list
|
||||
for (int i = 0; i < 7; ++i) {
|
||||
Common::String spritesName = Resources::formatName(NEBULAR_MENUSCREEN,
|
||||
Common::Path spritesName = Resources::formatName(NEBULAR_MENUSCREEN,
|
||||
'A', i + 1, EXT_SS, "");
|
||||
_menuItems[i] = new SpriteAsset(_vm, spritesName, 0);
|
||||
_menuItemIndexes[i] = scene._sprites.add(_menuItems[i]);
|
||||
|
@ -303,7 +303,7 @@ NebularScene::NebularScene(MADSEngine *vm) : SceneLogic(vm),
|
||||
_action(vm->_game->_scene._action) {
|
||||
}
|
||||
|
||||
Common::String NebularScene::formAnimName(char sepChar, int suffixNum) {
|
||||
Common::Path NebularScene::formAnimName(char sepChar, int suffixNum) {
|
||||
return Resources::formatName(_scene->_currentSceneId, sepChar, suffixNum,
|
||||
EXT_NONE, "");
|
||||
}
|
||||
|
@ -1354,7 +1354,7 @@ protected:
|
||||
/**
|
||||
* Forms an animation resource name
|
||||
*/
|
||||
Common::String formAnimName(char sepChar, int suffixNum);
|
||||
Common::Path formAnimName(char sepChar, int suffixNum);
|
||||
|
||||
/**
|
||||
* Plays appropriate sound for entering various rooms
|
||||
|
@ -155,10 +155,10 @@ AdlibSample::AdlibSample(Common::SeekableReadStream &s) {
|
||||
|
||||
/*-----------------------------------------------------------------------*/
|
||||
|
||||
ASound::ASound(Audio::Mixer *mixer, OPL::OPL *opl, const Common::String &filename, int dataOffset) {
|
||||
ASound::ASound(Audio::Mixer *mixer, OPL::OPL *opl, const Common::Path &filename, int dataOffset) {
|
||||
// Open up the appropriate sound file
|
||||
if (!_soundFile.open(filename))
|
||||
error("Could not open file - %s", filename.c_str());
|
||||
error("Could not open file - %s", filename.toString().c_str());
|
||||
|
||||
// Initialize fields
|
||||
_commandParam = 0;
|
||||
@ -236,14 +236,14 @@ void ASound::validate() {
|
||||
};
|
||||
|
||||
for (int i = 1; i <= 9; ++i) {
|
||||
Common::String filename = Common::String::format("ASOUND.00%d", i);
|
||||
Common::Path filename(Common::String::format("ASOUND.00%d", i));
|
||||
if (!f.open(filename))
|
||||
error("Could not process - %s", filename.c_str());
|
||||
error("Could not process - %s", filename.toString().c_str());
|
||||
Common::String md5str = Common::computeStreamMD5AsString(f, 8192);
|
||||
f.close();
|
||||
|
||||
if (md5str != MD5[i - 1])
|
||||
error("Invalid sound file - %s", filename.c_str());
|
||||
error("Invalid sound file - %s", filename.toString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ public:
|
||||
* @param filename Specifies the adlib sound player file to use
|
||||
* @param dataOffset Offset in the file of the data segment
|
||||
*/
|
||||
ASound(Audio::Mixer *mixer, OPL::OPL *opl, const Common::String &filename, int dataOffset);
|
||||
ASound(Audio::Mixer *mixer, OPL::OPL *opl, const Common::Path &filename, int dataOffset);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
|
@ -167,7 +167,7 @@ PhantomScene::PhantomScene(MADSEngine *vm) : SceneLogic(vm),
|
||||
_action(vm->_game->_scene._action) {
|
||||
}
|
||||
|
||||
Common::String PhantomScene::formAnimName(char sepChar, int suffixNum) {
|
||||
Common::Path PhantomScene::formAnimName(char sepChar, int suffixNum) {
|
||||
return Resources::formatName(_scene->_currentSceneId, sepChar, suffixNum,
|
||||
EXT_NONE, "");
|
||||
}
|
||||
@ -176,7 +176,7 @@ Common::String PhantomScene::formAnimName(char sepChar, int suffixNum) {
|
||||
|
||||
void SceneInfoPhantom::loadCodes(BaseSurface &depthSurface, int variant) {
|
||||
Common::String ext = Common::String::format(".WW%d", variant);
|
||||
Common::String fileName = Resources::formatName(RESPREFIX_RM, _sceneId, ext);
|
||||
Common::Path fileName = Resources::formatName(RESPREFIX_RM, _sceneId, ext);
|
||||
if (!Common::File::exists(fileName))
|
||||
return;
|
||||
|
||||
|
@ -455,7 +455,7 @@ protected:
|
||||
/**
|
||||
* Forms an animation resource name
|
||||
*/
|
||||
Common::String formAnimName(char sepChar, int suffixNum);
|
||||
Common::Path formAnimName(char sepChar, int suffixNum);
|
||||
|
||||
/**
|
||||
* Plays appropriate sound for entering varous rooms
|
||||
|
@ -147,8 +147,8 @@ bool Player::loadSprites(const Common::String &prefix) {
|
||||
_numSprites = 0;
|
||||
if (!_spritesPrefix.empty()) {
|
||||
for (int fileIndex = 0; fileIndex < PLAYER_SPRITES_FILE_COUNT; ++fileIndex) {
|
||||
Common::String setName = Common::String::format("*%s_%c.SS",
|
||||
newPrefix.c_str(), suffixList[fileIndex]);
|
||||
Common::Path setName(Common::String::format("*%s_%c.SS",
|
||||
newPrefix.c_str(), suffixList[fileIndex]));
|
||||
if (fileIndex >= 5)
|
||||
_highSprites = true;
|
||||
|
||||
|
@ -39,12 +39,12 @@ private:
|
||||
* Details of a single entry in a HAG file index
|
||||
*/
|
||||
struct HagEntry {
|
||||
Common::String _resourceName;
|
||||
Common::Path _resourceName;
|
||||
uint32 _offset;
|
||||
uint32 _size;
|
||||
|
||||
HagEntry() : _offset(0), _size(0) {}
|
||||
HagEntry(Common::String resourceName, uint32 offset, uint32 size)
|
||||
HagEntry(const Common::Path &resourceName, uint32 offset, uint32 size)
|
||||
: _resourceName(resourceName), _offset(offset), _size(size) {
|
||||
}
|
||||
};
|
||||
@ -52,7 +52,7 @@ private:
|
||||
class HagIndex {
|
||||
public:
|
||||
Common::List<HagEntry> _entries;
|
||||
Common::String _filename;
|
||||
Common::Path _filename;
|
||||
};
|
||||
|
||||
Common::Array<HagIndex> _index;
|
||||
@ -66,12 +66,12 @@ private:
|
||||
* Given a resource name, opens up the correct HAG file and returns whether
|
||||
* an entry with the given name exists.
|
||||
*/
|
||||
bool getHeaderEntry(const Common::String &resourceName, HagIndex &hagIndex, HagEntry &hagEntry) const;
|
||||
bool getHeaderEntry(const Common::Path &resourceName, HagIndex &hagIndex, HagEntry &hagEntry) const;
|
||||
|
||||
/**
|
||||
* Returns the HAG resource filename that will contain a given resource
|
||||
*/
|
||||
Common::String getResourceFilename(const Common::String &resourceName) const;
|
||||
Common::Path getResourceFilename(const Common::Path &resourceName) const;
|
||||
|
||||
/**
|
||||
* Return a resource type given a resource name
|
||||
@ -99,10 +99,9 @@ HagArchive::~HagArchive() {
|
||||
|
||||
// Archive implementation
|
||||
bool HagArchive::hasFile(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
HagIndex hagIndex;
|
||||
HagEntry hagEntry;
|
||||
return getHeaderEntry(name, hagIndex, hagEntry);
|
||||
return getHeaderEntry(path, hagIndex, hagEntry);
|
||||
}
|
||||
|
||||
int HagArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
@ -123,19 +122,17 @@ int HagArchive::listMembers(Common::ArchiveMemberList &list) const {
|
||||
}
|
||||
|
||||
const Common::ArchiveMemberPtr HagArchive::getMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
if (!hasFile(name))
|
||||
if (!hasFile(path))
|
||||
return Common::ArchiveMemberPtr();
|
||||
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(name, *this));
|
||||
return Common::ArchiveMemberPtr(new Common::GenericArchiveMember(path, *this));
|
||||
}
|
||||
|
||||
Common::SeekableReadStream *HagArchive::createReadStreamForMember(const Common::Path &path) const {
|
||||
Common::String name = path.toString();
|
||||
HagIndex hagIndex;
|
||||
HagEntry hagEntry;
|
||||
|
||||
if (getHeaderEntry(name, hagIndex, hagEntry)) {
|
||||
if (getHeaderEntry(path, hagIndex, hagEntry)) {
|
||||
// Entry found. If the correct file is not already open, open it
|
||||
Common::File f;
|
||||
if (!f.open(hagIndex._filename))
|
||||
@ -180,8 +177,8 @@ void HagArchive::loadIndex(MADSEngine *vm) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Common::String filename = (sectionIndex == -1) ? "GLOBAL.HAG" :
|
||||
Common::String::format("SECTION%d.HAG", sectionIndex);
|
||||
Common::Path filename = (sectionIndex == -1) ? Common::Path("GLOBAL.HAG") :
|
||||
Common::Path(Common::String::format("SECTION%d.HAG", sectionIndex));
|
||||
if (sectionIndex == 10) {
|
||||
// Speech
|
||||
if (!Common::File::exists("SPEECH.HAG"))
|
||||
@ -190,7 +187,7 @@ void HagArchive::loadIndex(MADSEngine *vm) {
|
||||
filename = "SPEECH.HAG";
|
||||
}
|
||||
if (!hagFile.open(filename))
|
||||
error("Could not locate HAG file - %s", filename.c_str());
|
||||
error("Could not locate HAG file - %s", filename.toString().c_str());
|
||||
|
||||
// Check for header
|
||||
char headerBuffer[16];
|
||||
@ -219,14 +216,17 @@ void HagArchive::loadIndex(MADSEngine *vm) {
|
||||
}
|
||||
}
|
||||
|
||||
bool HagArchive::getHeaderEntry(const Common::String &resourceName,
|
||||
bool HagArchive::getHeaderEntry(const Common::Path &resourceName,
|
||||
HagIndex &hagIndex, HagEntry &hagEntry) const {
|
||||
Common::String resName = resourceName;
|
||||
Common::Path resName = resourceName;
|
||||
resName.toUppercase();
|
||||
if (resName[0] == '*')
|
||||
resName.deleteChar(0);
|
||||
Common::String baseName(resName.baseName());
|
||||
if (baseName[0] == '*') {
|
||||
baseName.deleteChar(0);
|
||||
resName = resName.getParent().appendComponent(baseName);
|
||||
}
|
||||
|
||||
Common::String hagFilename = getResourceFilename(resName);
|
||||
Common::Path hagFilename = getResourceFilename(resName);
|
||||
|
||||
// Find the index for the given file
|
||||
for (uint hagCtr = 0; hagCtr < _index.size(); ++hagCtr) {
|
||||
@ -236,7 +236,7 @@ bool HagArchive::getHeaderEntry(const Common::String &resourceName,
|
||||
Common::List<HagEntry>::iterator ei;
|
||||
for (ei = hagIndex._entries.begin(); ei != hagIndex._entries.end(); ++ei) {
|
||||
hagEntry = *ei;
|
||||
if (hagEntry._resourceName.compareToIgnoreCase(resName) == 0)
|
||||
if (hagEntry._resourceName.equalsIgnoreCase(resName))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -245,16 +245,17 @@ bool HagArchive::getHeaderEntry(const Common::String &resourceName,
|
||||
return false;
|
||||
}
|
||||
|
||||
Common::String HagArchive::getResourceFilename(const Common::String &resourceName) const {
|
||||
ResourceType resType = getResourceType(resourceName);
|
||||
Common::String outputFilename = "GLOBAL.HAG";
|
||||
Common::Path HagArchive::getResourceFilename(const Common::Path &resourceName) const {
|
||||
Common::String baseName(resourceName.baseName());
|
||||
ResourceType resType = getResourceType(baseName);
|
||||
Common::Path outputFilename = "GLOBAL.HAG";
|
||||
|
||||
if ((resType == RESTYPE_ROOM) || (resType == RESTYPE_SC)) {
|
||||
int value = atoi(resourceName.c_str() + 2);
|
||||
int value = atoi(baseName.c_str() + 2);
|
||||
int hagFileNum = (resType == RESTYPE_ROOM) ? value / 100 : value;
|
||||
|
||||
if (hagFileNum >= 0)
|
||||
outputFilename = Common::String::format("SECTION%d.HAG", hagFileNum);
|
||||
outputFilename = Common::Path(Common::String::format("SECTION%d.HAG", hagFileNum));
|
||||
}
|
||||
|
||||
if (resType == RESTYPE_SPEECH)
|
||||
@ -312,7 +313,7 @@ void Resources::init(MADSEngine *vm) {
|
||||
SearchMan.add("HAG", new HagArchive(vm));
|
||||
}
|
||||
|
||||
Common::String Resources::formatName(RESPREFIX resType, int id, const Common::String &ext) {
|
||||
Common::Path Resources::formatName(RESPREFIX resType, int id, const Common::String &ext) {
|
||||
Common::String result = "*";
|
||||
|
||||
if (resType == 3 && !id) {
|
||||
@ -337,10 +338,10 @@ Common::String Resources::formatName(RESPREFIX resType, int id, const Common::St
|
||||
result += ext;
|
||||
}
|
||||
|
||||
return result;
|
||||
return Common::Path(result);
|
||||
}
|
||||
|
||||
Common::String Resources::formatName(int prefix, char asciiCh, int id, EXTTYPE extType,
|
||||
Common::Path Resources::formatName(int prefix, char asciiCh, int id, EXTTYPE extType,
|
||||
const Common::String &suffix) {
|
||||
Common::String result;
|
||||
if (prefix <= 0) {
|
||||
@ -379,10 +380,10 @@ Common::String Resources::formatName(int prefix, char asciiCh, int id, EXTTYPE e
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
||||
return Common::Path(result);
|
||||
}
|
||||
|
||||
Common::String Resources::formatResource(const Common::String &resName,
|
||||
Common::Path Resources::formatResource(const Common::String &resName,
|
||||
const Common::String &hagFilename) {
|
||||
// int v1 = 0, v2 = 0;
|
||||
|
||||
@ -391,19 +392,19 @@ Common::String Resources::formatResource(const Common::String &resName,
|
||||
error("TODO: formatResource");
|
||||
} else {
|
||||
// File outside of hag file
|
||||
return resName;
|
||||
return Common::Path(resName);
|
||||
}
|
||||
}
|
||||
|
||||
Common::String Resources::formatAAName(int idx) {
|
||||
Common::Path Resources::formatAAName(int idx) {
|
||||
return formatName(0, 'I', idx, EXT_AA, "");
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
||||
void File::openFile(const Common::String &filename) {
|
||||
void File::openFile(const Common::Path &filename) {
|
||||
if (!Common::File::open(filename))
|
||||
error("Could not open file - %s", filename.c_str());
|
||||
error("Could not open file - %s", filename.toString().c_str());
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------*/
|
||||
|
@ -47,11 +47,11 @@ public:
|
||||
*/
|
||||
static void init(MADSEngine *vm);
|
||||
|
||||
static Common::String formatName(RESPREFIX resType, int id, const Common::String &ext);
|
||||
static Common::String formatName(int prefix, char asciiCh, int id,
|
||||
static Common::Path formatName(RESPREFIX resType, int id, const Common::String &ext);
|
||||
static Common::Path formatName(int prefix, char asciiCh, int id,
|
||||
EXTTYPE extType, const Common::String &suffix);
|
||||
static Common::String formatResource(const Common::String &resName, const Common::String &hagFilename);
|
||||
static Common::String formatAAName(int idx);
|
||||
static Common::Path formatResource(const Common::String &resName, const Common::String &hagFilename);
|
||||
static Common::Path formatAAName(int idx);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -67,12 +67,12 @@ public:
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
File(const Common::String &filename) { openFile(filename); }
|
||||
File(const Common::Path &filename) { openFile(filename); }
|
||||
|
||||
/**
|
||||
* Opens the given file, throwing an error if it can't be opened
|
||||
*/
|
||||
void openFile(const Common::String &filename);
|
||||
void openFile(const Common::Path &filename);
|
||||
};
|
||||
|
||||
class SynchronizedList : public Common::Array<int> {
|
||||
|
@ -141,7 +141,7 @@ void Scene::loadSceneLogic() {
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::loadScene(int sceneId, const Common::String &prefix, bool palFlag) {
|
||||
void Scene::loadScene(int sceneId, const Common::Path &prefix, bool palFlag) {
|
||||
// Store the previously active scene number and set the new one
|
||||
_priorSceneId = _currentSceneId;
|
||||
_currentSceneId = sceneId;
|
||||
@ -636,7 +636,7 @@ void Scene::checkKeyboard() {
|
||||
}
|
||||
}
|
||||
|
||||
int Scene::loadAnimation(const Common::String &resName, int trigger) {
|
||||
int Scene::loadAnimation(const Common::Path &resName, int trigger) {
|
||||
// WORKAROUND: If there's already a previous active animation used by the
|
||||
// scene, then free it before we create the new one
|
||||
if ((_vm->getGameID() == GType_RexNebular) && _animation[0])
|
||||
|
@ -175,7 +175,7 @@ public:
|
||||
* @param prefix Prefix to use for retrieving animation data
|
||||
* @param palFlag Flag for whether to reset the high/lo palette areas
|
||||
*/
|
||||
void loadScene(int sceneId, const Common::String &prefix, bool palFlag);
|
||||
void loadScene(int sceneId, const Common::Path &prefix, bool palFlag);
|
||||
|
||||
/**
|
||||
* Loads the hotstpots for the scene
|
||||
@ -212,7 +212,7 @@ public:
|
||||
/**
|
||||
* Load an animation
|
||||
*/
|
||||
int loadAnimation(const Common::String &resName, int trigger = 0);
|
||||
int loadAnimation(const Common::Path &resName, int trigger = 0);
|
||||
|
||||
/**
|
||||
* Returns a vocab entry
|
||||
|
@ -133,11 +133,11 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
|
||||
bool sceneFlag = sceneId >= 0;
|
||||
|
||||
// Figure out the resource to use
|
||||
Common::String resourceName;
|
||||
Common::Path resourceName;
|
||||
if (sceneFlag) {
|
||||
resourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".DAT");
|
||||
} else {
|
||||
resourceName = "*" + Resources::formatResource(resName, resName);
|
||||
resourceName = Common::Path("*").appendInPlace(Resources::formatResource(resName, resName));
|
||||
}
|
||||
|
||||
// Open the scene info resource for access
|
||||
@ -275,7 +275,7 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
|
||||
setResName += "*";
|
||||
setResName += setNames[i];
|
||||
|
||||
SpriteAsset *sprites = new SpriteAsset(_vm, setResName, flags);
|
||||
SpriteAsset *sprites = new SpriteAsset(_vm, Common::Path(setResName), flags);
|
||||
spriteSets.push_back(sprites);
|
||||
usageList.push_back(sprites->_usageIndex);
|
||||
}
|
||||
@ -302,7 +302,7 @@ void SceneInfo::load(int sceneId, int variant, const Common::String &resName,
|
||||
|
||||
void SceneInfo::loadPalette(int sceneId, int artFileNum, const Common::String &resName, int flags, BaseSurface &bgSurface) {
|
||||
bool sceneFlag = sceneId >= 0;
|
||||
Common::String resourceName;
|
||||
Common::Path resourceName;
|
||||
bool isV2 = (_vm->getGameID() != GType_RexNebular);
|
||||
Common::String extension = !isV2 ? ".ART" : ".TT";
|
||||
int paletteStream = !isV2 ? 0 : 2;
|
||||
@ -311,7 +311,7 @@ void SceneInfo::loadPalette(int sceneId, int artFileNum, const Common::String &r
|
||||
if (sceneFlag) {
|
||||
resourceName = Resources::formatName(RESPREFIX_RM, artFileNum, extension);
|
||||
} else {
|
||||
resourceName = "*" + Resources::formatResource(resName, resName);
|
||||
resourceName = Common::Path("*").appendInPlace(Resources::formatResource(resName, resName));
|
||||
}
|
||||
|
||||
// Load in the ART header and palette
|
||||
@ -354,14 +354,14 @@ void SceneInfo::loadPalette(int sceneId, int artFileNum, const Common::String &r
|
||||
|
||||
void SceneInfo::loadMadsV1Background(int sceneId, const Common::String &resName, int flags, BaseSurface &bgSurface) {
|
||||
bool sceneFlag = sceneId >= 0;
|
||||
Common::String resourceName;
|
||||
Common::Path resourceName;
|
||||
Common::SeekableReadStream *stream;
|
||||
|
||||
// Get the ART resource
|
||||
if (sceneFlag) {
|
||||
resourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".ART");
|
||||
} else {
|
||||
resourceName = "*" + Resources::formatResource(resName, resName);
|
||||
resourceName = Common::Path("*").appendInPlace(Resources::formatResource(resName, resName));
|
||||
}
|
||||
|
||||
// Load in the ART data
|
||||
@ -399,7 +399,7 @@ void SceneInfo::loadMadsV1Background(int sceneId, const Common::String &resName,
|
||||
}
|
||||
|
||||
void SceneInfo::loadMadsV2Background(int sceneId, const Common::String &resName, int flags, BaseSurface &bgSurface) {
|
||||
Common::String tileMapResourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".MM");
|
||||
Common::Path tileMapResourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".MM");
|
||||
File tileMapFile(tileMapResourceName);
|
||||
MadsPack tileMapPack(&tileMapFile);
|
||||
Common::SeekableReadStream *mapStream = tileMapPack.getItemStream(0);
|
||||
@ -430,7 +430,7 @@ void SceneInfo::loadMadsV2Background(int sceneId, const Common::String &resName,
|
||||
|
||||
// Tile data, which needs to be kept compressed, as the tile map offsets refer to
|
||||
// the compressed data. Each tile is then uncompressed separately
|
||||
Common::String tileDataResourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".TT");
|
||||
Common::Path tileDataResourceName = Resources::formatName(RESPREFIX_RM, sceneId, ".TT");
|
||||
File tileDataFile(tileDataResourceName);
|
||||
MadsPack tileDataPack(&tileDataFile);
|
||||
Common::SeekableReadStream *tileDataUncomp = tileDataPack.getItemStream(0);
|
||||
|
@ -386,7 +386,7 @@ int SpriteSets::add(SpriteAsset *asset, int idx) {
|
||||
}
|
||||
}
|
||||
|
||||
int SpriteSets::addSprites(const Common::String &resName, int flags) {
|
||||
int SpriteSets::addSprites(const Common::Path &resName, int flags) {
|
||||
return add(new SpriteAsset(_vm, resName, flags));
|
||||
}
|
||||
|
||||
|
@ -226,7 +226,7 @@ public:
|
||||
/**
|
||||
* Adds a sprite asset to the list by name
|
||||
*/
|
||||
int addSprites(const Common::String &resName, int flags = 0);
|
||||
int addSprites(const Common::Path &resName, int flags = 0);
|
||||
|
||||
/**
|
||||
* Remove an asset from the list
|
||||
|
@ -344,7 +344,7 @@ UserInterface::UserInterface(MADSEngine *vm) : _vm(vm), _dirtyAreas(vm),
|
||||
_surface.create(MADS_SCREEN_WIDTH, MADS_INTERFACE_HEIGHT);
|
||||
}
|
||||
|
||||
void UserInterface::load(const Common::String &resName) {
|
||||
void UserInterface::load(const Common::Path &resName) {
|
||||
File f(resName);
|
||||
MadsPack madsPack(&f);
|
||||
|
||||
@ -374,19 +374,21 @@ void UserInterface::setup(InputMode inputMode) {
|
||||
Scene &scene = _vm->_game->_scene;
|
||||
|
||||
if (_vm->_game->_screenObjects._inputMode != inputMode) {
|
||||
Common::String resName = _vm->_game->_aaName;
|
||||
Common::Path resName = _vm->_game->_aaName;
|
||||
|
||||
// Strip off any extension
|
||||
const char *p = strchr(resName.c_str(), '.');
|
||||
Common::String baseName(resName.baseName());
|
||||
const char *p = strchr(baseName.c_str(), '.');
|
||||
if (p) {
|
||||
resName = Common::String(resName.c_str(), p);
|
||||
baseName = Common::String(baseName.c_str(), p);
|
||||
resName = resName.getParent().appendComponent(baseName);
|
||||
}
|
||||
|
||||
// Add on suffix if necessary
|
||||
if (inputMode != kInputBuildingSentences)
|
||||
resName += "A";
|
||||
resName.appendInPlace("A");
|
||||
|
||||
resName += ".INT";
|
||||
resName.appendInPlace(".INT");
|
||||
|
||||
load(resName);
|
||||
blitFrom(_surface);
|
||||
@ -866,7 +868,7 @@ void UserInterface::loadInventoryAnim(int objectId) {
|
||||
|
||||
// WORKAROUND: Even in still mode, we now load the animation frames for the
|
||||
// object, so we can show the first frame as a 'still'
|
||||
Common::String resName = Common::String::format("*OB%.3dI", objectId);
|
||||
Common::Path resName(Common::String::format("*OB%.3dI", objectId));
|
||||
SpriteAsset *asset = new SpriteAsset(_vm, resName, ASSET_SPINNING_OBJECT);
|
||||
_invSpritesIndex = scene._sprites.add(asset, 1);
|
||||
if (_invSpritesIndex >= 0) {
|
||||
|
@ -220,7 +220,7 @@ public:
|
||||
/**
|
||||
* Loads an interface from a specified resource
|
||||
*/
|
||||
void load(const Common::String &resName) override;
|
||||
void load(const Common::Path &resName) override;
|
||||
|
||||
/**
|
||||
* Set up the interface
|
||||
|
Loading…
x
Reference in New Issue
Block a user