From c609c778cceeaa6a70cf147451d7d894d76e40e7 Mon Sep 17 00:00:00 2001 From: Einar Johan Trøan Sømåen Date: Tue, 6 Mar 2012 03:59:28 +0100 Subject: WINTERMUTE: Add most of the B-classes to module.mk --- engines/wintermute/BFrame.cpp | 24 ++++++------ engines/wintermute/BGame.cpp | 56 +++++++++++++-------------- engines/wintermute/BGame.h | 28 +++++++++----- engines/wintermute/BKeyboardState.cpp | 4 +- engines/wintermute/BRegion.cpp | 20 +++++----- engines/wintermute/BRegion.h | 4 +- engines/wintermute/BScriptHolder.h | 9 +++-- engines/wintermute/BSprite.cpp | 32 ++++++++-------- engines/wintermute/BSprite.h | 4 +- engines/wintermute/BSubFrame.cpp | 21 +++++----- engines/wintermute/Vector2.cpp | 52 +++++++++++++++++++++++++ engines/wintermute/Vector2.h | 72 +++++++++++++++++++++++++++++++++++ engines/wintermute/module.mk | 27 +++++++++++++ 13 files changed, 257 insertions(+), 96 deletions(-) create mode 100644 engines/wintermute/Vector2.cpp create mode 100644 engines/wintermute/Vector2.h diff --git a/engines/wintermute/BFrame.cpp b/engines/wintermute/BFrame.cpp index 4d8d557a2a..4778a2f4b8 100644 --- a/engines/wintermute/BFrame.cpp +++ b/engines/wintermute/BFrame.cpp @@ -26,18 +26,18 @@ * Copyright (c) 2011 Jan Nedoma */ -#include "dcgf.h" -#include "BParser.h" -#include "BFrame.h" -#include "BGame.h" -#include "BDynBuffer.h" -#include "ScValue.h" -#include "BSoundMgr.h" -#include "BSound.h" -#include "BSubFrame.h" -#include "ScScript.h" -#include "ScStack.h" -#include "PlatformSDL.h" +#include "engines/wintermute/dcgf.h" +#include "engines/wintermute/BParser.h" +#include "engines/wintermute/BFrame.h" +#include "engines/wintermute/BGame.h" +#include "engines/wintermute/BDynBuffer.h" +#include "engines/wintermute/BSoundMgr.h" +#include "engines/wintermute/BSound.h" +#include "engines/wintermute/BSubFrame.h" +#include "engines/wintermute/PlatformSDL.h" +#include "engines/wintermute/scriptables/ScValue.h" +#include "engines/wintermute/scriptables/ScScript.h" +#include "engines/wintermute/scriptables/ScStack.h" #include "common/str.h" namespace WinterMute { diff --git a/engines/wintermute/BGame.cpp b/engines/wintermute/BGame.cpp index 2c58641c33..319e0c5316 100644 --- a/engines/wintermute/BGame.cpp +++ b/engines/wintermute/BGame.cpp @@ -26,44 +26,44 @@ * Copyright (c) 2011 Jan Nedoma */ +#include #include "dcgf.h" #include "BGame.h" #include "BFile.h" -#include "BRegistry.h" -#include "BRenderSDL.h" -#include "BSurfaceSDL.h" -#include "BQuickMsg.h" -#include "scriptables/SXString.h" -#include "scriptables/SXDate.h" -#include "scriptables/SXArray.h" -#include "SxObject.h" -#include "scriptables/SXMemBuffer.h" -#include "SXFile.h" -#include "SXMath.h" -#include "SXStore.h" -#include "PathUtil.h" -#include -#include "crc.h" -#include "StringUtil.h" -#include "BParser.h" +#include "BFileManager.h" +#include "BFontTT.h" +#include "BFontStorage.h" #include "BImage.h" -#include "BTransitionMgr.h" #include "BKeyboardState.h" -#include "UIWindow.h" -#include "ScValue.h" -#include "BSoundMgr.h" +#include "BParser.h" +#include "BQuickMsg.h" +#include "BRegistry.h" +#include "BRenderSDL.h" #include "BSound.h" +#include "BSoundMgr.h" +#include "BSprite.h" #include "BSubFrame.h" +#include "BSurfaceSDL.h" +#include "BTransitionMgr.h" #include "BViewport.h" -#include "BFontStorage.h" -#include "BFontTT.h" -#include "ScEngine.h" #include "BStringTable.h" -#include "ScScript.h" #include "BRegion.h" -#include "BSprite.h" -#include "BFileManager.h" -#include "ScStack.h" +#include "crc.h" +#include "PathUtil.h" +#include "StringUtil.h" +#include "UIWindow.h" +#include "scriptables/ScValue.h" +#include "scriptables/ScEngine.h" +#include "scriptables/ScStack.h" +#include "scriptables/ScScript.h" +#include "scriptables/SXArray.h" +#include "scriptables/SXDate.h" +#include "scriptables/SXString.h" +#include "scriptables/SXMemBuffer.h" +#include "scriptables/SxObject.h" +#include "scriptables/SXFile.h" +#include "scriptables/SXMath.h" +#include "scriptables/SXStore.h" #include "common/textconsole.h" #ifdef __IPHONEOS__ diff --git a/engines/wintermute/BGame.h b/engines/wintermute/BGame.h index b3df2b3046..2af7d834b1 100644 --- a/engines/wintermute/BGame.h +++ b/engines/wintermute/BGame.h @@ -55,6 +55,7 @@ class CUIWindow; class CBViewport; class CBRenderer; class CBRegistry; +class CBSaveThumbHelper; class CBSurfaceStorage; class CSXStore; class CSXMath; @@ -94,7 +95,7 @@ public: void GetMousePos(POINT *Pos); RECT m_MouseLockRect; - +#endif bool m_ShuttingDown; virtual HRESULT DisplayDebugInfo(); @@ -102,7 +103,7 @@ public: bool m_SuspendedRendering; int m_SoundBufferSizeSec; - +#if 0 TTextEncoding m_TextEncoding; bool m_TextRTL; @@ -153,7 +154,7 @@ public: void *m_EngineLogCallbackData; #endif bool m_EditorMode; -#if 0 + bool m_DoNotExpandStrings; void GetOffset(int *OffsetX, int *OffsetY); void SetOffset(int OffsetX, int OffsetY); @@ -163,19 +164,23 @@ public: float m_OffsetPercentX; float m_OffsetPercentY; CBObject *m_MainObject; +#if 0 HRESULT InitInput(HINSTANCE hInst, HWND hWnd); HRESULT InitLoop(); +#endif uint32 m_CurrentTime; uint32 m_DeltaTime; +#if 0 CBFont *m_SystemFont; CBFont *m_VideoFont; +#endif HRESULT Initialize1(); HRESULT Initialize2(); HRESULT Initialize3(); CBFileManager *m_FileManager; CBTransitionMgr *m_TransMgr; -#endif //TODO: STUB CBDebugger *GetDebugMgr(); +//TODO: STUB void LOG(HRESULT res, LPCSTR fmt, ...) {} CBRenderer *m_Renderer; @@ -186,12 +191,13 @@ public: CBSurfaceStorage *m_SurfaceStorage; CBFontStorage *m_FontStorage; CBGame(); -#if 0 + virtual ~CBGame(); void DEBUG_DebugDisable(); void DEBUG_DebugEnable(const char *Filename = NULL); bool m_DEBUG_DebugMode; bool m_DEBUG_AbsolutePathWarning; +#if 0 FILE *m_DEBUG_LogFile; int m_Sequence; virtual HRESULT LoadFile(const char *Filename); @@ -249,7 +255,6 @@ public: int m_ScheduledLoadSlot; bool m_Loading; bool m_PersonalizedSave; -#if 0 HRESULT EmptySaveSlot(int Slot); bool IsSaveSlotUsed(int Slot); HRESULT GetSaveSlotDescription(int Slot, char *Buffer); @@ -258,6 +263,7 @@ public: virtual bool HandleMouseWheel(int Delta); bool m_Quitting; virtual HRESULT GetVersion(byte *VerMajor, byte *VerMinor, byte *ExtMajor, byte *ExtMinor); +#if 0 virtual bool HandleKeypress(SDL_Event *event); int m_FreezeLevel; HRESULT Unfreeze(); @@ -286,6 +292,7 @@ public: int m_MusicCrossfadeChannel1; int m_MusicCrossfadeChannel2; HRESULT DisplayWindows(bool InGame = false); +#endif CBRegistry *m_Registry; bool m_UseD3D; virtual HRESULT Cleanup(); @@ -293,7 +300,7 @@ public: virtual HRESULT LoadGame(char *Filename); virtual HRESULT SaveGame(int slot, char *desc, bool quickSave = false); virtual HRESULT ShowCursor(); -#endif + CBSprite *m_CursorNoninteractive; CBObject *m_ActiveObject; CBKeyboardState *m_KeyboardState; @@ -333,19 +340,20 @@ public: void SetInteractive(bool State); virtual HRESULT WindowLoadHook(CUIWindow *Win, char **Buf, char **Params); virtual HRESULT WindowScriptMethodHook(CUIWindow *Win, CScScript *Script, CScStack *Stack, char *Name); +#endif HRESULT GetCurrentViewportOffset(int *OffsetX = NULL, int *OffsetY = NULL); HRESULT GetCurrentViewportRect(RECT *Rect, bool *Custom = NULL); HRESULT PopViewport(); HRESULT PushViewport(CBViewport *Viewport); HRESULT SetActiveObject(CBObject *Obj); - +#if 0 CBSprite *m_LastCursor; HRESULT DrawCursor(CBSprite *Cursor); virtual HRESULT InitAfterLoad(); - +#endif CBSaveThumbHelper *m_CachedThumbnail; - +#if 0 AnsiString GetDataDir(); void AddMem(int bytes); diff --git a/engines/wintermute/BKeyboardState.cpp b/engines/wintermute/BKeyboardState.cpp index 7e89d9827c..055b2cf8c5 100644 --- a/engines/wintermute/BKeyboardState.cpp +++ b/engines/wintermute/BKeyboardState.cpp @@ -28,8 +28,8 @@ #include "dcgf.h" #include "BKeyboardState.h" -#include "ScValue.h" -#include "ScStack.h" +#include "engines/wintermute/scriptables/ScValue.h" +#include "engines/wintermute/scriptables/ScStack.h" namespace WinterMute { diff --git a/engines/wintermute/BRegion.cpp b/engines/wintermute/BRegion.cpp index 309d44edab..699e60c60f 100644 --- a/engines/wintermute/BRegion.cpp +++ b/engines/wintermute/BRegion.cpp @@ -26,16 +26,16 @@ * Copyright (c) 2011 Jan Nedoma */ -#include "dcgf.h" -#include "BRegion.h" -#include "BParser.h" -#include "BDynBuffer.h" -#include "ScValue.h" -#include "BGame.h" -#include "ScScript.h" -#include "ScStack.h" -#include "BFileManager.h" -#include "PlatformSDL.h" +#include "engines/wintermute/dcgf.h" +#include "engines/wintermute/BRegion.h" +#include "engines/wintermute/BParser.h" +#include "engines/wintermute/BDynBuffer.h" +#include "engines/wintermute/BGame.h" +#include "engines/wintermute/scriptables/ScScript.h" +#include "engines/wintermute/scriptables/ScStack.h" +#include "engines/wintermute/scriptables/ScValue.h" +#include "engines/wintermute/BFileManager.h" +#include "engines/wintermute/PlatformSDL.h" namespace WinterMute { diff --git a/engines/wintermute/BRegion.h b/engines/wintermute/BRegion.h index 94202ea8dd..a218e6874a 100644 --- a/engines/wintermute/BRegion.h +++ b/engines/wintermute/BRegion.h @@ -29,8 +29,8 @@ #ifndef WINTERMUTE_BREGION_H #define WINTERMUTE_BREGION_H -#include "BPoint.h" -#include "BObject.h" +#include "engines/wintermute/BPoint.h" +#include "engines/wintermute/BObject.h" namespace WinterMute { diff --git a/engines/wintermute/BScriptHolder.h b/engines/wintermute/BScriptHolder.h index 6f37461431..cece043b88 100644 --- a/engines/wintermute/BScriptHolder.h +++ b/engines/wintermute/BScriptHolder.h @@ -38,14 +38,15 @@ namespace WinterMute { class CBScriptHolder : public CBScriptable { public: DECLARE_PERSISTENT(CBScriptHolder, CBScriptable) -#if 0 + CBScriptHolder(CBGame *inGame); virtual ~CBScriptHolder(); - +#if 0 virtual CScScript *InvokeMethodThread(char *MethodName); virtual void MakeFreezable(bool Freezable); bool CanHandleEvent(char *EventName); virtual bool CanHandleMethod(char *EventMethod); +#endif HRESULT Cleanup(); HRESULT RemoveScript(CScScript *Script); HRESULT AddScript(char *Filename); @@ -54,12 +55,12 @@ public: HRESULT ApplyEvent(const char *EventName, bool Unbreakable = false); void SetFilename(char *Filename); HRESULT ParseProperty(byte *Buffer, bool Complete = true); - char *m_Filename; bool m_Freezable; bool m_Ready; - CBArray m_Scripts; + CBArray m_Scripts; +#if 0 // scripting interface virtual CScValue *ScGetProperty(char *Name); virtual HRESULT ScSetProperty(char *Name, CScValue *Value); diff --git a/engines/wintermute/BSprite.cpp b/engines/wintermute/BSprite.cpp index 912fe18f99..06ac69494b 100644 --- a/engines/wintermute/BSprite.cpp +++ b/engines/wintermute/BSprite.cpp @@ -26,22 +26,22 @@ * Copyright (c) 2011 Jan Nedoma */ -#include "dcgf.h" -#include "BSprite.h" -#include "StringUtil.h" -#include "PathUtil.h" -#include "BParser.h" -#include "BDynBuffer.h" -#include "ScValue.h" -#include "BSurface.h" -#include "BGame.h" -#include "BFrame.h" -#include "BSound.h" -#include "BSubFrame.h" -#include "ScScript.h" -#include "ScStack.h" -#include "BFileManager.h" -#include "PlatformSDL.h" +#include "engines/wintermute/dcgf.h" +#include "engines/wintermute/BSprite.h" +#include "engines/wintermute/StringUtil.h" +#include "engines/wintermute/PathUtil.h" +#include "engines/wintermute/BParser.h" +#include "engines/wintermute/BDynBuffer.h" +#include "engines/wintermute/BSurface.h" +#include "engines/wintermute/BGame.h" +#include "engines/wintermute/BFrame.h" +#include "engines/wintermute/BSound.h" +#include "engines/wintermute/BSubFrame.h" +#include "engines/wintermute/BFileManager.h" +#include "engines/wintermute/PlatformSDL.h" +#include "engines/wintermute/scriptables/ScValue.h" +#include "engines/wintermute/scriptables/ScScript.h" +#include "engines/wintermute/scriptables/ScStack.h" namespace WinterMute { diff --git a/engines/wintermute/BSprite.h b/engines/wintermute/BSprite.h index 01a89a6931..dd09fe0be1 100644 --- a/engines/wintermute/BSprite.h +++ b/engines/wintermute/BSprite.h @@ -30,8 +30,8 @@ #define WINTERMUTE_BSPRITE_H -#include "coll_templ.h" -#include "BScriptHolder.h" +#include "engines/wintermute/coll_templ.h" +#include "engines/wintermute/BScriptHolder.h" namespace WinterMute { class CBFrame; diff --git a/engines/wintermute/BSubFrame.cpp b/engines/wintermute/BSubFrame.cpp index 415bcc7b52..85f45156a0 100644 --- a/engines/wintermute/BSubFrame.cpp +++ b/engines/wintermute/BSubFrame.cpp @@ -26,16 +26,17 @@ * Copyright (c) 2011 Jan Nedoma */ -#include "dcgf.h" -#include "BParser.h" -#include "BSubFrame.h" -#include "BActiveRect.h" -#include "BDynBuffer.h" -#include "BSurface.h" -#include "ScValue.h" -#include "ScStack.h" -#include "BGame.h" -#include "PlatformSDL.h" +#include "engines/wintermute/dcgf.h" +#include "engines/wintermute/BParser.h" +#include "engines/wintermute/BSubFrame.h" +#include "engines/wintermute/BActiveRect.h" +#include "engines/wintermute/BDynBuffer.h" +#include "engines/wintermute/BSurface.h" +#include "engines/wintermute/BSurfaceStorage.h" +#include "engines/wintermute/BGame.h" +#include "engines/wintermute/PlatformSDL.h" +#include "engines/wintermute/scriptables/ScValue.h" +#include "engines/wintermute/scriptables/ScStack.h" namespace WinterMute { diff --git a/engines/wintermute/Vector2.cpp b/engines/wintermute/Vector2.cpp new file mode 100644 index 0000000000..6c8d0ae168 --- /dev/null +++ b/engines/wintermute/Vector2.cpp @@ -0,0 +1,52 @@ +/* +This file is part of WME Lite. +http://dead-code.org/redir.php?target=wmelite + +Copyright (c) 2011 Jan Nedoma + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include "Vector2.h" +#include + +namespace WinterMute { + +////////////////////////////////////////////////////////////////////////// +Vector2::Vector2() { + x = y = 0.0f; +} + +////////////////////////////////////////////////////////////////////////// +Vector2::Vector2(float x, float y) { + this->x = x; + this->y = y; +} + +////////////////////////////////////////////////////////////////////////// +Vector2::~Vector2() { +} + + +////////////////////////////////////////////////////////////////////////// +float Vector2::Length() const { + return sqrt(x * x + y * y); +} + +} // end of namespace WinterMute diff --git a/engines/wintermute/Vector2.h b/engines/wintermute/Vector2.h new file mode 100644 index 0000000000..032a6f270b --- /dev/null +++ b/engines/wintermute/Vector2.h @@ -0,0 +1,72 @@ +/* +This file is part of WME Lite. +http://dead-code.org/redir.php?target=wmelite + +Copyright (c) 2011 Jan Nedoma + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#ifndef __WmeVector2_H__ +#define __WmeVector2_H__ + +namespace WinterMute { + +class Vector2 { +public: + Vector2(); + Vector2(float x, float y); + ~Vector2(); + + float Length() const; + + inline Vector2 &operator= (const Vector2 &other) { + x = other.x; + y = other.y; + + return *this; + } + + inline Vector2 operator+ (const Vector2 &other) const { + return Vector2(x + other.x, y + other.y); + } + + inline Vector2 operator- (const Vector2 &other) const { + return Vector2(x - other.x, y - other.y); + } + + inline Vector2 operator* (const float scalar) const { + return Vector2(x * scalar, y * scalar); + } + + inline Vector2 &operator+= (const Vector2 &other) { + x += other.x; + y += other.y; + + return *this; + } + + + float x; + float y; +}; + +} // end of namespace WinterMute + +#endif // __WmeVector2_H__ diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk index a33861cd19..e6847eb585 100644 --- a/engines/wintermute/module.mk +++ b/engines/wintermute/module.mk @@ -8,14 +8,41 @@ MODULE_OBJS := \ scriptables/SXDate.o \ scriptables/SXMath.o \ scriptables/SXMemBuffer.o \ + BActiveRect.o \ + BDebugger.o \ + BDynBuffer.o \ BBase.o \ + BFader.o \ + BFile.o \ + BFileEntry.o \ + BFrame.o \ + BImage.o \ BNamedObject.o \ + BPackage.o \ BParser.o \ + BPersistMgr.o \ + BPoint.o \ + BQuickMsg.o \ + BRegion.o \ + BResources.o \ + BResourceFile.o \ + BSaveThumbFile.o \ BScriptable.o \ + BSound.o \ + BSoundBuffer.o \ + BSoundMgr.o \ + BSprite.o \ + BSubFrame.o \ + BSurfaceStorage.o \ + BTransitionMgr.o \ BViewport.o \ + ConvertUTF.o \ detection.o \ + PathUtil.o \ + StringUtil.o \ SysClass.o \ SysInstance.o \ + utils.o \ wintermute.o MODULE_DIRS += \ -- cgit v1.2.3