[Scummvm-git-logs] scummvm master -> 56e0ab502d35a5fcc7cb69e751109a92676cd4e7
sev-
noreply at scummvm.org
Fri Aug 23 12:06:55 UTC 2024
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
cce0acbbfc QDENGINE: Remove get_file_list and friends
05f4813ea1 QDENGINE: Moved engine to Common::Path
56e0ab502d QDENGINE: Further fixes and simplifications related to Common::Path
Commit: cce0acbbfce18bbdbfe43516f5b24e3210738540
https://github.com/scummvm/scummvm/commit/cce0acbbfce18bbdbfe43516f5b24e3210738540
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T14:06:38+02:00
Commit Message:
QDENGINE: Remove get_file_list and friends
Used for qdEditor for creating resource packs
Changed paths:
engines/qdengine/qd_fwd.h
engines/qdengine/qdcore/qd_file_owner.h
engines/qdengine/qdcore/qd_game_dispatcher.cpp
engines/qdengine/qdcore/qd_game_dispatcher.h
engines/qdengine/qdcore/qd_game_scene.cpp
engines/qdengine/qdcore/qd_game_scene.h
engines/qdengine/qdcore/qd_interface_dispatcher.cpp
engines/qdengine/qdcore/qd_interface_dispatcher.h
engines/qdengine/qdcore/qd_minigame.cpp
engines/qdengine/qdcore/qd_minigame.h
engines/qdengine/qdcore/qd_resource_container.h
engines/qdengine/qdcore/qd_video.cpp
engines/qdengine/qdcore/qd_video.h
diff --git a/engines/qdengine/qd_fwd.h b/engines/qdengine/qd_fwd.h
index ec8aa64aaf5..19c552f2283 100644
--- a/engines/qdengine/qd_fwd.h
+++ b/engines/qdengine/qd_fwd.h
@@ -93,8 +93,6 @@ class qdInterfaceButton;
class qdGameDispatcher;
-typedef Std::list<Common::String> qdFileNameList;
-
class qdFontInfo;
typedef Std::list<qdFontInfo *> qdFontInfoList;
diff --git a/engines/qdengine/qdcore/qd_file_owner.h b/engines/qdengine/qdcore/qd_file_owner.h
index 452d5a5dcbd..13a083ec5ea 100644
--- a/engines/qdengine/qdcore/qd_file_owner.h
+++ b/engines/qdengine/qdcore/qd_file_owner.h
@@ -29,8 +29,6 @@ public:
qdFileOwner() : _cd_info(0) { }
virtual ~qdFileOwner() {}
- virtual bool get_files_list(qdFileNameList &files_to_copy, qdFileNameList &files_to_pack) const = 0;
-
void add_to_CD(int cd_number) {
_cd_info |= 1 << cd_number;
}
diff --git a/engines/qdengine/qdcore/qd_game_dispatcher.cpp b/engines/qdengine/qdcore/qd_game_dispatcher.cpp
index 9b80e0309ca..a7dbeffefa7 100644
--- a/engines/qdengine/qdcore/qd_game_dispatcher.cpp
+++ b/engines/qdengine/qdcore/qd_game_dispatcher.cpp
@@ -2954,39 +2954,6 @@ static Common::String change_ext(const char *file_name, const char *new_ext) {
return fpath;
}
-bool qdGameDispatcher::get_files_list(qdFileNameList &files_to_copy, qdFileNameList &files_to_pack) const {
- files_to_pack.push_back("Resource/Cursors/default.tga");
- files_to_pack.push_back("Resource/Fonts/font00.idx");
- files_to_pack.push_back("Resource/Fonts/font00.tga");
-
- if (!_texts_database.empty())
- files_to_pack.push_back(texts_database());
-
- for (qdMiniGameList::const_iterator it = minigame_list().begin(); it != minigame_list().end(); ++it)
- (*it)->get_files_list(files_to_copy, files_to_pack);
-
- for (qdSoundList::const_iterator it = sound_list().begin(); it != sound_list().end(); ++it)
- files_to_pack.push_back((*it)->file_name());
-
- for (qdAnimationList::const_iterator it = animation_list().begin(); it != animation_list().end(); ++it)
- files_to_pack.push_back((*it)->qda_file());
-
- for (qdInventoryCellTypeVector::const_iterator it = inventory_cell_types().begin(); it != inventory_cell_types().end(); ++it)
- files_to_pack.push_back(it->sprite_file());
-
- _interface_dispatcher.get_file_list(files_to_copy, files_to_pack);
-
- for (auto &it : fonts_list()) {
- files_to_pack.push_back(it->font_file_name()); // tga
- files_to_pack.push_back(change_ext(it->font_file_name(), ".idx").c_str());
- }
-
- if (_hall_of_fame_size)
- files_to_copy.push_back("Resource/hof.dat");
-
- return true;
-}
-
bool qdGameDispatcher::start_intro_videos() {
for (auto &it : video_list()) {
if (it->is_intro_movie()) {
diff --git a/engines/qdengine/qdcore/qd_game_dispatcher.h b/engines/qdengine/qdcore/qd_game_dispatcher.h
index ffa2260d3f1..7acc6212dae 100644
--- a/engines/qdengine/qdcore/qd_game_dispatcher.h
+++ b/engines/qdengine/qdcore/qd_game_dispatcher.h
@@ -478,12 +478,6 @@ public:
bool game_screenshot(Graphics::Surface &thumb) const;
- /**
- СобиÑÐ°ÐµÑ Ð²Ñе ÑÐ°Ð¹Ð»Ñ Ð½Ð°Ñ
одÑÑиеÑÑ ÐРвнÑÑÑи ÑабоÑей диÑÑекÑоÑии в collect_dir,
- иÑпÑавлÑÑ Ð¿ÑÑи Ñайлов в ÑооÑвеÑÑÑвÑÑÑиÑ
им обÑекÑаÑ
- */
- bool get_files_list(qdFileNameList &files_to_copy, qdFileNameList &files_to_pack) const;
-
void set_game_title(const char *p) {
_game_title = p;
}
diff --git a/engines/qdengine/qdcore/qd_game_scene.cpp b/engines/qdengine/qdcore/qd_game_scene.cpp
index 415fd58cabc..e609a05a20e 100644
--- a/engines/qdengine/qdcore/qd_game_scene.cpp
+++ b/engines/qdengine/qdcore/qd_game_scene.cpp
@@ -1622,28 +1622,6 @@ bool qdGameScene::set_personage_button(qdInterfaceButton *p) {
return ret;
}
-bool qdGameScene::get_files_list(qdFileNameList &files_to_copy, qdFileNameList &files_to_pack) const {
- for (qdMusicTrackList::const_iterator it = music_track_list().begin(); it != music_track_list().end(); ++it)
- files_to_copy.push_back((*it)->file_name());
-
- for (qdSoundList::const_iterator it = sound_list().begin(); it != sound_list().end(); ++it)
- files_to_pack.push_back((*it)->file_name());
-
- for (qdAnimationList::const_iterator it = animation_list().begin(); it != animation_list().end(); ++it)
- files_to_pack.push_back((*it)->qda_file());
-
- for (qdGameObjectList::const_iterator it = object_list().begin(); it != object_list().end(); ++it) {
- if ((*it)->named_object_type() == QD_NAMED_OBJECT_STATIC_OBJ) {
- qdGameObjectStatic *obj = static_cast<qdGameObjectStatic *>(*it);
- if (obj->get_sprite()->file())
- files_to_pack.push_back(obj->get_sprite()->file());
- }
- }
-
- return true;
-}
-
-
void qdGameScene::personages_quant() {
for (personages_container_t::const_iterator it = _personages.begin(); it != _personages.end(); ++it) {
if ((*it)->button()) {
diff --git a/engines/qdengine/qdcore/qd_game_scene.h b/engines/qdengine/qdcore/qd_game_scene.h
index ce44f445b15..6fc9030ae9c 100644
--- a/engines/qdengine/qdcore/qd_game_scene.h
+++ b/engines/qdengine/qdcore/qd_game_scene.h
@@ -235,8 +235,6 @@ public:
_interface_screen_name = name;
}
- bool get_files_list(qdFileNameList &files_to_copy, qdFileNameList &files_to_pack) const;
-
qdGameObject *get_hitted_obj(int x, int y);
bool set_camera_mode(const qdCameraMode &mode, qdGameObjectAnimated *object);
diff --git a/engines/qdengine/qdcore/qd_interface_dispatcher.cpp b/engines/qdengine/qdcore/qd_interface_dispatcher.cpp
index 3ca38995cc2..3ae5a9e9932 100644
--- a/engines/qdengine/qdcore/qd_interface_dispatcher.cpp
+++ b/engines/qdengine/qdcore/qd_interface_dispatcher.cpp
@@ -637,17 +637,6 @@ bool qdInterfaceDispatcher::handle_event(int event_code, const char *event_data,
return false;
}
-bool qdInterfaceDispatcher::get_file_list(qdFileNameList &files_to_copy, qdFileNameList &files_to_pack) const {
- for (screen_list_t::const_iterator it = screen_list().begin(); it != screen_list().end(); ++it) {
- if ((*it)->has_music_track())
- files_to_copy.push_back((*it)->music_track().file_name());
- }
-
- _resources.get_file_list(files_to_pack);
-
- return true;
-}
-
int qdInterfaceDispatcher::option_value(int option_id, const char *option_data) {
switch (option_id) {
case qdInterfaceElement::OPTION_SOUND:
diff --git a/engines/qdengine/qdcore/qd_interface_dispatcher.h b/engines/qdengine/qdcore/qd_interface_dispatcher.h
index 8e748b6849a..3dafd2e1911 100644
--- a/engines/qdengine/qdcore/qd_interface_dispatcher.h
+++ b/engines/qdengine/qdcore/qd_interface_dispatcher.h
@@ -249,9 +249,6 @@ public:
*/
bool handle_event(int event_code, const char *event_data, qdInterfaceObjectBase *sender = NULL);
- //! ÐиÑÐµÑ ÑпиÑок вÑеÑ
Ñайлов ÑеÑÑÑÑов в list.
- bool get_file_list(qdFileNameList &files_to_copy, qdFileNameList &files_to_pack) const;
-
void toggle_end_game_mode(bool state) {
_end_game_mode = state;
}
diff --git a/engines/qdengine/qdcore/qd_minigame.cpp b/engines/qdengine/qdcore/qd_minigame.cpp
index 28f75c89837..a62afe96b0d 100644
--- a/engines/qdengine/qdcore/qd_minigame.cpp
+++ b/engines/qdengine/qdcore/qd_minigame.cpp
@@ -243,21 +243,6 @@ bool qdMiniGame::load_config() {
return true;
}
-bool qdMiniGame::get_files_list(qdFileNameList &files_to_copy, qdFileNameList &files_to_pack) const {
- if (has_dll())
- files_to_copy.push_back(dll_name());
-
- if (has_config_file())
- files_to_copy.push_back(config_file_name());
-
- for (config_container_t::const_iterator it = _config.begin(); it != _config.end(); ++it) {
- if (it->data_type() == qdMinigameConfigParameter::PRM_DATA_FILE)
- files_to_copy.push_back(it->data_string());
- }
-
- return true;
-}
-
const char *qdMiniGame::config_parameter_value(const char *cfg_param_name) const {
config_container_t::const_iterator it = Common::find(_config.begin(), _config.end(), cfg_param_name);
if (it != _config.end())
diff --git a/engines/qdengine/qdcore/qd_minigame.h b/engines/qdengine/qdcore/qd_minigame.h
index c6e9d260442..7bcf73e8368 100644
--- a/engines/qdengine/qdcore/qd_minigame.h
+++ b/engines/qdengine/qdcore/qd_minigame.h
@@ -94,9 +94,6 @@ public:
//! ÐапиÑÑ Ð´Ð°Ð½Ð½ÑÑ
в ÑкÑипÑ.
bool save_script(Common::WriteStream &fh, int indent = 0) const;
- //! ÐобавлÑÐµÑ Ð² пеÑедаваемÑе ÑпиÑки имена Ñайлов, необÑ
одимÑÑ
Ð´Ð»Ñ Ð¼Ð¸Ð½Ð¸Ð¸Ð³ÑÑ.
- bool get_files_list(qdFileNameList &files_to_copy, qdFileNameList &files_to_pack) const;
-
typedef Std::vector<qdMinigameConfigParameter> config_container_t;
const config_container_t &config() const {
diff --git a/engines/qdengine/qdcore/qd_resource_container.h b/engines/qdengine/qdcore/qd_resource_container.h
index d21f573dae4..a5ff6ae447c 100644
--- a/engines/qdengine/qdcore/qd_resource_container.h
+++ b/engines/qdengine/qdcore/qd_resource_container.h
@@ -64,8 +64,6 @@ public:
}
//! ÐозвÑаÑÐ°ÐµÑ Ð²ÑеÑ
владелÑÑев ÑеÑÑÑÑов
void get_owners(Std::list<T *> &owners);
- //! ÐиÑÐµÑ ÑпиÑок вÑеÑ
Ñайлов в list.
- bool get_file_list(qdFileNameList &list) const;
private:
@@ -175,15 +173,6 @@ void qdResourceContainer<T>::get_owners(Std::list<T *> &owners) {
}
}
-template<class T>
-bool qdResourceContainer<T>::get_file_list(qdFileNameList &list) const {
- for (resource_list_t::const_iterator it = _resource_list.begin(); it != _resource_list.end(); ++it) {
- if ((*it)->resource_file())
- list.push_back((*it)->resource_file());
- }
- return true;
-}
-
} // namespace QDEngine
#endif // QDENGINE_QDCORE_QD_RESOURCE_CONTAINER_H
diff --git a/engines/qdengine/qdcore/qd_video.cpp b/engines/qdengine/qdcore/qd_video.cpp
index db89254cb32..fafbf5d53f0 100644
--- a/engines/qdengine/qdcore/qd_video.cpp
+++ b/engines/qdengine/qdcore/qd_video.cpp
@@ -172,13 +172,4 @@ qdConditionalObject::trigger_start_mode qdVideo::trigger_start() {
return qdConditionalObject::TRIGGER_START_ACTIVATE;
}
-bool qdVideo::get_files_list(qdFileNameList &files_to_copy, qdFileNameList &files_to_pack) const {
- if (!_file_name.empty())
- files_to_copy.push_back(_file_name);
-
- if (background_file_name())
- files_to_pack.push_back(background_file_name());
-
- return true;
-}
} // namespace QDEngine
diff --git a/engines/qdengine/qdcore/qd_video.h b/engines/qdengine/qdcore/qd_video.h
index 1d2d8d80cbf..752990ddd7a 100644
--- a/engines/qdengine/qdcore/qd_video.h
+++ b/engines/qdengine/qdcore/qd_video.h
@@ -84,8 +84,6 @@ public:
qdConditionalObject::trigger_start_mode trigger_start();
- bool get_files_list(qdFileNameList &files_to_copy, qdFileNameList &files_to_pack) const;
-
bool is_intro_movie() const {
return check_flag(VID_INTRO_MOVIE);
}
Commit: 05f4813ea1c494742e1025ec06c57e6293b477ce
https://github.com/scummvm/scummvm/commit/05f4813ea1c494742e1025ec06c57e6293b477ce
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T14:06:38+02:00
Commit Message:
QDENGINE: Moved engine to Common::Path
Changed paths:
engines/qdengine/parser/qdscr_parser.cpp
engines/qdengine/parser/qdscr_parser.h
engines/qdengine/qdcore/qd_animation.cpp
engines/qdengine/qdcore/qd_animation.h
engines/qdengine/qdcore/qd_file_manager.cpp
engines/qdengine/qdcore/qd_file_manager.h
engines/qdengine/qdcore/qd_game_dispatcher.cpp
engines/qdengine/qdcore/qd_game_dispatcher.h
engines/qdengine/qdcore/qd_game_object_static.cpp
engines/qdengine/qdcore/qd_interface_background.h
engines/qdengine/qdcore/qd_interface_dispatcher.cpp
engines/qdengine/qdcore/qd_interface_dispatcher.h
engines/qdengine/qdcore/qd_interface_element.cpp
engines/qdengine/qdcore/qd_interface_element.h
engines/qdengine/qdcore/qd_interface_element_state.cpp
engines/qdengine/qdcore/qd_interface_element_state.h
engines/qdengine/qdcore/qd_interface_element_state_mode.cpp
engines/qdengine/qdcore/qd_interface_element_state_mode.h
engines/qdengine/qdcore/qd_interface_save.cpp
engines/qdengine/qdcore/qd_interface_save.h
engines/qdengine/qdcore/qd_interface_screen.cpp
engines/qdengine/qdcore/qd_interface_screen.h
engines/qdengine/qdcore/qd_interface_text_window.cpp
engines/qdengine/qdcore/qd_interface_text_window.h
engines/qdengine/qdcore/qd_inventory_cell.cpp
engines/qdengine/qdcore/qd_inventory_cell.h
engines/qdengine/qdcore/qd_resource.cpp
engines/qdengine/qdcore/qd_resource.h
engines/qdengine/qdcore/qd_resource_container.h
engines/qdengine/qdcore/qd_sound.cpp
engines/qdengine/qdcore/qd_sound.h
engines/qdengine/qdcore/qd_sprite.cpp
engines/qdengine/qdcore/qd_sprite.h
engines/qdengine/qdcore/qd_video.cpp
engines/qdengine/qdcore/qd_video.h
engines/qdengine/qdcore/util/WinVideo.cpp
engines/qdengine/qdcore/util/WinVideo.h
engines/qdengine/qdcore/util/plaympp_api.cpp
engines/qdengine/qdcore/util/plaympp_api.h
engines/qdengine/system/sound/snd_sound.cpp
engines/qdengine/system/sound/wav_sound.cpp
engines/qdengine/system/sound/wav_sound.h
diff --git a/engines/qdengine/parser/qdscr_parser.cpp b/engines/qdengine/parser/qdscr_parser.cpp
index d0bc0bf2b8d..09165e9604b 100644
--- a/engines/qdengine/parser/qdscr_parser.cpp
+++ b/engines/qdengine/parser/qdscr_parser.cpp
@@ -380,4 +380,9 @@ const char *qdscr_XML_string(const char *p) {
return (const char *)transCyrillic(conv_str.c_str());
}
+const char *qdscr_XML_string(const Common::String s) {
+ return qdscr_XML_string(s.c_str());
+}
+
+
} // namespace QDEngine
diff --git a/engines/qdengine/parser/qdscr_parser.h b/engines/qdengine/parser/qdscr_parser.h
index d148df57d70..5120bdf40e6 100644
--- a/engines/qdengine/parser/qdscr_parser.h
+++ b/engines/qdengine/parser/qdscr_parser.h
@@ -708,6 +708,7 @@ const int idTagVersionAll[490] = {
void cleanup_XML_Parser();
xml::parser &qdscr_XML_Parser();
const char *qdscr_XML_string(const char *p);
+const char *qdscr_XML_string(const Common::String s);
} // namespace QDEngine
diff --git a/engines/qdengine/qdcore/qd_animation.cpp b/engines/qdengine/qdcore/qd_animation.cpp
index 828bb083992..f9370b05294 100644
--- a/engines/qdengine/qdcore/qd_animation.cpp
+++ b/engines/qdengine/qdcore/qd_animation.cpp
@@ -396,7 +396,7 @@ void qdAnimation::load_script(const xml::tag *p) {
set_name(it->data());
break;
case QDSCR_ANIMATION_FILE:
- qda_set_file(Common::Path(it->data(), '\\').toString().c_str());
+ qda_set_file(Common::Path(it->data(), '\\'));
break;
case QDSCR_FLAG:
set_flag(xml::tag_buffer(*it).get_int());
@@ -425,8 +425,8 @@ bool qdAnimation::save_script(Common::WriteStream &fh, int indent) const {
fh.writeString(Common::String::format(" flags=\"%d\"", flags()));
}
- if (qda_file()) {
- fh.writeString(Common::String::format(" animation_file=\"%s\"", qdscr_XML_string(qda_file())));
+ if (!qda_file().empty()) {
+ fh.writeString(Common::String::format(" animation_file=\"%s\"", qdscr_XML_string(qda_file().toString('\\'))));
}
fh.writeString("/>\r\n");
@@ -434,10 +434,10 @@ bool qdAnimation::save_script(Common::WriteStream &fh, int indent) const {
}
bool qdAnimation::load_resources() {
- debugC(3, kDebugLoad, "qdAnimation::load_resources(): '%s' name: %s", transCyrillic(qda_file()), transCyrillic(name()));
+ debugC(3, kDebugLoad, "qdAnimation::load_resources(): '%s' name: %s", transCyrillic(qda_file().toString()), transCyrillic(name()));
if (check_flag(QD_ANIMATION_FLAG_REFERENCE)) return false;
- if (!qda_file()) {
+ if (qda_file().empty()) {
qdAnimationFrameList::iterator iaf;
for (iaf = _frames.begin(); iaf != _frames.end(); ++iaf) {
(*iaf)->load_resources();
@@ -531,12 +531,11 @@ bool qdAnimation::hit(int x, int y, float scale) const {
return false;
}
-bool qdAnimation::qda_load(const char *fname) {
+bool qdAnimation::qda_load(Common::Path fpath) {
clear_frames();
- debugC(3, kDebugLoad, "qdAnimation::qda_load(%s)", transCyrillic(fname));
+ debugC(3, kDebugLoad, "qdAnimation::qda_load(%s)", transCyrillic(fpath.toString()));
- Common::Path fpath(fname, '\\');
Common::SeekableReadStream *fh;
if (!qdFileManager::instance().open_file(&fh, fpath.toString().c_str())) {
return false;
@@ -599,7 +598,7 @@ bool qdAnimation::qda_load(const char *fname) {
add_frame(p);
}
- debugC(1, kDebugLoad, "qdAnimation::qda_load() tileAnimation %s", transCyrillic(fname));
+ debugC(1, kDebugLoad, "qdAnimation::qda_load() tileAnimation %s", transCyrillic(fpath.toString()));
_tileAnimation = new grTileAnimation;
_tileAnimation->load(fh);
}
@@ -609,11 +608,8 @@ bool qdAnimation::qda_load(const char *fname) {
return true;
}
-void qdAnimation::qda_set_file(const char *fname) {
- if (fname)
- _qda_file = fname;
- else
- _qda_file.clear();
+void qdAnimation::qda_set_file(Common::Path fname) {
+ _qda_file = fname;
}
bool qdAnimation::crop() {
diff --git a/engines/qdengine/qdcore/qd_animation.h b/engines/qdengine/qdcore/qd_animation.h
index 56f0b7d5cd7..ccdfe1ba385 100644
--- a/engines/qdengine/qdcore/qd_animation.h
+++ b/engines/qdengine/qdcore/qd_animation.h
@@ -173,13 +173,12 @@ public:
void load_script(const xml::tag *p);
bool save_script(Common::WriteStream &fh, int indent = 0) const;
- const char *qda_file() const {
- if (!_qda_file.empty()) return _qda_file.c_str();
- return 0;
+ const Common::Path qda_file() const {
+ return _qda_file;
}
- void qda_set_file(const char *fname);
+ void qda_set_file(const Common::Path fname);
- bool qda_load(const char *fname);
+ bool qda_load(const Common::Path fname);
bool load_resources();
void free_resources();
@@ -231,12 +230,12 @@ public:
bool load_resource();
bool free_resource();
//! УÑÑÐ°Ð½Ð°Ð²Ð»Ð¸Ð²Ð°ÐµÑ Ð¸Ð¼Ñ Ñайла, в коÑоÑом Ñ
ÑанÑÑÑÑ Ð´Ð°Ð½Ð½Ñе ÑеÑÑÑÑа.
- void set_resource_file(const char *file_name) {
+ void set_resource_file(const Common::Path file_name) {
qda_set_file(file_name);
}
//! ÐозвÑаÑÐ°ÐµÑ Ð¸Ð¼Ñ Ñайла, в коÑоÑом Ñ
ÑаниÑÑÑ Ð°Ð½Ð¸Ð¼Ð°ÑиÑ.
- const char *resource_file() const {
- if (!qda_file()) {
+ const Common::Path resource_file() const {
+ if (qda_file().empty()) {
if (!check_flag(QD_ANIMATION_FLAG_REFERENCE) && !_frames.empty()) {
if (_frames.front()->has_file())
return _frames.front()->file();
@@ -294,7 +293,7 @@ private:
int _status;
bool _is_finished;
- Common::String _qda_file;
+ Common::Path _qda_file;
const qdAnimation *_parent;
diff --git a/engines/qdengine/qdcore/qd_file_manager.cpp b/engines/qdengine/qdcore/qd_file_manager.cpp
index d4f170f29a2..8e871b60bc5 100644
--- a/engines/qdengine/qdcore/qd_file_manager.cpp
+++ b/engines/qdengine/qdcore/qd_file_manager.cpp
@@ -100,13 +100,13 @@ void qdFileManager::Finit() {
delete mgr;
}
-bool qdFileManager::open_file(Common::SeekableReadStream **fh, const char *file_name, bool err_message) {
- debugC(4, kDebugLoad, "qdFileManager::open_file(%s)", transCyrillic(file_name));
+bool qdFileManager::open_file(Common::SeekableReadStream **fh, const Common::Path file_name, bool err_message) {
+ debugC(4, kDebugLoad, "qdFileManager::open_file(%s)", transCyrillic(file_name.toString()));
- if (SearchMan.hasFile(Common::Path(file_name))) {
+ if (SearchMan.hasFile(file_name)) {
Common::File *f = new Common::File;
- if (f->open(Common::Path(file_name)))
+ if (f->open(file_name))
*fh = f;
else
return false;
@@ -122,20 +122,20 @@ bool qdFileManager::open_file(Common::SeekableReadStream **fh, const char *file_
continue;
if (_packages[i]._container->hasFile(file_name)) {
- debugC(5, kDebugLoad, "qdFileManager::open_file(%s): found in %s", transCyrillic(file_name), _packages[i].file_name());
+ debugC(5, kDebugLoad, "qdFileManager::open_file(%s): found in %s", transCyrillic(file_name.toString()), _packages[i].file_name());
*fh = _packages[i]._container->createReadStreamForMember(file_name);
if (*fh)
return true;
- debugC(4, kDebugLoad, "qdFileManager::open_file(%s): Cannot read file", transCyrillic(file_name));
+ debugC(4, kDebugLoad, "qdFileManager::open_file(%s): Cannot read file", transCyrillic(file_name.toString()));
return false;
}
}
- debugC(4, kDebugLoad, "qdFileManager::open_file(%s): NOT FOUND", transCyrillic(file_name));
+ debugC(4, kDebugLoad, "qdFileManager::open_file(%s): NOT FOUND", transCyrillic(file_name.toString()));
return false;
}
diff --git a/engines/qdengine/qdcore/qd_file_manager.h b/engines/qdengine/qdcore/qd_file_manager.h
index 51167130976..fef7229b66c 100644
--- a/engines/qdengine/qdcore/qd_file_manager.h
+++ b/engines/qdengine/qdcore/qd_file_manager.h
@@ -70,7 +70,7 @@ public:
void enable_packages() {}
- bool open_file(Common::SeekableReadStream **fh, const char *file_name, bool err_message = true);
+ bool open_file(Common::SeekableReadStream **fh, const Common::Path file_name, bool err_message = true);
int last_CD_id() const {
return 1;
@@ -90,8 +90,6 @@ public:
}
bool is_package_available(const qdFileOwner &file_owner);
- const char *CD_path(const qdFileOwner &file_owner) const { return ""; }
-
bool scan_drives(const qdFileOwner *file_owner = NULL) { return true; }
bool scan_drives(int cd_id) { return true; }
void update_packages() {}
diff --git a/engines/qdengine/qdcore/qd_game_dispatcher.cpp b/engines/qdengine/qdcore/qd_game_dispatcher.cpp
index a7dbeffefa7..5bb60d48d3c 100644
--- a/engines/qdengine/qdcore/qd_game_dispatcher.cpp
+++ b/engines/qdengine/qdcore/qd_game_dispatcher.cpp
@@ -1898,7 +1898,7 @@ bool qdGameDispatcher::play_video(const char *vid_name) {
}
bool qdGameDispatcher::play_video(qdVideo *p) {
- if (!_video_player.open_file(find_file(p->file_name(), *p).c_str()))
+ if (!_video_player.open_file(find_file(p->file_name(), *p)))
return false;
if (!p->check_flag(qdVideo::VID_ENABLE_MUSIC)) {
@@ -2656,7 +2656,7 @@ bool qdGameDispatcher::play_music_track(const qdMusicTrack *p, bool interface_mo
_cur_interface_music_track = p;
}
- Common::String fname;
+ Common::Path fname;
if (_cur_scene)
fname = find_file(p->file_name(), *_cur_scene);
@@ -2665,9 +2665,9 @@ bool qdGameDispatcher::play_music_track(const qdMusicTrack *p, bool interface_mo
_interface_music_mode = interface_mode;
- debugC(3, kDebugLoad, "qdGameDispatcher::play_music_track() %s", transCyrillic(fname));
+ debugC(3, kDebugLoad, "qdGameDispatcher::play_music_track() %s", transCyrillic(fname.toString()));
- return mpegPlayer::instance().play(fname.c_str(), p->is_cycled(), p->volume());
+ return mpegPlayer::instance().play(fname, p->is_cycled(), p->volume());
}
bool qdGameDispatcher::stop_music() {
@@ -2986,15 +2986,8 @@ void qdGameDispatcher::request_file_package(const qdFileOwner &file_owner) const
error("Requested file package is not avaliable");
}
-Common::String qdGameDispatcher::find_file(const char *file_name, const qdFileOwner &file_owner) const {
- debugC(4, kDebugLoad, "qdGameDispatcher::find_file(%s)", file_name);
-
- if (_enable_file_packages && !SearchMan.hasFile(Common::Path(file_name))) {
- Common::String fname;
- fname += qdFileManager::instance().CD_path(file_owner);
- fname += file_name;
- return fname;
- }
+Common::Path qdGameDispatcher::find_file(const Common::Path file_name, const qdFileOwner &file_owner) const {
+ debugC(4, kDebugLoad, "qdGameDispatcher::find_file(%s)", file_name.toString().c_str());
return file_name;
}
diff --git a/engines/qdengine/qdcore/qd_game_dispatcher.h b/engines/qdengine/qdcore/qd_game_dispatcher.h
index 7acc6212dae..1cb828f7249 100644
--- a/engines/qdengine/qdcore/qd_game_dispatcher.h
+++ b/engines/qdengine/qdcore/qd_game_dispatcher.h
@@ -94,7 +94,7 @@ public:
}
void request_file_package(const qdFileOwner &file_owner) const;
- Common::String find_file(const char *file_name, const qdFileOwner &file_owner) const;
+ Common::Path find_file(const Common::Path file_name, const qdFileOwner &file_owner) const;
void startup_check() const;
qdLoadingProgressFnc set_scene_loading_progress_callback(qdLoadingProgressFnc p, void *dp = 0) {
diff --git a/engines/qdengine/qdcore/qd_game_object_static.cpp b/engines/qdengine/qdcore/qd_game_object_static.cpp
index d3bd97e0850..c2f6e62fd0d 100644
--- a/engines/qdengine/qdcore/qd_game_object_static.cpp
+++ b/engines/qdengine/qdcore/qd_game_object_static.cpp
@@ -80,8 +80,8 @@ bool qdGameObjectStatic::save_script_body(Common::WriteStream &fh, int indent) c
fh.writeString("\t");
}
- if (_sprite.file()) {
- fh.writeString(Common::String::format("<file>%s</file>\r\n", qdscr_XML_string(_sprite.file())));
+ if (!_sprite.file().empty()) {
+ fh.writeString(Common::String::format("<file>%s</file>\r\n", qdscr_XML_string(_sprite.file().toString('\\'))));
}
return true;
diff --git a/engines/qdengine/qdcore/qd_interface_background.h b/engines/qdengine/qdcore/qd_interface_background.h
index 2ab68346ebf..fa3f905cadd 100644
--- a/engines/qdengine/qdcore/qd_interface_background.h
+++ b/engines/qdengine/qdcore/qd_interface_background.h
@@ -58,11 +58,11 @@ public:
/**
ÐÑли надо ÑбÑаÑÑ Ð°Ð½Ð¸Ð¼Ð°ÑÐ¸Ñ - пеÑедаÑÑ NULL в каÑеÑÑве имени Ñайла.
*/
- void set_animation_file(const char *name) {
+ void set_animation_file(const Common::Path name) {
_state.set_animation_file(name);
}
//! ÐозвÑаÑÐ°ÐµÑ Ð¸Ð¼Ñ Ñайла Ð´Ð»Ñ Ð°Ð½Ð¸Ð¼Ð°Ñии.
- const char *animation_file() const {
+ const Common::Path animation_file() const {
return _state.animation_file();
}
//! ÐозвÑаÑÐ°ÐµÑ Ñлаги анимаÑии.
diff --git a/engines/qdengine/qdcore/qd_interface_dispatcher.cpp b/engines/qdengine/qdcore/qd_interface_dispatcher.cpp
index 3ae5a9e9932..e3efb49c7f9 100644
--- a/engines/qdengine/qdcore/qd_interface_dispatcher.cpp
+++ b/engines/qdengine/qdcore/qd_interface_dispatcher.cpp
@@ -183,11 +183,11 @@ bool qdInterfaceDispatcher::select_ingame_screen(bool inventory_state) {
return select_screen(NULL);
}
-qdResource *qdInterfaceDispatcher::add_resource(const char *file_name, const qdInterfaceElementState *owner) {
+qdResource *qdInterfaceDispatcher::add_resource(const Common::Path file_name, const qdInterfaceElementState *owner) {
return _resources.add_resource(file_name, owner);
}
-bool qdInterfaceDispatcher::remove_resource(const char *file_name, const qdInterfaceElementState *owner) {
+bool qdInterfaceDispatcher::remove_resource(const Common::Path file_name, const qdInterfaceElementState *owner) {
return _resources.remove_resource(file_name, owner);
}
diff --git a/engines/qdengine/qdcore/qd_interface_dispatcher.h b/engines/qdengine/qdcore/qd_interface_dispatcher.h
index 3dafd2e1911..65e124c1816 100644
--- a/engines/qdengine/qdcore/qd_interface_dispatcher.h
+++ b/engines/qdengine/qdcore/qd_interface_dispatcher.h
@@ -96,11 +96,11 @@ public:
}
//! ÐобавлÑÐµÑ ÑеÑÑÑÑ file_name Ñ Ð²Ð»Ð°Ð´ÐµÐ»ÑÑем owner.
- qdResource *add_resource(const char *file_name, const qdInterfaceElementState *owner);
+ qdResource *add_resource(const Common::Path file_name, const qdInterfaceElementState *owner);
//! УдалÑÐµÑ ÑеÑÑÑÑ file_name Ñ Ð²Ð»Ð°Ð´ÐµÐ»ÑÑем owner.
- bool remove_resource(const char *file_name, const qdInterfaceElementState *owner);
+ bool remove_resource(const Common::Path file_name, const qdInterfaceElementState *owner);
//! ÐозвÑаÑÐ°ÐµÑ ÑказаÑÐµÐ»Ñ Ð½Ð° ÑеÑÑÑÑ file_name.
- qdResource *get_resource(const char *file_name) const {
+ qdResource *get_resource(const Common::Path file_name) const {
return _resources.get_resource(file_name);
}
diff --git a/engines/qdengine/qdcore/qd_interface_element.cpp b/engines/qdengine/qdcore/qd_interface_element.cpp
index 72cdbbd63ed..723d9f4a628 100644
--- a/engines/qdengine/qdcore/qd_interface_element.cpp
+++ b/engines/qdengine/qdcore/qd_interface_element.cpp
@@ -196,14 +196,14 @@ bool qdInterfaceElement::load_script(const xml::tag *p) {
return load_script_body(p);
}
-qdResource *qdInterfaceElement::add_resource(const char *file_name, const qdInterfaceElementState *res_owner) {
+qdResource *qdInterfaceElement::add_resource(const Common::Path file_name, const qdInterfaceElementState *res_owner) {
if (qdInterfaceScreen * p = dynamic_cast<qdInterfaceScreen * >(owner()))
return p->add_resource(file_name, res_owner);
return NULL;
}
-bool qdInterfaceElement::remove_resource(const char *file_name, const qdInterfaceElementState *res_owner) {
+bool qdInterfaceElement::remove_resource(const Common::Path file_name, const qdInterfaceElementState *res_owner) {
if (qdInterfaceScreen * p = dynamic_cast<qdInterfaceScreen * >(owner()))
return p->remove_resource(file_name, res_owner);
diff --git a/engines/qdengine/qdcore/qd_interface_element.h b/engines/qdengine/qdcore/qd_interface_element.h
index 72ecceaf129..a0aeaad655a 100644
--- a/engines/qdengine/qdcore/qd_interface_element.h
+++ b/engines/qdengine/qdcore/qd_interface_element.h
@@ -188,9 +188,9 @@ public:
bool set_state(const qdInterfaceElementState *p);
//! ÐобавлÑÐµÑ ÑеÑÑÑÑ file_name Ñ Ð²Ð»Ð°Ð´ÐµÐ»ÑÑем owner.
- qdResource *add_resource(const char *file_name, const qdInterfaceElementState *res_owner);
+ qdResource *add_resource(const Common::Path file_name, const qdInterfaceElementState *res_owner);
//! УдалÑÐµÑ ÑеÑÑÑÑ file_name Ñ Ð²Ð»Ð°Ð´ÐµÐ»ÑÑем owner.
- bool remove_resource(const char *file_name, const qdInterfaceElementState *res_owner);
+ bool remove_resource(const Common::Path file_name, const qdInterfaceElementState *res_owner);
//! ÐозвÑаÑÐ°ÐµÑ true, еÑли ÑоÑка Ñ ÑкÑаннÑми кооÑдинаÑами (x,Ñ) Ð¿Ð¾Ð¿Ð°Ð´Ð°ÐµÑ Ð² ÑлеменÑ.
virtual bool hit_test(int x, int y) const;
diff --git a/engines/qdengine/qdcore/qd_interface_element_state.cpp b/engines/qdengine/qdcore/qd_interface_element_state.cpp
index 98e38b1c1e7..21e30f1267d 100644
--- a/engines/qdengine/qdcore/qd_interface_element_state.cpp
+++ b/engines/qdengine/qdcore/qd_interface_element_state.cpp
@@ -204,7 +204,7 @@ bool qdInterfaceElementState::quant(float dt) {
return false;
}
-void qdInterfaceElementState::set_sound_file(const char *str, state_mode_t snd_id) {
+void qdInterfaceElementState::set_sound_file(const Common::Path str, state_mode_t snd_id) {
if (has_sound(snd_id)) {
if (qdInterfaceElement * p = dynamic_cast<qdInterfaceElement * >(owner()))
p->remove_resource(sound_file(snd_id), this);
@@ -219,7 +219,7 @@ void qdInterfaceElementState::set_sound_file(const char *str, state_mode_t snd_i
}
}
-void qdInterfaceElementState::set_animation_file(const char *name, state_mode_t anm_id) {
+void qdInterfaceElementState::set_animation_file(const Common::Path name, state_mode_t anm_id) {
if (has_animation(anm_id)) {
if (qdInterfaceElement * p = dynamic_cast<qdInterfaceElement * >(owner()))
p->remove_resource(animation_file(anm_id), this);
diff --git a/engines/qdengine/qdcore/qd_interface_element_state.h b/engines/qdengine/qdcore/qd_interface_element_state.h
index 95ff72e1191..15ecb3b9941 100644
--- a/engines/qdengine/qdcore/qd_interface_element_state.h
+++ b/engines/qdengine/qdcore/qd_interface_element_state.h
@@ -180,9 +180,9 @@ public:
/**
ÐÑли надо ÑбÑаÑÑ Ð·Ð²Ñк - пеÑедаÑÑ NULL в каÑеÑÑве имени Ñайла.
*/
- void set_sound_file(const char *str, state_mode_t snd_id = DEFAULT_MODE);
+ void set_sound_file(const Common::Path str, state_mode_t snd_id = DEFAULT_MODE);
//! ÐозвÑаÑÐ°ÐµÑ Ð¸Ð¼Ñ Ñайла звÑкового ÑÑÑекÑа, пÑивÑзанного к ÑоÑÑоÑниÑ.
- const char *sound_file(state_mode_t snd_id = DEFAULT_MODE) const {
+ const Common::Path sound_file(state_mode_t snd_id = DEFAULT_MODE) const {
return _modes[snd_id].sound_file();
}
//! ÐозвÑаÑÐ°ÐµÑ ÑказаÑÐµÐ»Ñ Ð½Ð° звÑковой ÑÑÑекÑ, пÑивÑзаннÑй к ÑоÑÑоÑниÑ.
@@ -198,9 +198,9 @@ public:
/**
ÐÑли надо ÑбÑаÑÑ Ð°Ð½Ð¸Ð¼Ð°ÑÐ¸Ñ - пеÑедаÑÑ NULL в каÑеÑÑве имени Ñайла.
*/
- void set_animation_file(const char *name, state_mode_t anm_id = DEFAULT_MODE);
+ void set_animation_file(const Common::Path name, state_mode_t anm_id = DEFAULT_MODE);
//! ÐозвÑаÑÐ°ÐµÑ Ð¸Ð¼Ñ Ñайла Ð´Ð»Ñ Ð°Ð½Ð¸Ð¼Ð°Ñии.
- const char *animation_file(state_mode_t anm_id = DEFAULT_MODE) const {
+ const Common::Path animation_file(state_mode_t anm_id = DEFAULT_MODE) const {
return _modes[anm_id].animation_file();
}
//! ÐозвÑаÑÐ°ÐµÑ Ñлаги анимаÑии.
diff --git a/engines/qdengine/qdcore/qd_interface_element_state_mode.cpp b/engines/qdengine/qdcore/qd_interface_element_state_mode.cpp
index 55ced064af9..fee9ad9ee24 100644
--- a/engines/qdengine/qdcore/qd_interface_element_state_mode.cpp
+++ b/engines/qdengine/qdcore/qd_interface_element_state_mode.cpp
@@ -59,18 +59,12 @@ qdInterfaceElementStateMode &qdInterfaceElementStateMode::operator = (const qdIn
return *this;
}
-void qdInterfaceElementStateMode::set_sound_file(const char *name) {
- if (name)
- _sound_file = name;
- else
- _sound_file.clear();
+void qdInterfaceElementStateMode::set_sound_file(const Common::Path name) {
+ _sound_file = name;
}
-void qdInterfaceElementStateMode::set_animation_file(const char *name) {
- if (name)
- _animation_file = name;
- else
- _animation_file.clear();
+void qdInterfaceElementStateMode::set_animation_file(const Common::Path name) {
+ _animation_file = name;
}
bool qdInterfaceElementStateMode::save_script(Common::WriteStream &fh, int type_id, int indent) const {
@@ -80,7 +74,7 @@ bool qdInterfaceElementStateMode::save_script(Common::WriteStream &fh, int type_
fh.writeString(Common::String::format("<state_mode type=\"%d\"", type_id));
if (has_animation()) {
- fh.writeString(Common::String::format(" animation=\"%s\"", qdscr_XML_string(animation_file())));
+ fh.writeString(Common::String::format(" animation=\"%s\"", qdscr_XML_string(animation_file().toString('\\'))));
}
if (_animation_flags) {
@@ -88,7 +82,7 @@ bool qdInterfaceElementStateMode::save_script(Common::WriteStream &fh, int type_
}
if (has_sound()) {
- fh.writeString(Common::String::format(" sound=\"%s\"", qdscr_XML_string(sound_file())));
+ fh.writeString(Common::String::format(" sound=\"%s\"", qdscr_XML_string(sound_file().toString('\\'))));
}
if (has_contour()) {
@@ -115,7 +109,7 @@ bool qdInterfaceElementStateMode::load_script(const xml::tag *p) {
xml::tag_buffer(*it) > _animation_flags;
break;
case QDSCR_ANIMATION:
- set_animation_file(it->data());
+ set_animation_file(Common::Path(it->data(), '\\'));
break;
case QDSCR_CONTOUR_CIRCLE:
_contour.set_contour_type(qdContour::CONTOUR_CIRCLE);
diff --git a/engines/qdengine/qdcore/qd_interface_element_state_mode.h b/engines/qdengine/qdcore/qd_interface_element_state_mode.h
index c72616072cd..6615b16301e 100644
--- a/engines/qdengine/qdcore/qd_interface_element_state_mode.h
+++ b/engines/qdengine/qdcore/qd_interface_element_state_mode.h
@@ -23,9 +23,9 @@
#ifndef QDENGINE_QDCORE_QD_INTERFACE_ELEMENT_STATE_MODE_H
#define QDENGINE_QDCORE_QD_INTERFACE_ELEMENT_STATE_MODE_H
+#include "common/path.h"
#include "qdengine/qdcore/qd_contour.h"
-
namespace QDEngine {
//! СобÑÑие, пÑивÑзанное к ÑоÑÑоÑÐ½Ð¸Ñ Ð¸Ð½ÑеÑÑейÑного ÑлеменÑа.
@@ -45,10 +45,10 @@ public:
/**
ÐÑли надо ÑбÑаÑÑ Ð·Ð²Ñк - пеÑедаÑÑ NULL в каÑеÑÑве имени Ñайла.
*/
- void set_sound_file(const char *name);
+ void set_sound_file(const Common::Path name);
//! ÐозвÑаÑÐ°ÐµÑ Ð¸Ð¼Ñ Ñайла звÑка.
- const char *sound_file() const {
- return _sound_file.c_str();
+ const Common::Path sound_file() const {
+ return _sound_file;
}
//! УÑÑÐ°Ð½Ð°Ð²Ð»Ð¸Ð²Ð°ÐµÑ Ð·Ð²Ñк ÑобÑÑиÑ.
void set_sound(const qdSound *p) {
@@ -67,10 +67,10 @@ public:
/**
ÐÑли надо ÑбÑаÑÑ Ð°Ð½Ð¸Ð¼Ð°ÑÐ¸Ñ - пеÑедаÑÑ NULL в каÑеÑÑве имени Ñайла.
*/
- void set_animation_file(const char *name);
+ void set_animation_file(const Common::Path name);
//! ÐозвÑаÑÐ°ÐµÑ Ð¸Ð¼Ñ Ñайла Ð´Ð»Ñ Ð°Ð½Ð¸Ð¼Ð°Ñии.
- const char *animation_file() const {
- return _animation_file.c_str();
+ const Common::Path animation_file() const {
+ return _animation_file;
}
//! ÐозвÑаÑÐ°ÐµÑ Ñлаги анимаÑии.
int animation_flags() const {
@@ -134,13 +134,13 @@ public:
private:
//! ÐÐ¼Ñ Ñайла звÑка.
- Common::String _sound_file;
+ Common::Path _sound_file;
//! ÐвÑк, вклÑÑаемÑй ÑобÑÑием.
const qdSound *_sound;
//! ÐÐ¼Ñ Ñайла Ð´Ð»Ñ Ð°Ð½Ð¸Ð¼Ð°Ñии
- Common::String _animation_file;
+ Common::Path _animation_file;
//! Флаги Ð´Ð»Ñ Ð°Ð½Ð¸Ð¼Ð°Ñии.
int _animation_flags;
diff --git a/engines/qdengine/qdcore/qd_interface_save.cpp b/engines/qdengine/qdcore/qd_interface_save.cpp
index 1465dff15e4..4c16d5fab86 100644
--- a/engines/qdengine/qdcore/qd_interface_save.cpp
+++ b/engines/qdengine/qdcore/qd_interface_save.cpp
@@ -167,7 +167,7 @@ bool qdInterfaceSave::init(bool is_game_active) {
delete saveFile;
- _thumbnail.set_animation_file(Common::String::format("save:%s", saveFileName.c_str()).c_str());
+ _thumbnail.set_animation_file(Common::Path(Common::String::format("scummvm/%s", saveFileName.c_str())));
} else {
_save_title = "";
}
diff --git a/engines/qdengine/qdcore/qd_interface_save.h b/engines/qdengine/qdcore/qd_interface_save.h
index 28763f2063e..289d249d700 100644
--- a/engines/qdengine/qdcore/qd_interface_save.h
+++ b/engines/qdengine/qdcore/qd_interface_save.h
@@ -122,11 +122,11 @@ public:
/**
ÐÑли надо ÑбÑаÑÑ Ð°Ð½Ð¸Ð¼Ð°ÑÐ¸Ñ - пеÑедаÑÑ NULL в каÑеÑÑве имени Ñайла.
*/
- void set_frame_animation_file(const char *name, qdInterfaceElementState::state_mode_t mode = qdInterfaceElementState::MOUSE_HOVER_MODE) {
+ void set_frame_animation_file(const Common::Path name, qdInterfaceElementState::state_mode_t mode = qdInterfaceElementState::MOUSE_HOVER_MODE) {
_frame.set_animation_file(name, mode);
}
//! ÐозвÑаÑÐ°ÐµÑ Ð¸Ð¼Ñ Ñайла Ð´Ð»Ñ Ð°Ð½Ð¸Ð¼Ð°Ñии.
- const char *frame_animation_file(qdInterfaceElementState::state_mode_t mode = qdInterfaceElementState::MOUSE_HOVER_MODE) const {
+ const Common::Path frame_animation_file(qdInterfaceElementState::state_mode_t mode = qdInterfaceElementState::MOUSE_HOVER_MODE) const {
return _frame.animation_file(mode);
}
//! ÐозвÑаÑÐ°ÐµÑ Ñлаги анимаÑии.
@@ -155,7 +155,7 @@ public:
void set_frame_sound_file(const char *name, qdInterfaceElementState::state_mode_t mode = qdInterfaceElementState::MOUSE_HOVER_MODE) {
_frame.set_sound_file(name, mode);
}
- const char *frame_sound_file(qdInterfaceElementState::state_mode_t mode = qdInterfaceElementState::MOUSE_HOVER_MODE) const {
+ const Common::Path frame_sound_file(qdInterfaceElementState::state_mode_t mode = qdInterfaceElementState::MOUSE_HOVER_MODE) const {
return _frame.sound_file(mode);
}
diff --git a/engines/qdengine/qdcore/qd_interface_screen.cpp b/engines/qdengine/qdcore/qd_interface_screen.cpp
index 2dd8b25e30a..de75c0a3a7c 100644
--- a/engines/qdengine/qdcore/qd_interface_screen.cpp
+++ b/engines/qdengine/qdcore/qd_interface_screen.cpp
@@ -265,7 +265,7 @@ bool qdInterfaceScreen::char_input_handler(int vkey) {
return false;
}
-qdResource *qdInterfaceScreen::add_resource(const char *file_name, const qdInterfaceElementState *res_owner) {
+qdResource *qdInterfaceScreen::add_resource(const Common::Path file_name, const qdInterfaceElementState *res_owner) {
if (qdInterfaceDispatcher *dp = dynamic_cast<qdInterfaceDispatcher * >(owner())) {
if (qdResource *p = dp->add_resource(file_name, res_owner)) {
_resources.register_resource(p, res_owner);
@@ -279,7 +279,7 @@ qdResource *qdInterfaceScreen::add_resource(const char *file_name, const qdInter
return NULL;
}
-bool qdInterfaceScreen::remove_resource(const char *file_name, const qdInterfaceElementState *res_owner) {
+bool qdInterfaceScreen::remove_resource(const Common::Path file_name, const qdInterfaceElementState *res_owner) {
if (qdInterfaceDispatcher *dp = dynamic_cast<qdInterfaceDispatcher * >(owner())) {
if (qdResource *p = dp->get_resource(file_name)) {
_resources.unregister_resource(p, res_owner);
diff --git a/engines/qdengine/qdcore/qd_interface_screen.h b/engines/qdengine/qdcore/qd_interface_screen.h
index 2a573e4dd2c..9b3e4901050 100644
--- a/engines/qdengine/qdcore/qd_interface_screen.h
+++ b/engines/qdengine/qdcore/qd_interface_screen.h
@@ -84,9 +84,9 @@ public:
bool char_input_handler(int vkey);
//! ÐобавлÑÐµÑ ÑеÑÑÑÑ file_name Ñ Ð²Ð»Ð°Ð´ÐµÐ»ÑÑем owner.
- qdResource *add_resource(const char *file_name, const qdInterfaceElementState *res_owner);
+ qdResource *add_resource(const Common::Path file_name, const qdInterfaceElementState *res_owner);
//! УдалÑÐµÑ ÑеÑÑÑÑ file_name Ñ Ð²Ð»Ð°Ð´ÐµÐ»ÑÑем owner.
- bool remove_resource(const char *file_name, const qdInterfaceElementState *res_owner);
+ bool remove_resource(const Common::Path file_name, const qdInterfaceElementState *res_owner);
//! ÐозвÑаÑÐ°ÐµÑ true, еÑли на ÑеÑÑÑÑ ÐµÑÑÑ ÑÑÑлки.
bool has_references(const qdResource *p) const {
return _resources.is_registered(p);
diff --git a/engines/qdengine/qdcore/qd_interface_text_window.cpp b/engines/qdengine/qdcore/qd_interface_text_window.cpp
index 5db7ac6328c..430eae14c99 100644
--- a/engines/qdengine/qdcore/qd_interface_text_window.cpp
+++ b/engines/qdengine/qdcore/qd_interface_text_window.cpp
@@ -233,7 +233,7 @@ bool qdInterfaceTextWindow::save_script_body(Common::WriteStream &fh, int indent
for (int i = 0; i <= indent; i++) {
fh.writeString("\t");
}
- fh.writeString(Common::String::format("<border_back>%s</border_back>\r\n", qdscr_XML_string(_border_background.animation_file())));
+ fh.writeString(Common::String::format("<border_back>%s</border_back>\r\n", qdscr_XML_string(_border_background.animation_file().toString('\\'))));
}
if (!_slider_name.empty()) {
diff --git a/engines/qdengine/qdcore/qd_interface_text_window.h b/engines/qdengine/qdcore/qd_interface_text_window.h
index f869997d839..1a703b2833a 100644
--- a/engines/qdengine/qdcore/qd_interface_text_window.h
+++ b/engines/qdengine/qdcore/qd_interface_text_window.h
@@ -79,10 +79,10 @@ public:
bool quant(float dt);
- const char *border_background_file() const {
+ const Common::Path border_background_file() const {
return _border_background.animation_file();
}
- void set_border_background_file(const char *file_name) {
+ void set_border_background_file(const Common::Path file_name) {
_border_background.set_animation_file(file_name);
}
diff --git a/engines/qdengine/qdcore/qd_inventory_cell.cpp b/engines/qdengine/qdcore/qd_inventory_cell.cpp
index 06eba262c30..311013e0ec9 100644
--- a/engines/qdengine/qdcore/qd_inventory_cell.cpp
+++ b/engines/qdengine/qdcore/qd_inventory_cell.cpp
@@ -64,8 +64,8 @@ bool qdInventoryCellType::save_script(Common::WriteStream &fh, int indent) const
}
fh.writeString(Common::String::format("<inventory_cell_type type=\"%d\"", _type));
- if (strlen(_sprite.file())) {
- fh.writeString(Common::String::format(" file=\"%s\"", qdscr_XML_string(_sprite.file())));
+ if (!_sprite.file().empty()) {
+ fh.writeString(Common::String::format(" file=\"%s\"", qdscr_XML_string(_sprite.file().toString('\\'))));
}
fh.writeString("/>\r\n");
diff --git a/engines/qdengine/qdcore/qd_inventory_cell.h b/engines/qdengine/qdcore/qd_inventory_cell.h
index 09afec339cc..bd033763368 100644
--- a/engines/qdengine/qdcore/qd_inventory_cell.h
+++ b/engines/qdengine/qdcore/qd_inventory_cell.h
@@ -49,10 +49,10 @@ public:
_type = tp;
}
- void set_sprite_file(const char *fname) {
+ void set_sprite_file(const Common::Path fname) {
_sprite.set_file(fname);
}
- const char *sprite_file() const {
+ const Common::Path sprite_file() const {
return _sprite.file();
}
diff --git a/engines/qdengine/qdcore/qd_resource.cpp b/engines/qdengine/qdcore/qd_resource.cpp
index a35745c4844..09248261711 100644
--- a/engines/qdengine/qdcore/qd_resource.cpp
+++ b/engines/qdengine/qdcore/qd_resource.cpp
@@ -46,20 +46,18 @@ qdResource &qdResource::operator = (const qdResource &res) {
qdResource::~qdResource() {
}
-qdResource::file_format_t qdResource::file_format(const char *file_name) {
- char ext[10];
- uint len = strlen(file_name);
+qdResource::file_format_t qdResource::file_format(const Common::Path path) {
+ Common::String file_name(path.baseName());
- if (len < 4)
+ if (file_name.size() < 4)
return RES_UNKNOWN;
- if (!strncmp(file_name, "save:", 5)) return RES_SPRITE;
+ if (path.isRelativeTo("scummvm"))
+ return RES_SPRITE;
- Common::strlcpy(ext, &file_name[len - 4], 10);
-
- if (!scumm_stricmp(ext, ".qda")) return RES_ANIMATION;
- if (!scumm_stricmp(ext, ".tga")) return RES_SPRITE;
- if (!scumm_stricmp(ext, ".wav")) return RES_SOUND;
+ if (file_name.hasSuffixIgnoreCase(".qda")) return RES_ANIMATION;
+ if (file_name.hasSuffixIgnoreCase(".tga")) return RES_SPRITE;
+ if (file_name.hasSuffixIgnoreCase(".wav")) return RES_SOUND;
return RES_UNKNOWN;
}
diff --git a/engines/qdengine/qdcore/qd_resource.h b/engines/qdengine/qdcore/qd_resource.h
index 4ae578a312c..9b4adbf7553 100644
--- a/engines/qdengine/qdcore/qd_resource.h
+++ b/engines/qdengine/qdcore/qd_resource.h
@@ -22,6 +22,7 @@
#ifndef QDENGINE_QDCORE_QD_RESOURCE_H
#define QDENGINE_QDCORE_QD_RESOURCE_H
+#include "common/path.h"
//! ÐазовÑй клаÑÑ Ð´Ð»Ñ Ð¸Ð³ÑовÑÑ
ÑеÑÑÑÑов.
@@ -56,19 +57,19 @@ public:
virtual bool free_resource() = 0;
//! УÑÑÐ°Ð½Ð°Ð²Ð»Ð¸Ð²Ð°ÐµÑ Ð¸Ð¼Ñ Ñайла, в коÑоÑом Ñ
ÑанÑÑÑÑ Ð´Ð°Ð½Ð½Ñе ÑеÑÑÑÑа.
- virtual void set_resource_file(const char *file_name) = 0;
+ virtual void set_resource_file(const Common::Path file_name) = 0;
//! ÐозвÑаÑÐ°ÐµÑ Ð¸Ð¼Ñ Ñайла, в коÑоÑом Ñ
ÑанÑÑÑÑ Ð´Ð°Ð½Ð½Ñе ÑеÑÑÑÑа.
/**
ÐÑли оно не задано, должна возвÑаÑаеÑÑ NULL.
*/
- virtual const char *resource_file() const = 0;
+ virtual const Common::Path resource_file() const = 0;
//! ÐозвÑаÑÐ°ÐµÑ true, еÑли даннÑе ÑеÑÑÑÑа загÑÑÐ¶ÐµÐ½Ñ Ð² памÑÑÑ.
bool is_resource_loaded() const {
return _is_loaded;
}
- static file_format_t file_format(const char *file_name);
+ static file_format_t file_format(const Common::Path file_name);
#ifdef __QD_DEBUG_ENABLE__
virtual uint32 resource_data_size() const = 0;
diff --git a/engines/qdengine/qdcore/qd_resource_container.h b/engines/qdengine/qdcore/qd_resource_container.h
index a5ff6ae447c..423fe1b11a4 100644
--- a/engines/qdengine/qdcore/qd_resource_container.h
+++ b/engines/qdengine/qdcore/qd_resource_container.h
@@ -43,19 +43,19 @@ public:
virtual ~qdResourceContainer();
//! ÐобавлÑÐµÑ ÑеÑÑÑÑ Ð¸Ð· Ñайла file_name и возвÑаÑÐ°ÐµÑ ÑказаÑÐµÐ»Ñ Ð½Ð° него.
- qdResource *add_resource(const char *file_name, const T *owner);
+ qdResource *add_resource(const Common::Path file_name, const T *owner);
//! УдалÑÐµÑ ÑеÑÑÑÑ, еÑли он нÑжен ÑолÑко Ð´Ð»Ñ Ð¾Ð±ÑекÑа owner.
/**
ÐÑли на даннÑй ÑеÑÑÑÑ ÐµÑÑÑ ÐµÑе ÑÑÑлки, Ñо он не бÑÐ´ÐµÑ Ñдален.
*/
- bool remove_resource(const char *file_name, const T *owner);
+ bool remove_resource(const Common::Path file_name, const T *owner);
//! ÐозвÑаÑÐ°ÐµÑ ÑказаÑÐµÐ»Ñ Ð½Ð° ÑеÑÑÑÑ, ÑооÑвеÑÑÑвÑÑÑий ÑÐ°Ð¹Ð»Ñ Ñ Ð¸Ð¼ÐµÐ½ÐµÐ¼ file_name.
/**
ÐÑли Ñакой ÑеÑÑÑÑ Ð½Ðµ найден, возвÑаÑÐ°ÐµÑ NULL.
*/
- qdResource *get_resource(const char *file_name) const;
+ qdResource *get_resource(const Common::Path file_name) const;
typedef Std::list<qdResource *> resource_list_t;
//! ÐозвÑаÑÐ°ÐµÑ ÑпиÑок ÑеÑÑÑÑов.
@@ -88,8 +88,8 @@ qdResourceContainer<T>::~qdResourceContainer() {
}
template<class T>
-qdResource *qdResourceContainer<T>::add_resource(const char *file_name, const T *owner) {
- typename resource_map_t::iterator it = _resource_map.find(file_name);
+qdResource *qdResourceContainer<T>::add_resource(const Common::Path file_name, const T *owner) {
+ typename resource_map_t::iterator it = _resource_map.find(file_name.toString());
if (it != _resource_map.end()) {
_resource_dispatcher.register_resource(it->_value, owner);
return it->_value;
@@ -120,7 +120,7 @@ qdResource *qdResourceContainer<T>::add_resource(const char *file_name, const T
if (!p)
return NULL;
- _resource_map[file_name] = p;
+ _resource_map[file_name.toString()] = p;
_resource_list.push_back(p);
_resource_dispatcher.register_resource(p, owner);
@@ -129,8 +129,8 @@ qdResource *qdResourceContainer<T>::add_resource(const char *file_name, const T
}
template<class T>
-bool qdResourceContainer<T>::remove_resource(const char *file_name, const T *owner) {
- typename resource_map_t::iterator it = _resource_map.find(file_name);
+bool qdResourceContainer<T>::remove_resource(const Common::Path file_name, const T *owner) {
+ typename resource_map_t::iterator it = _resource_map.find(file_name.toString());
if (it == _resource_map.end()) return false;
@@ -153,10 +153,10 @@ bool qdResourceContainer<T>::remove_resource(const char *file_name, const T *own
}
template<class T>
-qdResource *qdResourceContainer<T>::get_resource(const char *file_name) const {
- if (!file_name) return NULL;
+qdResource *qdResourceContainer<T>::get_resource(const Common::Path file_name) const {
+ if (file_name.empty()) return NULL;
- typename resource_map_t::const_iterator it = _resource_map.find(file_name);
+ typename resource_map_t::const_iterator it = _resource_map.find(file_name.toString());
if (it != _resource_map.end())
return it->_value;
@@ -166,7 +166,7 @@ qdResource *qdResourceContainer<T>::get_resource(const char *file_name) const {
template<class T>
void qdResourceContainer<T>::get_owners(Std::list<T *> &owners) {
for (resource_list_t::iterator it = _resource_list.begin(); it != _resource_list.end(); ++it) {
- if ((*it)->resource_file()) {
+ if (!(*it)->resource_file().empty()) {
T *ptr = const_cast<T *>(_resource_dispatcher.find_owner(*it));
owners.push_back(ptr);
}
diff --git a/engines/qdengine/qdcore/qd_sound.cpp b/engines/qdengine/qdcore/qd_sound.cpp
index 63b0e0d4cab..65b825fbd86 100644
--- a/engines/qdengine/qdcore/qd_sound.cpp
+++ b/engines/qdengine/qdcore/qd_sound.cpp
@@ -54,7 +54,7 @@ bool qdSound::load_resource() {
toggle_resource_status(true);
- return _sound.wav_file_load(_file_name.c_str());
+ return _sound.wav_file_load(_file_name);
}
void qdSound::load_script(const xml::tag *p) {
@@ -91,7 +91,7 @@ bool qdSound::save_script(Common::WriteStream &fh, int indent) const {
}
if (!_file_name.empty()) {
- fh.writeString(Common::String::format(" file=\"%s\"", qdscr_XML_string(_file_name.c_str())));
+ fh.writeString(Common::String::format(" file=\"%s\"", qdscr_XML_string(_file_name.toString('\\'))));
}
fh.writeString("/>\r\n");
diff --git a/engines/qdengine/qdcore/qd_sound.h b/engines/qdengine/qdcore/qd_sound.h
index 735db36e2e0..fde1bbcba67 100644
--- a/engines/qdengine/qdcore/qd_sound.h
+++ b/engines/qdengine/qdcore/qd_sound.h
@@ -49,11 +49,11 @@ public:
bool load_resource();
bool free_resource();
//! УÑÑÐ°Ð½Ð°Ð²Ð»Ð¸Ð²Ð°ÐµÑ Ð¸Ð¼Ñ Ñайла, в коÑоÑом Ñ
ÑанÑÑÑÑ Ð´Ð°Ð½Ð½Ñе ÑеÑÑÑÑа.
- void set_resource_file(const char *file_name) {
+ void set_resource_file(const Common::Path file_name) {
set_file_name(file_name);
}
//! ÐозвÑаÑÐ°ÐµÑ Ð¸Ð¼Ñ Ñайла, в коÑоÑом Ñ
ÑаниÑÑÑ Ð°Ð½Ð¸Ð¼Ð°ÑиÑ.
- const char *resource_file() const {
+ const Common::Path resource_file() const {
return file_name();
}
#ifdef __QD_DEBUG_ENABLE__
@@ -63,12 +63,11 @@ public:
#endif
//! ÐозвÑаÑÐ°ÐµÑ Ð¸Ð¼Ñ Ñайла, в коÑоÑом Ñ
ÑаниÑÑÑ Ð·Ð²Ñк.
- const char *file_name() const {
- if (!_file_name.empty()) return _file_name.c_str();
- return 0;
+ const Common::Path file_name() const {
+ return _file_name;
}
//! УÑÑÐ°Ð½Ð°Ð²Ð»Ð¸Ð²Ð°ÐµÑ Ð¸Ð¼Ñ Ñайла, в коÑоÑом Ñ
ÑаниÑÑÑ Ð·Ð²Ñк.
- void set_file_name(const char *fname) {
+ void set_file_name(const Common::Path fname) {
_file_name = fname;
}
@@ -105,7 +104,7 @@ public:
private:
- Common::String _file_name;
+ Common::Path _file_name;
//! Sound volume, [0, 255].
int _volume;
wavSound _sound;
diff --git a/engines/qdengine/qdcore/qd_sprite.cpp b/engines/qdengine/qdcore/qd_sprite.cpp
index 73b25b2796b..55633127a12 100644
--- a/engines/qdengine/qdcore/qd_sprite.cpp
+++ b/engines/qdengine/qdcore/qd_sprite.cpp
@@ -191,22 +191,24 @@ void qdSprite::free() {
drop_flag(ALPHA_FLAG);
}
-bool qdSprite::load(const char *fname) {
- free();
+bool qdSprite::load(const Common::Path fpath) {
+ set_file(fpath);
+
+ load();
+}
- debugC(3, kDebugLoad, "qdSprite::load(%s, %s)", transCyrillic(fname), transCyrillic(_file.c_str()));
+bool qdSprite::load() {
+ free();
- if (fname)
- set_file(fname);
+ debugC(3, kDebugLoad, "qdSprite::load(%s)", transCyrillic(_file.toString()));
int sx, sy, flags, ssx, colors;
byte header[18];
Common::SeekableReadStream *fh;
- Common::Path fpath(_file.c_str(), '\\');
- if (!strncmp(_file.c_str(), "save:", 5)) {
- Common::InSaveFile *saveFile = g_engine->getSaveFileManager()->openForLoading(&_file.c_str()[5]);
+ if (_file.isRelativeTo("scummvm")) {
+ Common::InSaveFile *saveFile = g_engine->getSaveFileManager()->openForLoading(_file.baseName());
ExtendedSavegameHeader saveHeader;
if (MetaEngine::readSavegameHeader(saveFile, &saveHeader, false)) {
@@ -234,7 +236,7 @@ bool qdSprite::load(const char *fname) {
return true;
}
- if (!qdFileManager::instance().open_file(&fh, fpath.toString().c_str())) {
+ if (!qdFileManager::instance().open_file(&fh, _file)) {
return false;
}
@@ -247,13 +249,13 @@ bool qdSprite::load(const char *fname) {
// ColorMapType. 0 - ÑвеÑовой ÑаблиÑÑ Ð½ÐµÑ. 1 - еÑÑÑ. ÐÑÑалÑное не ÑооÑв. ÑÑандаÑÑÑ.
// ÐзобÑÐ°Ð¶ÐµÐ½Ð¸Ñ Ñ ÑвеÑовой ÑаблиÑей не обÑабаÑÑваем.
if (header[1]) {
- warning("qdSprite::load(): Bad file format: '%s'", transCyrillic(_file.c_str()));
+ warning("qdSprite::load(): Bad file format: '%s'", transCyrillic(_file.toString()));
return false;
}
// ImageType. 2 - truecolor без ÑжаÑиÑ, 10 - truecolor Ñо ÑжаÑием (RLE).
if ((header[2] != 2) && (header[2] != 10)) {
- warning("qdSprite::load(): Bad file format: '%s'", transCyrillic(_file.c_str()));
+ warning("qdSprite::load(): Bad file format: '%s'", transCyrillic(_file.toString()));
return false;
}
@@ -280,7 +282,7 @@ bool qdSprite::load(const char *fname) {
break;
// ÐнаÑе невеÑнÑй ÑоÑÐ¼Ð°Ñ Ñайла
default: {
- warning("qdSprite::load(): Bad file format: '%s'", transCyrillic(_file.c_str()));
+ warning("qdSprite::load(): Bad file format: '%s'", transCyrillic(_file.toString()));
return false;
}
}
@@ -385,10 +387,10 @@ bool qdSprite::load(const char *fname) {
return true;
}
-void qdSprite::save(const char *fname) {
+void qdSprite::save(const Common::Path fname) {
if (_format != GR_RGB888 && _format != GR_ARGB8888) return;
- const char *out_file = (fname) ? fname : _file.c_str();
+ const Common::Path out_file = !fname.empty() ? fname : _file;
static byte header[18];
diff --git a/engines/qdengine/qdcore/qd_sprite.h b/engines/qdengine/qdcore/qd_sprite.h
index 8167f357c72..8ad9dfce1e3 100644
--- a/engines/qdengine/qdcore/qd_sprite.h
+++ b/engines/qdengine/qdcore/qd_sprite.h
@@ -92,19 +92,19 @@ public:
}
uint32 data_size() const;
- void set_file(const char *fname) {
- if (fname) _file = fname;
- else _file.clear();
+ void set_file(const Common::Path fname) {
+ _file = fname;
}
- const char *file() const {
- return _file.c_str();
+ const Common::Path file() const {
+ return _file;
}
bool has_file() const {
return !_file.empty();
}
- bool load(const char *fname = 0);
- void save(const char *fname = 0);
+ bool load(const Common::Path fname);
+ bool load();
+ void save(const Common::Path fname);
void free();
virtual void qda_load(Common::SeekableReadStream *fh, int version = 100);
@@ -174,14 +174,14 @@ public:
}
//! УÑÑÐ°Ð½Ð°Ð²Ð»Ð¸Ð²Ð°ÐµÑ Ð¸Ð¼Ñ Ñайла, в коÑоÑом Ñ
ÑанÑÑÑÑ Ð´Ð°Ð½Ð½Ñе ÑеÑÑÑÑа.
- void set_resource_file(const char *_filename) {
+ void set_resource_file(const Common::Path _filename) {
set_file(_filename);
}
//! ÐозвÑаÑÐ°ÐµÑ Ð¸Ð¼Ñ Ñайла, в коÑоÑом Ñ
ÑанÑÑÑÑ Ð´Ð°Ð½Ð½Ñе ÑеÑÑÑÑа.
/**
ÐÑли оно не задано, должна возвÑаÑаеÑÑ NULL.
*/
- const char *resource_file() const {
+ const Common::Path resource_file() const {
if (has_file()) return file();
return NULL;
}
@@ -211,7 +211,7 @@ private:
byte *_data;
class RLEBuffer *_rle_data;
- Common::String _file;
+ Common::Path _file;
friend bool operator == (const qdSprite &sp1, const qdSprite &sp2);
};
diff --git a/engines/qdengine/qdcore/qd_video.cpp b/engines/qdengine/qdcore/qd_video.cpp
index fafbf5d53f0..51b228bce3e 100644
--- a/engines/qdengine/qdcore/qd_video.cpp
+++ b/engines/qdengine/qdcore/qd_video.cpp
@@ -122,13 +122,13 @@ bool qdVideo::save_script(Common::WriteStream &fh, int indent) const {
for (int i = 0; i <= indent; i++) {
fh.writeString("\t");
}
- fh.writeString(Common::String::format("<video_background>%s</video_background>", qdscr_XML_string(background_file_name())));
+ fh.writeString(Common::String::format("<video_background>%s</video_background>", qdscr_XML_string(background_file_name().toString('\\'))));
}
for (int i = 0; i <= indent; i++) {
fh.writeString("\t");
}
- fh.writeString(Common::String::format("<file>%s</file>\r\n", qdscr_XML_string(_file_name.c_str())));
+ fh.writeString(Common::String::format("<file>%s</file>\r\n", qdscr_XML_string(_file_name.toString('\\'))));
save_conditions_script(fh, indent);
diff --git a/engines/qdengine/qdcore/qd_video.h b/engines/qdengine/qdcore/qd_video.h
index 752990ddd7a..d4d1783a477 100644
--- a/engines/qdengine/qdcore/qd_video.h
+++ b/engines/qdengine/qdcore/qd_video.h
@@ -55,18 +55,18 @@ public:
return QD_NAMED_OBJECT_VIDEO;
}
- const char *file_name() const {
- return _file_name.c_str();
+ const Common::Path file_name() const {
+ return _file_name;
}
- void set_file_name(const char *fname) {
+ void set_file_name(const Common::Path fname) {
_file_name = fname;
}
// Фон, на коÑоÑом бÑÐ´ÐµÑ Ð¿ÑоигÑÑваÑÑÑÑ Ð²Ð¸Ð´ÐµÐ¾
- void set_background_file_name(const char *fname) {
+ void set_background_file_name(const Common::Path fname) {
_background.set_file(fname);
}
- const char *background_file_name() const {
+ const Common::Path background_file_name() const {
return _background.file();
}
bool draw_background();
@@ -91,7 +91,7 @@ public:
private:
Vect2s _position;
- Common::String _file_name;
+ Common::Path _file_name;
qdSprite _background;
};
diff --git a/engines/qdengine/qdcore/util/WinVideo.cpp b/engines/qdengine/qdcore/util/WinVideo.cpp
index c29c993be85..0f2d692c5a5 100644
--- a/engines/qdengine/qdcore/util/WinVideo.cpp
+++ b/engines/qdengine/qdcore/util/WinVideo.cpp
@@ -69,11 +69,11 @@ void winVideo::set_window(int x, int y, int xsize, int ysize) {
_tempSurf = new Graphics::ManagedSurface(xsize, ysize, g_engine->_pixelformat);
}
-bool winVideo::open_file(const char *fname) {
+bool winVideo::open_file(const Common::Path fname) {
_videostream = new Common::File();
if (!_videostream->open(fname)) {
- warning("WinVideo::open: Failed to open file %s", fname);
+ warning("WinVideo::open: Failed to open file %s", fname.toString().c_str());
delete _videostream;
return false;
}
diff --git a/engines/qdengine/qdcore/util/WinVideo.h b/engines/qdengine/qdcore/util/WinVideo.h
index 784ecaa63ea..1eb00c0bb5e 100644
--- a/engines/qdengine/qdcore/util/WinVideo.h
+++ b/engines/qdengine/qdcore/util/WinVideo.h
@@ -52,7 +52,7 @@ public:
static bool init(); // initialize DirectShow Lib
static bool done(); // uninitialize DirectShow Lib
- bool open_file(const char *fname);
+ bool open_file(const Common::Path fname);
void close_file();
bool play();
diff --git a/engines/qdengine/qdcore/util/plaympp_api.cpp b/engines/qdengine/qdcore/util/plaympp_api.cpp
index 4768922122a..d2a4d7d3418 100644
--- a/engines/qdengine/qdcore/util/plaympp_api.cpp
+++ b/engines/qdengine/qdcore/util/plaympp_api.cpp
@@ -42,10 +42,10 @@ mpegPlayer::mpegPlayer() : _is_enabled(true),
mpegPlayer::~mpegPlayer() {
}
-bool mpegPlayer::play(const char *file, bool loop, int vol) {
- bool isOGG = Common::String(file).hasSuffix(".ogg");
+bool mpegPlayer::play(const Common::Path file, bool loop, int vol) {
+ bool isOGG = file.baseName().hasSuffix(".ogg");
- debugC(1, kDebugSound, "mpegPlayer::play(%s, %d, %d)", file, loop, vol);
+ debugC(1, kDebugSound, "mpegPlayer::play(%s, %d, %d)", file.toString().c_str(), loop, vol);
_file = file;
@@ -58,14 +58,14 @@ bool mpegPlayer::play(const char *file, bool loop, int vol) {
#ifdef USE_VORBIS
audiostream = Audio::makeVorbisStream(_stream, DisposeAfterUse::YES);
#else
- warning("mpegPlayer::play(: Vorbis support not compiled", file, loop, vol);
+ warning("mpegPlayer::play(%s, %d, %d): Vorbis support not compiled", file.toString().c_str(), loop, vol);
return false;
#endif
} else {
#ifdef USE_MPCDEC
audiostream = Audio::makeMPCStream(_stream, DisposeAfterUse::YES);
#else
- warning("mpegPlayer::play(%s, %d, %d): MPC support not compiled", file, loop, vol);
+ warning("mpegPlayer::play(%s, %d, %d): MPC support not compiled", file.toString().c_str(), loop, vol);
return false;
#endif
}
@@ -83,13 +83,13 @@ bool mpegPlayer::play(const char *file, bool loop, int vol) {
_paused = false;
- debugC(1, kDebugSound, "mpegPlayer::play(%s)", _file.c_str());
+ debugC(1, kDebugSound, "mpegPlayer::play(%s)", _file.toString().c_str());
return true;
}
bool mpegPlayer::stop() {
- debugC(1, kDebugSound, "mpegPlayer::stop(%s)", _file.c_str());
+ debugC(1, kDebugSound, "mpegPlayer::stop(%s)", _file.toString().c_str());
g_system->getMixer()->stopHandle(_soundHandle);
return true;
@@ -99,7 +99,7 @@ bool mpegPlayer::pause() {
if (_paused)
return true;
- debugC(1, kDebugSound, "mpegPlayer::pause(%s)", _file.c_str());
+ debugC(1, kDebugSound, "mpegPlayer::pause(%s)", _file.toString().c_str());
g_system->getMixer()->pauseHandle(_soundHandle, true);
_paused = true;
@@ -110,7 +110,7 @@ bool mpegPlayer::resume() {
if (!_paused)
return true;
- debugC(1, kDebugSound, "mpegPlayer::resume(%s)", _file.c_str());
+ debugC(1, kDebugSound, "mpegPlayer::resume(%s)", _file.toString().c_str());
g_system->getMixer()->pauseHandle(_soundHandle, false);
_paused = false;
@@ -132,13 +132,13 @@ mpegPlayer::mpeg_status_t mpegPlayer::status() const {
else
res = MPEG_STOPPED;
- debugC(7, kDebugSound, "mpegPlayer::status(%s), status: %d", _file.c_str(), res);
+ debugC(7, kDebugSound, "mpegPlayer::status(%s), status: %d", _file.toString().c_str(), res);
return res;
}
void mpegPlayer::set_volume(uint32 vol) {
- debugC(1, kDebugSound, "mpegPlayer::set_volume(%s), vol: %d", _file.c_str(), vol);
+ debugC(1, kDebugSound, "mpegPlayer::set_volume(%s), vol: %d", _file.toString().c_str(), vol);
_volume = vol;
diff --git a/engines/qdengine/qdcore/util/plaympp_api.h b/engines/qdengine/qdcore/util/plaympp_api.h
index 985fbb24342..2f7d266adce 100644
--- a/engines/qdengine/qdcore/util/plaympp_api.h
+++ b/engines/qdengine/qdcore/util/plaympp_api.h
@@ -44,7 +44,7 @@ public:
~mpegPlayer();
- bool play(const char *file, bool loop = false, int vol = 256);
+ bool play(const Common::Path file, bool loop = false, int vol = 256);
bool stop();
bool pause();
bool resume();
@@ -94,7 +94,7 @@ private:
Common::SeekableReadStream *_stream = nullptr;
- Common::String _file;
+ Common::Path _file;
};
} // namespace QDEngine
diff --git a/engines/qdengine/system/sound/snd_sound.cpp b/engines/qdengine/system/sound/snd_sound.cpp
index 2d7de90f80f..ff9ce1e1f85 100644
--- a/engines/qdengine/system/sound/snd_sound.cpp
+++ b/engines/qdengine/system/sound/snd_sound.cpp
@@ -114,7 +114,7 @@ bool sndSound::set_volume(int vol) {
bool sndSound::change_frequency(float coeff) {
if (coeff != 1.0)
- warning("STUB: sndSound::change_frequency(%f) '%s'", coeff, transCyrillic(sound()->_fname.c_str()));
+ warning("STUB: sndSound::change_frequency(%f) '%s'", coeff, transCyrillic(sound()->_fname.toString()));
return true;
}
diff --git a/engines/qdengine/system/sound/wav_sound.cpp b/engines/qdengine/system/sound/wav_sound.cpp
index 0d3bd26a1d8..af66386a26e 100644
--- a/engines/qdengine/system/sound/wav_sound.cpp
+++ b/engines/qdengine/system/sound/wav_sound.cpp
@@ -68,16 +68,15 @@ void wavSound::free_data() {
_samples_per_sec = 0;
}
-bool wavSound::wav_file_load(const char *fname) {
- debugC(3, kDebugSound, "[%d] Loading Wav: %s", g_system->getMillis(), transCyrillic(fname));
+bool wavSound::wav_file_load(const Common::Path fpath) {
+ debugC(3, kDebugSound, "[%d] Loading Wav: %s", g_system->getMillis(), transCyrillic(fpath.toString()));
- if (!fname) {
+ if (fpath.empty()) {
return false;
}
- _fname = fname;
+ _fname = fpath;
- Common::Path fpath(fname, '\\');
Common::SeekableReadStream *stream;
if (qdFileManager::instance().open_file(&stream, fpath.toString().c_str(), false)) {
@@ -87,7 +86,7 @@ bool wavSound::wav_file_load(const char *fname) {
int blockAlign;
if (!Audio::loadWAVFromStream(*stream, size, rate, flags, &type, &blockAlign)) {
- warning("Error loading wav file header: '%s", fname);
+ warning("Error loading wav file header: '%s", fpath.toString().c_str());
delete stream;
return false;
}
diff --git a/engines/qdengine/system/sound/wav_sound.h b/engines/qdengine/system/sound/wav_sound.h
index b38559b90ea..2d96dbc080a 100644
--- a/engines/qdengine/system/sound/wav_sound.h
+++ b/engines/qdengine/system/sound/wav_sound.h
@@ -68,10 +68,10 @@ public:
return float(_data_length / _channels / (_bits_per_sample >> 3)) / float(_samples_per_sec);
}
- bool wav_file_load(const char *fname);
+ bool wav_file_load(const Common::Path fname);
Audio::SeekableAudioStream *_audioStream = nullptr;
- Common::String _fname;
+ Common::Path _fname;
private:
Commit: 56e0ab502d35a5fcc7cb69e751109a92676cd4e7
https://github.com/scummvm/scummvm/commit/56e0ab502d35a5fcc7cb69e751109a92676cd4e7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-08-23T14:06:38+02:00
Commit Message:
QDENGINE: Further fixes and simplifications related to Common::Path
Changed paths:
engines/qdengine/qdcore/qd_font_info.cpp
engines/qdengine/qdcore/qd_font_info.h
engines/qdengine/qdcore/qd_game_dispatcher.cpp
engines/qdengine/qdcore/qd_game_dispatcher.h
engines/qdengine/qdcore/qd_game_object_static.cpp
engines/qdengine/qdcore/qd_game_scene.cpp
engines/qdengine/qdcore/qd_interface_element_state_mode.cpp
engines/qdengine/qdcore/qd_inventory_cell.cpp
engines/qdengine/qdcore/qd_music_track.cpp
engines/qdengine/qdcore/qd_music_track.h
engines/qdengine/qdcore/qd_sound.cpp
engines/qdengine/qdcore/qd_video.cpp
engines/qdengine/system/graphics/gr_font.cpp
engines/qdengine/system/graphics/gr_font.h
diff --git a/engines/qdengine/qdcore/qd_font_info.cpp b/engines/qdengine/qdcore/qd_font_info.cpp
index 309f0210778..7af9abe2f35 100644
--- a/engines/qdengine/qdcore/qd_font_info.cpp
+++ b/engines/qdengine/qdcore/qd_font_info.cpp
@@ -68,7 +68,7 @@ bool qdFontInfo::load_script(const xml::tag *p) {
set_type(xml::tag_buffer(*it).get_int());
break;
case QDSCR_FILE:
- set_font_file_name(Common::Path(it->data(), '\\').toString().c_str());
+ set_font_file_name(Common::Path(it->data(), '\\'));
break;
case QDSCR_NAME:
set_name(it->data());
@@ -86,7 +86,7 @@ bool qdFontInfo::save_script(Common::WriteStream &fh, int indent) const {
fh.writeString(Common::String::format("<fontinfo type=\"%d\"", _type));
if (!_font_file_name.empty()) {
- fh.writeString(Common::String::format(" file=\"%s\"", qdscr_XML_string(_font_file_name.c_str())));
+ fh.writeString(Common::String::format(" file=\"%s\"", qdscr_XML_string(_font_file_name.toString('\\'))));
}
if (name()) {
@@ -107,14 +107,14 @@ bool qdFontInfo::load_font() {
// ÐÑÑзим алÑÑÑ ÑÑиÑÑа из .tga
if (buf_font->load_alpha(fh)) {
// ÐенÑем ÑаÑÑиÑение Ñ .tga на .idx
- Common::String fpath(font_file_name());
+ Common::String fpath(font_file_name().toString());
Common::String tgaExt = ".tga";
Common::String idxExt = ".idx";
Common::replace(fpath, tgaExt, idxExt);
// ÐÑкÑÑваем .idx и гÑÑзим индекÑ
- if (qdFileManager::instance().open_file(&fh, fpath.c_str(), false)) {
+ if (qdFileManager::instance().open_file(&fh, Common::Path(fpath), false)) {
if (buf_font->load_index(fh))
load_fl = true;
}
diff --git a/engines/qdengine/qdcore/qd_font_info.h b/engines/qdengine/qdcore/qd_font_info.h
index 10b1bfa0dcb..3f85c0d8e55 100644
--- a/engines/qdengine/qdcore/qd_font_info.h
+++ b/engines/qdengine/qdcore/qd_font_info.h
@@ -60,11 +60,11 @@ public:
_type = tp;
}
- void set_font_file_name(const char *fname) {
+ void set_font_file_name(const Common::Path fname) {
_font_file_name = fname;
}
- const char *font_file_name() const {
- return _font_file_name.c_str();
+ const Common::Path font_file_name() const {
+ return _font_file_name;
}
const grFont *font() const {
@@ -83,7 +83,7 @@ private:
//! Тип ÑÑиÑÑа.
int _type;
//! Файл ÑÑиÑÑа (*.tga).
- Common::String _font_file_name;
+ Common::Path _font_file_name;
//! Сам ÑÑиÑÑ
grFont *_font;
};
diff --git a/engines/qdengine/qdcore/qd_game_dispatcher.cpp b/engines/qdengine/qdcore/qd_game_dispatcher.cpp
index 5bb60d48d3c..544b947cfda 100644
--- a/engines/qdengine/qdcore/qd_game_dispatcher.cpp
+++ b/engines/qdengine/qdcore/qd_game_dispatcher.cpp
@@ -128,7 +128,7 @@ qdGameDispatcher::qdGameDispatcher() : _is_paused(false),
_mouse_cursor_pos = Vect2f(0, 0);
qdAnimationFrame *p = new qdAnimationFrame;
- p->set_file("Resource\\Cursors\\default.tga");
+ p->set_file(Common::Path("Resource/Cursors/default.tga"));
_mouse_animation->add_frame(p);
@@ -340,8 +340,8 @@ void qdGameDispatcher::load_script(const xml::tag *p) {
debug("> Game title: '%s', id: %d", transCyrillic(_game_title.c_str()), it->origID());
break;
case QDSCR_TEXT_DB:
- _texts_database = it->data();
- debug("> Text db: '%s', id: %d", transCyrillic(_texts_database.c_str()), it->origID());
+ _texts_database = Common::Path(it->data(), '\\');
+ debug("> Text db: '%s', id: %d", transCyrillic(_texts_database.toString()), it->origID());
break;
case QDSCR_CD_KEY:
_cd_key = it->data();
@@ -471,13 +471,12 @@ void qdGameDispatcher::load_script(const xml::tag *p) {
if (!_texts_database.empty()) {
Common::SeekableReadStream *fh;
- Common::Path textsdbPath(_texts_database.c_str(), '\\');
- if (qdFileManager::instance().open_file(&fh, textsdbPath.toString().c_str(), false)) {
+ if (qdFileManager::instance().open_file(&fh, _texts_database, false)) {
qdTextDB::instance().load(fh);
delete fh;
} else {
- warning("Cannot open textsdbPath: '%s'", transCyrillic(textsdbPath.toString().c_str()));
+ warning("Cannot open textsdbPath: '%s'", transCyrillic(_texts_database.toString().c_str()));
}
} else
qdTextDB::instance().clear();
@@ -527,7 +526,7 @@ bool qdGameDispatcher::save_script(Common::SeekableWriteStream &fh) const {
}
if (!_texts_database.empty()) {
- fh.writeString(Common::String::format("\t<text_db>%s</text_db>\r\n", qdscr_XML_string(_texts_database.c_str())));
+ fh.writeString(Common::String::format("\t<text_db>%s</text_db>\r\n", qdscr_XML_string(_texts_database.toString('\\'))));
}
if (!_cd_key.empty()) {
@@ -2641,7 +2640,7 @@ bool qdGameDispatcher::save_save(Common::WriteStream *fh) const {
}
bool qdGameDispatcher::play_music_track(const qdMusicTrack *p, bool interface_mode) {
- debugC(3, kDebugLog, "[%d] music start->%s", g_system->getMillis(), transCyrillic(p->file_name()));
+ debugC(3, kDebugLog, "[%d] music start->%s", g_system->getMillis(), transCyrillic(p->file_name().toString()));
if (!interface_mode) {
if (p->check_flag(QD_MUSIC_TRACK_DISABLE_RESTART) && _cur_music_track == p)
diff --git a/engines/qdengine/qdcore/qd_game_dispatcher.h b/engines/qdengine/qdcore/qd_game_dispatcher.h
index 1cb828f7249..9f1d3073796 100644
--- a/engines/qdengine/qdcore/qd_game_dispatcher.h
+++ b/engines/qdengine/qdcore/qd_game_dispatcher.h
@@ -485,11 +485,11 @@ public:
return _game_title.c_str();
}
- void set_texts_database(const char *file_name) {
+ void set_texts_database(const Common::Path file_name) {
_texts_database = file_name;
}
- const char *texts_database() const {
- return _texts_database.c_str();
+ const Common::Path texts_database() const {
+ return _texts_database;
}
void set_cd_key(const char *key) {
@@ -623,7 +623,7 @@ private:
Common::String _startup_scene;
//! Файл Ñ ÑÑбÑиÑÑами.
- Common::String _texts_database;
+ Common::Path _texts_database;
//! Ðазвание игÑÑ.
Common::String _game_title;
diff --git a/engines/qdengine/qdcore/qd_game_object_static.cpp b/engines/qdengine/qdcore/qd_game_object_static.cpp
index c2f6e62fd0d..098b6d9bcd2 100644
--- a/engines/qdengine/qdcore/qd_game_object_static.cpp
+++ b/engines/qdengine/qdcore/qd_game_object_static.cpp
@@ -65,7 +65,7 @@ bool qdGameObjectStatic::load_script_body(const xml::tag *p) {
for (xml::tag::subtag_iterator it = p->subtags_begin(); it != p->subtags_end(); ++it) {
switch (it->ID()) {
case QDSCR_FILE:
- _sprite.set_file(Common::Path(it->data(), '\\').toString().c_str());
+ _sprite.set_file(Common::Path(it->data(), '\\'));
break;
}
}
diff --git a/engines/qdengine/qdcore/qd_game_scene.cpp b/engines/qdengine/qdcore/qd_game_scene.cpp
index e609a05a20e..e4af3b28fab 100644
--- a/engines/qdengine/qdcore/qd_game_scene.cpp
+++ b/engines/qdengine/qdcore/qd_game_scene.cpp
@@ -498,7 +498,7 @@ void qdGameScene::debug_redraw() {
if (qdGameDispatcher *dp = qdGameDispatcher::get_dispatcher()) {
if (dp->current_music()) {
- grDispatcher::instance()->drawText(10, 130, grDispatcher::instance()->make_rgb888(255, 255, 255), dp->current_music()->file_name());
+ grDispatcher::instance()->drawText(10, 130, grDispatcher::instance()->make_rgb888(255, 255, 255), dp->current_music()->file_name().toString().c_str());
}
}
diff --git a/engines/qdengine/qdcore/qd_interface_element_state_mode.cpp b/engines/qdengine/qdcore/qd_interface_element_state_mode.cpp
index fee9ad9ee24..cac5ce0bb00 100644
--- a/engines/qdengine/qdcore/qd_interface_element_state_mode.cpp
+++ b/engines/qdengine/qdcore/qd_interface_element_state_mode.cpp
@@ -103,7 +103,7 @@ bool qdInterfaceElementStateMode::load_script(const xml::tag *p) {
for (xml::tag::subtag_iterator it = p->subtags_begin(); it != p->subtags_end(); ++it) {
switch (it->ID()) {
case QDSCR_SOUND:
- set_sound_file(it->data());
+ set_sound_file(Common::Path(it->data(), '\\'));
break;
case QDSCR_INTERFACE_ANIMATION_FLAGS:
xml::tag_buffer(*it) > _animation_flags;
diff --git a/engines/qdengine/qdcore/qd_inventory_cell.cpp b/engines/qdengine/qdcore/qd_inventory_cell.cpp
index 311013e0ec9..9704b9c2546 100644
--- a/engines/qdengine/qdcore/qd_inventory_cell.cpp
+++ b/engines/qdengine/qdcore/qd_inventory_cell.cpp
@@ -50,7 +50,7 @@ bool qdInventoryCellType::load_script(const xml::tag *p) {
set_type(xml::tag_buffer(*it).get_int());
break;
case QDSCR_FILE:
- _sprite.set_file(Common::Path(it->data(), '\\').toString().c_str());
+ _sprite.set_file(Common::Path(it->data(), '\\'));
break;
}
}
diff --git a/engines/qdengine/qdcore/qd_music_track.cpp b/engines/qdengine/qdcore/qd_music_track.cpp
index 6dce329ef56..4e583cfc6e1 100644
--- a/engines/qdengine/qdcore/qd_music_track.cpp
+++ b/engines/qdengine/qdcore/qd_music_track.cpp
@@ -70,7 +70,7 @@ bool qdMusicTrack::load_script(const xml::tag *p) {
toggle_cycle(false);
break;
case QDSCR_FILE:
- set_file_name(Common::Path(it->data(), '\\').toString().c_str());
+ set_file_name(Common::Path(it->data(), '\\'));
break;
case QDSCR_SOUND_VOLUME:
set_volume(xml::tag_buffer(*it).get_int());
@@ -93,7 +93,7 @@ bool qdMusicTrack::save_script(Common::WriteStream &fh, int indent) const {
fh.writeString(Common::String::format(" flags=\"%d\"", flags()));
if (!_file_name.empty()) {
- fh.writeString(Common::String::format(" file=\"%s\"", qdscr_XML_string(_file_name.c_str())));
+ fh.writeString(Common::String::format(" file=\"%s\"", qdscr_XML_string(_file_name.toString('\\'))));
}
if (is_cycled()) {
diff --git a/engines/qdengine/qdcore/qd_music_track.h b/engines/qdengine/qdcore/qd_music_track.h
index 07dd0fce2fe..0325e9f0bcc 100644
--- a/engines/qdengine/qdcore/qd_music_track.h
+++ b/engines/qdengine/qdcore/qd_music_track.h
@@ -52,11 +52,11 @@ public:
return QD_NAMED_OBJECT_MUSIC_TRACK;
}
- void set_file_name(const char *fname) {
+ void set_file_name(const Common::Path fname) {
_file_name = fname;
}
- const char *file_name() const {
- return _file_name.c_str();
+ const Common::Path file_name() const {
+ return _file_name;
}
bool has_file_name() const {
return !_file_name.empty();
@@ -89,7 +89,7 @@ public:
private:
//! ÐÐ¼Ñ mp+ Ñайла.
- Common::String _file_name;
+ Common::Path _file_name;
//! ÐÑомкоÑÑÑ, [0, 256].
int _volume;
diff --git a/engines/qdengine/qdcore/qd_sound.cpp b/engines/qdengine/qdcore/qd_sound.cpp
index 65b825fbd86..435e76e7e4f 100644
--- a/engines/qdengine/qdcore/qd_sound.cpp
+++ b/engines/qdengine/qdcore/qd_sound.cpp
@@ -64,7 +64,7 @@ void qdSound::load_script(const xml::tag *p) {
set_name(it->data());
break;
case QDSCR_FILE:
- set_file_name(Common::Path(it->data(), '\\').toString().c_str());
+ set_file_name(Common::Path(it->data(), '\\'));
break;
case QDSCR_SOUND_VOLUME:
xml::tag_buffer(*it) > _volume;
diff --git a/engines/qdengine/qdcore/qd_video.cpp b/engines/qdengine/qdcore/qd_video.cpp
index 51b228bce3e..806250f6bf0 100644
--- a/engines/qdengine/qdcore/qd_video.cpp
+++ b/engines/qdengine/qdcore/qd_video.cpp
@@ -75,7 +75,7 @@ bool qdVideo::load_script(const xml::tag *p) {
set_CD_info(xml::tag_buffer(*it).get_uint());
break;
case QDSCR_FILE:
- set_file_name(Common::Path(it->data(), '\\').toString().c_str());
+ set_file_name(Common::Path(it->data(), '\\'));
break;
case QDSCR_VIDEO_POSITION:
xml::tag_buffer(*it) > v.x > v.y;
diff --git a/engines/qdengine/system/graphics/gr_font.cpp b/engines/qdengine/system/graphics/gr_font.cpp
index df2993cfc8f..37b25de71ad 100644
--- a/engines/qdengine/system/graphics/gr_font.cpp
+++ b/engines/qdengine/system/graphics/gr_font.cpp
@@ -43,15 +43,15 @@ grFont::~grFont() {
delete _alpha_buffer;
}
-bool grFont::load(const char *fname) {
- Common::String str(fname);
+bool grFont::load(const Common::Path fname) {
+ Common::String str(fname.toString());
str += ".tga";
Common::File file;
- file.open(Common::Path(str, '\\'));
+ file.open(Common::Path(str));
if (load_alpha(&file)) {
- str = fname;
+ str = fname.toString();
str += ".idx";
file.open(Common::Path(str));
diff --git a/engines/qdengine/system/graphics/gr_font.h b/engines/qdengine/system/graphics/gr_font.h
index 17ad3b29006..87924466d77 100644
--- a/engines/qdengine/system/graphics/gr_font.h
+++ b/engines/qdengine/system/graphics/gr_font.h
@@ -22,6 +22,7 @@
#ifndef QDENGINE_SYSTEM_GRAPHICS_GR_FONT_H
#define QDENGINE_SYSTEM_GRAPHICS_GR_FONT_H
+#include "common/path.h"
#include "qdengine/system/graphics/gr_screen_region.h"
namespace Common {
@@ -35,7 +36,7 @@ public:
grFont();
~grFont();
- bool load(const char *fname);
+ bool load(const Common::Path fname);
bool load_index(Common::SeekableReadStream *fh);
bool load_alpha(Common::SeekableReadStream *fh);
More information about the Scummvm-git-logs
mailing list