[Scummvm-git-logs] scummvm master -> eb675ecf2fd77682a09b862c40afea8eb996b1f2

dreammaster dreammaster at scummvm.org
Fri Sep 23 02:25:24 CEST 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
eb675ecf2f XEEN: Create WorldOfXeenResources class for their specific strings


Commit: eb675ecf2fd77682a09b862c40afea8eb996b1f2
    https://github.com/scummvm/scummvm/commit/eb675ecf2fd77682a09b862c40afea8eb996b1f2
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-09-22T20:24:18-04:00

Commit Message:
XEEN: Create WorldOfXeenResources class for their specific strings

Some strings are still in the base Resources, since they're referred
to by core dialogs. These may be able to be refactored in the future
as support is added for the other games

Changed paths:
  A engines/xeen/worldofxeen/worldofxeen_resources.cpp
  A engines/xeen/worldofxeen/worldofxeen_resources.h
    engines/xeen/module.mk
    engines/xeen/resources.cpp
    engines/xeen/resources.h
    engines/xeen/worldofxeen/clouds_cutscenes.cpp
    engines/xeen/worldofxeen/darkside_cutscenes.cpp
    engines/xeen/xeen.cpp



diff --git a/engines/xeen/module.mk b/engines/xeen/module.mk
index 968a30c..400e273 100644
--- a/engines/xeen/module.mk
+++ b/engines/xeen/module.mk
@@ -4,6 +4,7 @@ MODULE_OBJS := \
 	worldofxeen/clouds_cutscenes.o \
 	worldofxeen/darkside_cutscenes.o \
 	worldofxeen/worldofxeen.o \
+	worldofxeen/worldofxeen_resources.o \
 	character.o \
 	combat.o \
 	cutscenes.o \
diff --git a/engines/xeen/resources.cpp b/engines/xeen/resources.cpp
index e3d720c..b2d8c6d 100644
--- a/engines/xeen/resources.cpp
+++ b/engines/xeen/resources.cpp
@@ -23,11 +23,23 @@
 #include "common/scummsys.h"
 #include "xeen/resources.h"
 #include "xeen/files.h"
