aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-06-22 18:56:10 +0200
committerEinar Johan Trøan Sømåen2012-06-22 18:56:10 +0200
commit2e34a25040c4f95e62ce899be5521d7e5e76d095 (patch)
tree54cd8b38e55f559dc58e873a942e96c9877a47b6
parent853e7c8900c1cee8e6f44119f0440ce743c9bb08 (diff)
downloadscummvm-rg350-2e34a25040c4f95e62ce899be5521d7e5e76d095.tar.gz
scummvm-rg350-2e34a25040c4f95e62ce899be5521d7e5e76d095.tar.bz2
scummvm-rg350-2e34a25040c4f95e62ce899be5521d7e5e76d095.zip
WINTERMUTE: Get rid of the global constructions.
-rw-r--r--engines/wintermute/module.mk4
-rw-r--r--engines/wintermute/persistent.cpp169
-rw-r--r--engines/wintermute/persistent.h4
-rw-r--r--engines/wintermute/wintermute.cpp1
4 files changed, 176 insertions, 2 deletions
diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk
index 6c263ede22..4fe22fc795 100644
--- a/engines/wintermute/module.mk
+++ b/engines/wintermute/module.mk
@@ -47,6 +47,7 @@ MODULE_OBJS := \
Base/BBase.o \
Base/BDebugger.o \
Base/BDynBuffer.o \
+ Base/BEvent.o \
Base/BFader.o \
Base/BFileEntry.o \
Base/BFileManager.o \
@@ -116,7 +117,8 @@ MODULE_OBJS := \
video/VidPlayer.o \
video/VidTheoraPlayer.o \
video/decoders/theora_decoder.o \
- wintermute.o
+ wintermute.o \
+ persistent.o
MODULE_DIRS += \
engines/wintermute
diff --git a/engines/wintermute/persistent.cpp b/engines/wintermute/persistent.cpp
new file mode 100644
index 0000000000..347d0e822d
--- /dev/null
+++ b/engines/wintermute/persistent.cpp
@@ -0,0 +1,169 @@
+/* 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.
+ *
+ */
+
+/*
+ * This file is based on WME Lite.
+ * http://dead-code.org/redir.php?target=wmelite
+ * Copyright (c) 2011 Jan Nedoma
+ */
+
+#include "engines/wintermute/Ad/AdActor.h"
+#include "engines/wintermute/Ad/AdEntity.h"
+#include "engines/wintermute/Ad/AdGame.h"
+#include "engines/wintermute/Ad/AdInventory.h"
+#include "engines/wintermute/Ad/AdInventoryBox.h"
+#include "engines/wintermute/Ad/AdItem.h"
+#include "engines/wintermute/Ad/AdLayer.h"
+#include "engines/wintermute/Ad/AdNodeState.h"
+#include "engines/wintermute/Ad/AdObject.h"
+#include "engines/wintermute/Ad/AdPath.h"
+#include "engines/wintermute/Ad/AdPathPoint.h"
+#include "engines/wintermute/Ad/AdRegion.h"
+#include "engines/wintermute/Ad/AdResponse.h"
+#include "engines/wintermute/Ad/AdResponseBox.h"
+#include "engines/wintermute/Ad/AdResponseContext.h"
+#include "engines/wintermute/Ad/AdRotLevel.h"
+#include "engines/wintermute/Ad/AdScaleLevel.h"
+#include "engines/wintermute/Ad/AdScene.h"
+#include "engines/wintermute/Ad/AdSceneNode.h"
+#include "engines/wintermute/Ad/AdSceneState.h"
+#include "engines/wintermute/Ad/AdSentence.h"
+#include "engines/wintermute/Ad/AdSpriteSet.h"
+#include "engines/wintermute/Ad/AdTalkDef.h"
+#include "engines/wintermute/Ad/AdTalkHolder.h"
+#include "engines/wintermute/Ad/AdTalkNode.h"
+#include "engines/wintermute/Ad/AdWaypointGroup.h"
+#include "engines/wintermute/Base/BEvent.h"
+#include "engines/wintermute/Base/BFader.h"
+#include "engines/wintermute/Base/BFontBitmap.h"
+#include "engines/wintermute/Base/BFontStorage.h"
+#include "engines/wintermute/Base/BFontTT.h"
+#include "engines/wintermute/Base/BFrame.h"
+#include "engines/wintermute/Base/BGame.h"
+#include "engines/wintermute/Base/BKeyboardState.h"
+#include "engines/wintermute/Base/BObject.h"
+#include "engines/wintermute/Base/BPoint.h"
+#include "engines/wintermute/Base/BRegion.h"
+#include "engines/wintermute/Base/BScriptable.h"
+#include "engines/wintermute/Base/BScriptHolder.h"
+#include "engines/wintermute/Base/BSound.h"
+#include "engines/wintermute/Base/BSprite.h"
+#include "engines/wintermute/Base/BSubFrame.h"
+#include "engines/wintermute/Base/BViewport.h"
+#include "engines/wintermute/Base/scriptables/ScEngine.h"
+#include "engines/wintermute/Base/scriptables/ScScript.h"
+#include "engines/wintermute/Base/scriptables/ScStack.h"
+#include "engines/wintermute/Base/scriptables/ScValue.h"
+#include "engines/wintermute/Base/scriptables/SXArray.h"
+#include "engines/wintermute/Base/scriptables/SXDate.h"
+#include "engines/wintermute/Base/scriptables/SXFile.h"
+#include "engines/wintermute/Base/scriptables/SXMath.h"
+#include "engines/wintermute/Base/scriptables/SXMemBuffer.h"
+#include "engines/wintermute/Base/scriptables/SxObject.h"
+#include "engines/wintermute/Base/scriptables/SXStore.h"
+#include "engines/wintermute/Base/scriptables/SXString.h"
+#include "engines/wintermute/UI/UIButton.h"
+#include "engines/wintermute/UI/UIEdit.h"
+#include "engines/wintermute/UI/UIEntity.h"
+#include "engines/wintermute/UI/UIText.h"
+#include "engines/wintermute/UI/UITiledImage.h"
+#include "engines/wintermute/UI/UIWindow.h"
+#include "engines/wintermute/video/VidTheoraPlayer.h"
+
+#define REGISTER_CLASS(class_name, persistent_class)\
+ new WinterMute::CSysClass(class_name::_className, class_name::PersistBuild, class_name::PersistLoad, persistent_class);
+
+namespace WinterMute {
+
+void registerClasses() {
+ REGISTER_CLASS(CAdActor, false)
+ REGISTER_CLASS(CAdEntity, false)
+ REGISTER_CLASS(CAdGame, true)
+ REGISTER_CLASS(CAdInventory, false)
+ REGISTER_CLASS(CAdInventoryBox, false)
+ REGISTER_CLASS(CAdItem, false)
+ REGISTER_CLASS(CAdLayer, false)
+ REGISTER_CLASS(CAdNodeState, false)
+ REGISTER_CLASS(CAdObject, false)
+ REGISTER_CLASS(CAdPath, false)
+ REGISTER_CLASS(CAdPathPoint, false)
+ REGISTER_CLASS(CAdRegion, false)
+ REGISTER_CLASS(CAdResponse, false)
+ REGISTER_CLASS(CAdResponseBox, false)
+ REGISTER_CLASS(CAdResponseContext, false)
+ REGISTER_CLASS(CAdRotLevel, false)
+ REGISTER_CLASS(CAdScaleLevel, false)
+ REGISTER_CLASS(CAdScene, false)
+ REGISTER_CLASS(CAdSceneNode, false)
+ REGISTER_CLASS(CAdSceneState, false)
+ REGISTER_CLASS(CAdSentence, false)
+ REGISTER_CLASS(CAdSpriteSet, false)
+ REGISTER_CLASS(CAdTalkDef, false)
+ REGISTER_CLASS(CAdTalkHolder, false)
+ REGISTER_CLASS(CAdTalkNode, false)
+ REGISTER_CLASS(CAdWaypointGroup, false)
+
+ REGISTER_CLASS(CBEvent, false)
+ REGISTER_CLASS(CBFader, false)
+ REGISTER_CLASS(CBFont, false)
+ REGISTER_CLASS(CBFontBitmap, false)
+ REGISTER_CLASS(CBFontStorage, true)
+ REGISTER_CLASS(CBFontTT, false)
+ REGISTER_CLASS(CBFrame, false)
+ REGISTER_CLASS(CBGame, true)
+ REGISTER_CLASS(CBKeyboardState, false)
+ REGISTER_CLASS(CBObject, false)
+ REGISTER_CLASS(CBPoint, false)
+ REGISTER_CLASS(CBRegion, false)
+ REGISTER_CLASS(CBScriptable, false)
+ REGISTER_CLASS(CBScriptHolder, false)
+ REGISTER_CLASS(CBSound, false)
+ REGISTER_CLASS(CBSprite, false)
+ REGISTER_CLASS(CBSubFrame, false)
+
+ REGISTER_CLASS(CBViewport, false)
+ REGISTER_CLASS(CPartEmitter, false)
+ REGISTER_CLASS(CScEngine, true)
+ REGISTER_CLASS(CScScript, false)
+ REGISTER_CLASS(CScStack, false)
+ REGISTER_CLASS(CScValue, false)
+ REGISTER_CLASS(CSXArray, false)
+ REGISTER_CLASS(CSXDate, false)
+ REGISTER_CLASS(CSXFile, false)
+ REGISTER_CLASS(CSXMath, true)
+ REGISTER_CLASS(CSXMemBuffer, false)
+ REGISTER_CLASS(CSXObject, false)
+ REGISTER_CLASS(CSXStore, false)
+ REGISTER_CLASS(CSXString, false)
+
+ REGISTER_CLASS(CUIButton, false)
+ REGISTER_CLASS(CUIEdit, false)
+ REGISTER_CLASS(CUIEntity, false)
+ REGISTER_CLASS(CUIObject, false)
+ REGISTER_CLASS(CUIText, false)
+ REGISTER_CLASS(CUITiledImage, false)
+ REGISTER_CLASS(CUIWindow, false)
+ REGISTER_CLASS(CVidTheoraPlayer, false)
+ warning("TODO: Clean this up at some proper time");
+}
+
+}
diff --git a/engines/wintermute/persistent.h b/engines/wintermute/persistent.h
index fc9c4d674c..f6da9cf293 100644
--- a/engines/wintermute/persistent.h
+++ b/engines/wintermute/persistent.h
@@ -71,7 +71,7 @@ namespace WinterMute {
return #class_name;\
}\
\
- CSysClass Register##class_name(class_name::_className, class_name::PersistBuild, class_name::PersistLoad, persistent_class);\
+ /*CSysClass Register##class_name(class_name::_className, class_name::PersistBuild, class_name::PersistLoad, persistent_class);*/\
\
void* class_name::operator new (size_t size){\
void* ret = ::operator new(size);\
@@ -87,6 +87,8 @@ namespace WinterMute {
#define TMEMBER(member_name) #member_name, &member_name
#define TMEMBER_INT(member_name) #member_name, (int*)&member_name
+void registerClasses();
+
} // end of namespace WinterMute
#endif // WINTERMUTE_PERSISTENT_H
diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp
index d2edf6d1f3..0cd3da2c6a 100644
--- a/engines/wintermute/wintermute.cpp
+++ b/engines/wintermute/wintermute.cpp
@@ -138,6 +138,7 @@ Common::Error WinterMuteEngine::run() {
int WinterMuteEngine::init() {
char argv[1] = { ' ' };
int argc = 0;
+ registerClasses(); // Needs to be done before the first WME class is instantiated
_game = new CAdGame;
if (!_game) return 1;
CBPlatform::Initialize(_game, 0, NULL);