mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-06 10:17:14 +00:00
MUTATIONOFJB: Migrate engine to Path
This commit is contained in:
parent
c78ace6701
commit
c8d211090e
@ -26,19 +26,19 @@
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
AnimationDecoder::AnimationDecoder(const Common::String &fileName) : _fileName(fileName), _fromFrame(-1), _toFrame(-1), _threshold(0xFF) {
|
||||
AnimationDecoder::AnimationDecoder(const Common::Path &fileName) : _fileName(fileName), _fromFrame(-1), _toFrame(-1), _threshold(0xFF) {
|
||||
_surface.create(IMAGE_WIDTH, IMAGE_HEIGHT, Graphics::PixelFormat::createFormatCLUT8());
|
||||
_owningSurface = true;
|
||||
}
|
||||
|
||||
AnimationDecoder::AnimationDecoder(const Common::String &fileName, const Graphics::Surface &outSurface) : _fileName(fileName), _surface(outSurface), _owningSurface(false), _fromFrame(-1), _toFrame(-1), _threshold(0xFF) {}
|
||||
AnimationDecoder::AnimationDecoder(const Common::Path &fileName, const Graphics::Surface &outSurface) : _fileName(fileName), _surface(outSurface), _owningSurface(false), _fromFrame(-1), _toFrame(-1), _threshold(0xFF) {}
|
||||
|
||||
bool AnimationDecoder::decode(AnimationDecoderCallback *callback) {
|
||||
EncryptedFile file;
|
||||
file.open(_fileName);
|
||||
|
||||
if (!file.isOpen()) {
|
||||
reportFileMissingError(_fileName.c_str());
|
||||
reportFileMissingError(_fileName.toString(Common::Path::kNativeSeparator).c_str());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -23,8 +23,8 @@
|
||||
#define MUTATIONOFJB_ANIMATIONDECODER_H
|
||||
|
||||
#include "common/rect.h"
|
||||
#include "common/path.h"
|
||||
#include "common/scummsys.h"
|
||||
#include "common/str.h"
|
||||
|
||||
#include "graphics/surface.h"
|
||||
#include "mutationofjb/encryptedfile.h"
|
||||
@ -51,8 +51,8 @@ public:
|
||||
|
||||
class AnimationDecoder {
|
||||
public:
|
||||
AnimationDecoder(const Common::String &fileName);
|
||||
AnimationDecoder(const Common::String &fileName, const Graphics::Surface &outSurface);
|
||||
AnimationDecoder(const Common::Path &fileName);
|
||||
AnimationDecoder(const Common::Path &fileName, const Graphics::Surface &outSurface);
|
||||
~AnimationDecoder();
|
||||
bool decode(AnimationDecoderCallback *callback);
|
||||
|
||||
@ -71,7 +71,7 @@ private:
|
||||
void loadFullFrame(EncryptedFile &file, uint32 size);
|
||||
void loadDiffFrame(EncryptedFile &file, uint32 size);
|
||||
|
||||
Common::String _fileName;
|
||||
Common::Path _fileName;
|
||||
Graphics::Surface _surface;
|
||||
bool _owningSurface;
|
||||
byte _palette[PALETTE_SIZE];
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
ConversationLineList::ConversationLineList(const Common::String &fileName) {
|
||||
ConversationLineList::ConversationLineList(const Common::Path &fileName) {
|
||||
parseFile(fileName);
|
||||
}
|
||||
|
||||
@ -37,11 +37,11 @@ const ConversationLineList::Line *ConversationLineList::getLine(uint index) cons
|
||||
return &_lines[index - 1];
|
||||
}
|
||||
|
||||
bool ConversationLineList::parseFile(const Common::String &fileName) {
|
||||
bool ConversationLineList::parseFile(const Common::Path &fileName) {
|
||||
EncryptedFile file;
|
||||
file.open(fileName);
|
||||
if (!file.isOpen()) {
|
||||
reportFileMissingError(fileName.c_str());
|
||||
reportFileMissingError(fileName.toString(Common::Path::kNativeSeparator).c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -22,8 +22,9 @@
|
||||
#ifndef MUTATIONOFJB_CONVERSATIONLINELIST_H
|
||||
#define MUTATIONOFJB_CONVERSATIONLINELIST_H
|
||||
|
||||
#include "common/str.h"
|
||||
#include "common/array.h"
|
||||
#include "common/path.h"
|
||||
#include "common/str.h"
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
@ -50,11 +51,11 @@ public:
|
||||
Common::String _extra;
|
||||
};
|
||||
|
||||
ConversationLineList(const Common::String &fileName);
|
||||
ConversationLineList(const Common::Path &fileName);
|
||||
const Line *getLine(uint index) const;
|
||||
|
||||
private:
|
||||
bool parseFile(const Common::String &fileName);
|
||||
bool parseFile(const Common::Path &fileName);
|
||||
|
||||
Common::Array<Line> _lines;
|
||||
};
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
namespace MutationOfJB {
|
||||
|
||||
Font::Font(const Common::String &fileName, int horizSpacing, int lineHeight) :
|
||||
Font::Font(const Common::Path &fileName, int horizSpacing, int lineHeight) :
|
||||
_horizSpacing(horizSpacing),
|
||||
_lineHeight(lineHeight),
|
||||
_maxCharWidth(0) {
|
||||
@ -34,11 +34,11 @@ Font::Font(const Common::String &fileName, int horizSpacing, int lineHeight) :
|
||||
load(fileName);
|
||||
}
|
||||
|
||||
bool Font::load(const Common::String &fileName) {
|
||||
bool Font::load(const Common::Path &fileName) {
|
||||
EncryptedFile file;
|
||||
file.open(fileName);
|
||||
if (!file.isOpen()) {
|
||||
reportFileMissingError(fileName.c_str());
|
||||
reportFileMissingError(fileName.toString(Common::Path::kNativeSeparator).c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace MutationOfJB {
|
||||
class Font : public Graphics::Font {
|
||||
friend class FontBlitOperation;
|
||||
public:
|
||||
Font(const Common::String &fileName, int horizSpacing, int lineHeight);
|
||||
Font(const Common::Path &fileName, int horizSpacing, int lineHeight);
|
||||
|
||||
int getFontHeight() const override;
|
||||
int getMaxCharWidth() const override;
|
||||
@ -49,7 +49,7 @@ protected:
|
||||
virtual uint8 transformColor(uint8 baseColor, uint8 glyphColor) const;
|
||||
|
||||
private:
|
||||
bool load(const Common::String &fileName);
|
||||
bool load(const Common::Path &fileName);
|
||||
|
||||
int _horizSpacing;
|
||||
int _lineHeight;
|
||||
|
@ -117,10 +117,10 @@ Script *Game::changeSceneLoadScript(uint8 sceneId, bool partB) {
|
||||
_gui.refreshAfterSceneChanged();
|
||||
|
||||
EncryptedFile scriptFile;
|
||||
Common::String fileName = Common::String::format("scrn%d%s.atn", sceneId, partB ? "b" : "");
|
||||
Common::Path fileName(Common::String::format("scrn%d%s.atn", sceneId, partB ? "b" : ""));
|
||||
scriptFile.open(fileName);
|
||||
if (!scriptFile.isOpen()) {
|
||||
reportFileMissingError(fileName.c_str());
|
||||
reportFileMissingError(fileName.toString(Common::Path::kNativeSeparator).c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ MutationOfJBEngine::MutationOfJBEngine(OSystem *syst, const ADGameDescription *g
|
||||
_cursorState(CURSOR_IDLE),
|
||||
_currentScreen(nullptr) {
|
||||
|
||||
const Common::FSNode gameDataDir(ConfMan.get("path"));
|
||||
const Common::FSNode gameDataDir(ConfMan.getPath("path"));
|
||||
SearchMan.addSubDirectoryMatching(gameDataDir, "data");
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ bool Room::load(uint8 roomNumber, bool roomB) {
|
||||
}
|
||||
}
|
||||
|
||||
const Common::String fileName = Common::String::format("room%d%s.dat", roomNumber, roomB ? "b" : "");
|
||||
const Common::Path fileName(Common::String::format("room%d%s.dat", roomNumber, roomB ? "b" : ""));
|
||||
AnimationDecoder decoder(fileName);
|
||||
RoomAnimationDecoderCallback callback(*this);
|
||||
return decoder.decode(&callback);
|
||||
@ -188,7 +188,7 @@ void Room::drawFrames(int fromFrame, int toFrame, const Common::Rect &area, uint
|
||||
return;
|
||||
}
|
||||
|
||||
const Common::String fileName = Common::String::format("room%d%s.dat", gameData._currentScene, gameData._partB ? "b" : "");
|
||||
const Common::Path fileName(Common::String::format("room%d%s.dat", gameData._currentScene, gameData._partB ? "b" : ""));
|
||||
|
||||
{
|
||||
AnimationDecoder decoder(fileName, *_screen);
|
||||
|
Loading…
x
Reference in New Issue
Block a user