+#include "xeen/xeen.h"
+#include "xeen/worldofxeen/worldofxeen_resources.h"
 
 namespace Xeen {
 
 Resources *g_resources;
 
+Resources *Resources::init(XeenEngine *vm) {
+	if (vm->getGameID() == GType_Clouds || vm->getGameID() == GType_DarkSide
+		|| vm->getGameID() == GType_WorldOfXeen)
+		g_resources = new WorldOfXeen::WorldOfXeenResources();
+	else
+		g_resources = new Resources();
+
+	return g_resources;
+}
+
 Resources::Resources() {
 	g_resources = this;
 	_globalSprites.load("global.icn");
@@ -1591,37 +1603,4 @@ const char *const Resources::EVENT_SAMPLES[6] = {
 	"ahh.voc", "whereto.voc", "gulp.voc", "null.voc", "scream.voc", "laff1.voc"
 };
 
-const char *const Resources::CLOUDS_INTRO1 = "\xC" "00\xB" "082\x9" "040\x3"
-	"cKing Burlock\xB" "190\x9" "040Peasants\xB" "082\x9" "247"
-	"Lord Xeen\xB" "190\x9" "258Xeen's Pet\xB" "179\x9" "150Crodo";
-
-const char *const Resources::DARKSIDE_ENDING1 = "\n\x3" "cCongratulations\n"
-	"\n"
-	"Your Final Score is:\n"
-	"\n"
-	"%010lu\n"
-	"\x3" "l\n"
-	"Please send this score to the Ancient's Headquarters "
-	"where you'll be added to the Hall of Legends!\n"
-	"\n"
-	"Ancient's Headquarters\n"
-	"New World Computing, Inc.\n"
-	"P.O. Box 4302\n"
-	"Hollywood, CA 90078";
-
-const char *const Resources::DARKSIDE_ENDING2 = "\n"
-	"Adventurers,\n"
-	"\n"
-	"I have saved your game in Castleview.\n"
-	"\n"
-	"The World of Xeen still needs you!\n"
-	"\n"
-	"Load your game and come visit me in the Great Pyramid "
-	"for further instructions";
-
-const char *const Resources::PHAROAH_ENDING_TEXT1 = "\xC" "d\xB"
-	"001\x9" "001%s\x3" "c\x9" "000\xB" "180Press a Key!\x3" "l";
-const char *const Resources::PHAROAH_ENDING_TEXT2 = "\xC" "04\xB"
-	"000\x9" "000%s\x3" "c\x9" "000\xB" "180Press a Key!\x3" "l\xC" "d";
-
 } // End of namespace Xeen
diff --git a/engines/xeen/resources.h b/engines/xeen/resources.h
index 232de88..1ca6c62 100644
--- a/engines/xeen/resources.h
+++ b/engines/xeen/resources.h
@@ -33,7 +33,11 @@ namespace Xeen {
 
 #define Res (*g_resources)
 
+class XeenEngine;
+
 class Resources {
+protected:
+	Resources();
 public:
 	SpriteResource _globalSprites;
 	Common::StringArray _maeNames;		// Magic and equipment names
@@ -338,13 +342,11 @@ public:
 	static const char *const MONSTER_SPECIAL_ATTACKS[23];
 	static const char *const IDENTIFY_MONSTERS;
 	static const char *const EVENT_SAMPLES[6];
-	static const char *const CLOUDS_INTRO1;
-	static const char *const DARKSIDE_ENDING1;
-	static const char *const DARKSIDE_ENDING2;
-	static const char *const PHAROAH_ENDING_TEXT1;
-	static const char *const PHAROAH_ENDING_TEXT2;
 public:
-	Resources();
+	/**
+	 * Initializes an instnace of the resources
+	 */
+	static Resources *init(XeenEngine *vm);
 };
 
 extern Resources *g_resources;
diff --git a/engines/xeen/worldofxeen/clouds_cutscenes.cpp b/engines/xeen/worldofxeen/clouds_cutscenes.cpp
index 2c8d5f0..74fabe5 100644
--- a/engines/xeen/worldofxeen/clouds_cutscenes.cpp
+++ b/engines/xeen/worldofxeen/clouds_cutscenes.cpp
@@ -21,7 +21,7 @@
  */
 
 #include "xeen/worldofxeen/clouds_cutscenes.h"
-#include "xeen/resources.h"
+#include "xeen/worldofxeen/worldofxeen_resources.h"
 #include "xeen/sound.h"
 
 namespace Xeen {
diff --git a/engines/xeen/worldofxeen/darkside_cutscenes.cpp b/engines/xeen/worldofxeen/darkside_cutscenes.cpp
index f3bae10..e40fee6 100644
--- a/engines/xeen/worldofxeen/darkside_cutscenes.cpp
+++ b/engines/xeen/worldofxeen/darkside_cutscenes.cpp
@@ -20,11 +20,11 @@
  *
  */
 
-#include "xeen/worldofxeen/darkside_cutscenes.h"
-#include "xeen/worldofxeen/worldofxeen.h"
-#include "xeen/resources.h"
 #include "xeen/sound.h"
 #include "xeen/xeen.h"
+#include "xeen/worldofxeen/darkside_cutscenes.h"
+#include "xeen/worldofxeen/worldofxeen.h"
+#include "xeen/worldofxeen/worldofxeen_resources.h"
 
 namespace Xeen {
 namespace WorldOfXeen {
diff --git a/engines/xeen/worldofxeen/worldofxeen_resources.cpp b/engines/xeen/worldofxeen/worldofxeen_resources.cpp
new file mode 100644
index 0000000..fec3015
--- /dev/null
+++ b/engines/xeen/worldofxeen/worldofxeen_resources.cpp
@@ -0,0 +1,62 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "xeen/worldofxeen/worldofxeen_resources.h"
+
+namespace Xeen {
+namespace WorldOfXeen {
+
+const char *const WorldOfXeenResources::CLOUDS_INTRO1 = "\xC" "00\xB" "082\x9" "040\x3"
+	"cKing Burlock\xB" "190\x9" "040Peasants\xB" "082\x9" "247"
+	"Lord Xeen\xB" "190\x9" "258Xeen's Pet\xB" "179\x9" "150Crodo";
+
+const char *const WorldOfXeenResources::DARKSIDE_ENDING1 = "\n\x3" "cCongratulations\n"
+	"\n"
+	"Your Final Score is:\n"
+	"\n"
+	"%010lu\n"
+	"\x3" "l\n"
+	"Please send this score to the Ancient's Headquarters "
+	"where you'll be added to the Hall of Legends!\n"
+	"\n"
+	"Ancient's Headquarters\n"
+	"New World Computing, Inc.\n"
+	"P.O. Box 4302\n"
+	"Hollywood, CA 90078";
+
+const char *const WorldOfXeenResources::DARKSIDE_ENDING2 = "\n"
+	"Adventurers,\n"
+	"\n"
+	"I have saved your game in Castleview.\n"
+	"\n"
+	"The World of Xeen still needs you!\n"
+	"\n"
+	"Load your game and come visit me in the Great Pyramid "
+	"for further instructions";
+
+const char *const WorldOfXeenResources::PHAROAH_ENDING_TEXT1 = "\xC" "d\xB"
+	"001\x9" "001%s\x3" "c\x9" "000\xB" "180Press a Key!\x3" "l";
+const char *const WorldOfXeenResources::PHAROAH_ENDING_TEXT2 = "\xC" "04\xB"
+	"000\x9" "000%s\x3" "c\x9" "000\xB" "180Press a Key!\x3" "l\xC" "d";
+
+} // End of namespace WorldOfXeen
+} // End of namespace Xeen
diff --git a/engines/xeen/worldofxeen/worldofxeen_resources.h b/engines/xeen/worldofxeen/worldofxeen_resources.h
new file mode 100644
index 0000000..18a8df6
--- /dev/null
+++ b/engines/xeen/worldofxeen/worldofxeen_resources.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef XEEN_WORLDOFXEEN_RESOURCES_H
+#define XEEN_WORLDOFXEEN_RESOURCES_H
+
+#include "xeen/resources.h"
+
+namespace Xeen {
+namespace WorldOfXeen {
+
+#ifdef Res
+#undef Res
+#endif
+#define Res (*(WorldOfXeenResources *)g_resources)
+
+class WorldOfXeenResources : public Resources {
+public:
+	static const char *const CLOUDS_INTRO1;
+	static const char *const DARKSIDE_ENDING1;
+	static const char *const DARKSIDE_ENDING2;
+	static const char *const PHAROAH_ENDING_TEXT1;
+	static const char *const PHAROAH_ENDING_TEXT2;
+};
+
+extern Resources *g_resources;
+
+} // End of namespace WorldOfXeen
+} // End of namespace Xeen
+
+#endif	/* XEEN_RESOURCES_H */
diff --git a/engines/xeen/xeen.cpp b/engines/xeen/xeen.cpp
index a04ab80..493ffbf 100644
--- a/engines/xeen/xeen.cpp
+++ b/engines/xeen/xeen.cpp
@@ -89,7 +89,7 @@ XeenEngine::~XeenEngine() {
 void XeenEngine::initialize() {
 	// Create sub-objects of the engine
 	_files = new FileManager(this);
-	_resources = new Resources();
+	_resources = Resources::init(this);
 	_combat = new Combat(this);
 	_debugger = new Debugger(this);
 	_events = new EventsManager(this);





More information about the Scummvm-git-logs mailing list