diff options
author | Einar Johan Trøan Sømåen | 2012-03-13 16:28:08 +0100 |
---|---|---|
committer | Einar Johan Trøan Sømåen | 2012-06-02 12:41:15 +0200 |
commit | 85adc3a3babd03d900dbeb70ec6faa7270d6e926 (patch) | |
tree | 420f9486876872e966b25609b17b1b479d2fed3c | |
parent | a7c12a7bd1729e3fc77cfab78a53e606521b484c (diff) | |
download | scummvm-rg350-85adc3a3babd03d900dbeb70ec6faa7270d6e926.tar.gz scummvm-rg350-85adc3a3babd03d900dbeb70ec6faa7270d6e926.tar.bz2 scummvm-rg350-85adc3a3babd03d900dbeb70ec6faa7270d6e926.zip |
WINTERMUTE: Add ScEngine, ScValue, SXStore, SXString, SXFile and PlatformSDL to build
-rw-r--r-- | engines/wintermute/AdObject.cpp | 10 | ||||
-rw-r--r-- | engines/wintermute/BFrame.cpp | 2 | ||||
-rw-r--r-- | engines/wintermute/PlatformSDL.cpp | 590 | ||||
-rw-r--r-- | engines/wintermute/StringUtil.cpp | 2 | ||||
-rw-r--r-- | engines/wintermute/module.mk | 5 | ||||
-rw-r--r-- | engines/wintermute/scriptables/SXArray.cpp | 2 | ||||
-rw-r--r-- | engines/wintermute/scriptables/SXDate.cpp | 20 | ||||
-rw-r--r-- | engines/wintermute/scriptables/SXDate.h | 2 | ||||
-rw-r--r-- | engines/wintermute/scriptables/SXFile.cpp | 22 | ||||
-rw-r--r-- | engines/wintermute/scriptables/SXMemBuffer.cpp | 4 | ||||
-rw-r--r-- | engines/wintermute/scriptables/SXStore.cpp | 14 | ||||
-rw-r--r-- | engines/wintermute/scriptables/SXString.cpp | 58 | ||||
-rw-r--r-- | engines/wintermute/scriptables/ScEngine.cpp | 52 | ||||
-rw-r--r-- | engines/wintermute/scriptables/ScValue.cpp | 30 | ||||
-rw-r--r-- | engines/wintermute/scriptables/ScValue.h | 8 | ||||
-rw-r--r-- | engines/wintermute/wintermute.cpp | 6 |
16 files changed, 721 insertions, 106 deletions
diff --git a/engines/wintermute/AdObject.cpp b/engines/wintermute/AdObject.cpp index 0e2a351ed4..6e59b9b45c 100644 --- a/engines/wintermute/AdObject.cpp +++ b/engines/wintermute/AdObject.cpp @@ -260,7 +260,7 @@ HRESULT CAdObject::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th if (val->IsNULL()) Align = TAL_CENTER;
else Align = val->GetInt();
- Align = std::min(std::max(0, Align), NUM_TEXT_ALIGN - 1);
+ Align = MIN(MAX(0, Align), NUM_TEXT_ALIGN - 1);
char *Sound = SoundVal->IsNULL() ? NULL : SoundVal->GetString();
@@ -802,7 +802,7 @@ int CAdObject::GetHeight() { CBFrame *frame = m_CurrentSprite->m_Frames[m_CurrentSprite->m_CurrentFrame];
int ret = 0;
for (int i = 0; i < frame->m_Subframes.GetSize(); i++) {
- ret = std::max(ret, frame->m_Subframes[i]->m_HotspotY);
+ ret = MAX(ret, frame->m_Subframes[i]->m_HotspotY);
}
if (m_Zoomable) {
@@ -880,7 +880,7 @@ void CAdObject::Talk(char *Text, char *Sound, uint32 Duration, char *Stances, TT if (m_SubtitlesWidth > 0) width = m_SubtitlesWidth;
else {
if ((x < Game->m_Renderer->m_Width / 4 || x > Game->m_Renderer->m_Width * 0.75) && !Game->m_TouchInterface) {
- width = std::max(Game->m_Renderer->m_Width / 4, std::min(x * 2, (Game->m_Renderer->m_Width - x) * 2));
+ width = MAX(Game->m_Renderer->m_Width / 4, MIN(x * 2, (Game->m_Renderer->m_Width - x) * 2));
} else width = Game->m_Renderer->m_Width / 2;
}
@@ -898,8 +898,8 @@ void CAdObject::Talk(char *Text, char *Sound, uint32 Duration, char *Stances, TT x = x - width / 2;
- x = std::min(std::max(0, x), Game->m_Renderer->m_Width - width);
- y = std::min(std::max(0, y), Game->m_Renderer->m_Height - height);
+ x = MIN(MAX(0, x), Game->m_Renderer->m_Width - width);
+ y = MIN(MAX(0, y), Game->m_Renderer->m_Height - height);
m_Sentence->m_Width = width;
diff --git a/engines/wintermute/BFrame.cpp b/engines/wintermute/BFrame.cpp index 4778a2f4b8..37b263d505 100644 --- a/engines/wintermute/BFrame.cpp +++ b/engines/wintermute/BFrame.cpp @@ -655,7 +655,7 @@ HRESULT CBFrame::ScSetProperty(char *Name, CScValue *Value) { // Delay
//////////////////////////////////////////////////////////////////////////
if (strcmp(Name, "Delay") == 0) {
- m_Delay = std::max(0, Value->GetInt());
+ m_Delay = MAX(0, Value->GetInt());
return S_OK;
}
diff --git a/engines/wintermute/PlatformSDL.cpp b/engines/wintermute/PlatformSDL.cpp new file mode 100644 index 0000000000..1b55c1ca35 --- /dev/null +++ b/engines/wintermute/PlatformSDL.cpp @@ -0,0 +1,590 @@ +/*
+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 "engines/wintermute/dcgf.h"
+#include "engines/wintermute/BGame.h"
+#include "engines/wintermute/BRenderSDL.h"
+#include "engines/wintermute/PathUtil.h"
+#include "engines/wintermute/PlatformSDL.h"
+#include "engines/wintermute/BRegistry.h"
+#include "engines/wintermute/BSoundMgr.h"
+#include "engines/wintermute/scriptables/ScEngine.h"
+#include "common/str.h"
+#include "common/textconsole.h"
+
+#ifdef __WIN32__
+# include <dbghelp.h>
+# include <direct.h>
+#else
+# include <unistd.h>
+#endif
+
+
+namespace WinterMute {
+
+CBGame *CBPlatform::Game = NULL;
+
+
+#define CLASS_NAME "GF_FRAME"
+//////////////////////////////////////////////////////////////////////////
+int CBPlatform::Initialize(CBGame *inGame, int argc, char *argv[]) {
+ //setlocale(LC_CTYPE, "");
+
+ Game = inGame;
+ if (!Game) return 1;
+
+
+ bool windowedMode = true;
+
+
+ // parse command line
+ char *SaveGame = NULL;
+ char param[MAX_PATH];
+ for (int i = 0; i < argc; i++) {
+ strcpy(param, argv[i]);
+
+ if (scumm_stricmp(param, "-project") == 0) {
+ if (argc > i) strcpy(param, argv[i + 1]);
+ else param[0] = '\0';
+
+ if (strcmp(param, "") != 0) {
+ char *IniDir = CBUtils::GetPath(param);
+ char *IniName = CBUtils::GetFilename(param);
+
+ // switch to ini's dir
+ chdir(IniDir);
+
+ // set ini name
+ sprintf(param, "./%s", IniName);
+ Game->m_Registry->SetIniName(param);
+
+ delete [] IniDir;
+ delete [] IniName;
+ }
+ } else if (scumm_stricmp(param, "-windowed") == 0) windowedMode = true;
+ }
+
+
+ if (Game->m_Registry->ReadBool("Debug", "DebugMode")) Game->DEBUG_DebugEnable("./wme.log");
+
+ Game->m_DEBUG_ShowFPS = Game->m_Registry->ReadBool("Debug", "ShowFPS");
+
+ if (Game->m_Registry->ReadBool("Debug", "DisableSmartCache")) {
+ Game->LOG(0, "Smart cache is DISABLED");
+ Game->m_SmartCache = false;
+ }
+
+ bool AllowDirectDraw = Game->m_Registry->ReadBool("Debug", "AllowDirectDraw", false);
+
+ // load general game settings
+ Game->Initialize1();
+
+
+ if (FAILED(Game->LoadSettings("startup.settings"))) {
+ Game->LOG(0, "Error loading game settings.");
+ delete Game;
+ Game = NULL;
+
+#ifdef __WIN32__
+ ::MessageBox(NULL, "Some of the essential files are missing. Please reinstall.", NULL, MB_OK | MB_ICONERROR);
+#endif
+ return 2;
+ }
+
+ Game->Initialize2();
+
+ Game->GetDebugMgr()->OnGameInit();
+ Game->m_ScEngine->LoadBreakpoints();
+
+
+
+ HRESULT ret;
+
+ // initialize the renderer
+ ret = Game->m_Renderer->InitRenderer(Game->m_SettingsResWidth, Game->m_SettingsResHeight, windowedMode);
+ if (FAILED(ret)) {
+ Game->LOG(ret, "Error initializing renderer. Exiting.");
+
+ delete Game;
+ Game = NULL;
+ return 3;
+ }
+
+ Game->Initialize3();
+
+#ifdef __IPHONEOS__
+ SDL_AddEventWatch(CBPlatform::SDLEventWatcher, NULL);
+#endif
+
+ // initialize sound manager (non-fatal if we fail)
+ ret = Game->m_SoundMgr->Initialize();
+ if (FAILED(ret)) {
+ Game->LOG(ret, "Sound is NOT available.");
+ }
+
+
+ // load game
+ uint32 DataInitStart = GetTime();
+
+ if (FAILED(Game->LoadFile(Game->m_SettingsGameFile ? Game->m_SettingsGameFile : "default.game"))) {
+ Game->LOG(ret, "Error loading game file. Exiting.");
+ delete Game;
+ Game = NULL;
+ return false;
+ }
+ Game->SetWindowTitle();
+ Game->m_Renderer->m_Ready = true;
+ Game->m_MiniUpdateEnabled = true;
+
+ Game->LOG(0, "Engine initialized in %d ms", GetTime() - DataInitStart);
+ Game->LOG(0, "");
+
+
+ if (SaveGame) {
+ Game->LoadGame(SaveGame);
+ delete [] SaveGame;
+ }
+
+ // all set, ready to go
+ return 0;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+int CBPlatform::MessageLoop() {
+ bool done = false;
+
+ while (!done) {
+ SDL_Event event;
+ while (SDL_PollEvent(&event)) {
+ HandleEvent(&event);
+ }
+
+ if (Game && Game->m_Renderer->m_Active && Game->m_Renderer->m_Ready) {
+
+ Game->DisplayContent();
+ Game->DisplayQuickMsg();
+
+ Game->DisplayDebugInfo();
+
+ // ***** flip
+ if (!Game->m_SuspendedRendering) Game->m_Renderer->Flip();
+ if (Game->m_Loading) Game->LoadGame(Game->m_ScheduledLoadSlot);
+ }
+ if (Game->m_Quitting) break;
+
+ }
+
+ if (Game) {
+ // remember previous window position
+ /*
+ if(Game->m_Renderer && Game->m_Renderer->m_Windowed)
+ {
+ if(!::IsIconic(Game->m_Renderer->m_Window))
+ {
+ int PosX = Game->m_Renderer->m_WindowRect.left;
+ int PosY = Game->m_Renderer->m_WindowRect.top;
+ PosX -= Game->m_Renderer->m_MonitorRect.left;
+ PosY -= Game->m_Renderer->m_MonitorRect.top;
+
+ Game->m_Registry->WriteInt("Video", "WindowPosX", PosX);
+ Game->m_Registry->WriteInt("Video", "WindowPosY", PosY);
+ }
+ }
+ */
+
+ delete Game;
+ Game = NULL;
+ }
+ return 0;
+}
+
+//////////////////////////////////////////////////////////////////////////
+void CBPlatform::HandleEvent(SDL_Event *event) {
+ switch (event->type) {
+
+ case SDL_MOUSEBUTTONDOWN:
+
+#ifdef __IPHONEOS__
+ {
+ CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->m_Renderer);
+ POINT p;
+ GetCursorPos(&p);
+ Game->SetActiveObject(renderer->GetObjectAt(p.x, p.y));
+
+ if (Game->m_ActiveObject != NULL && strcmp(Game->m_ActiveObject->GetClassName(), "CUIButton") == 0) {
+ CUIButton *btn = static_cast<CUIButton *>(Game->m_ActiveObject);
+ if (btn->m_Visible && !btn->m_Disable) btn->m_Press = true;
+ }
+ }
+#endif
+ switch (event->button.button) {
+ case SDL_BUTTON_LEFT:
+ if (Game) {
+ if (Game->IsLeftDoubleClick()) Game->OnMouseLeftDblClick();
+ else Game->OnMouseLeftDown();
+ }
+ break;
+ case SDL_BUTTON_RIGHT:
+ if (Game) {
+ if (Game->IsRightDoubleClick()) Game->OnMouseRightDblClick();
+ else Game->OnMouseRightDown();
+ }
+ break;
+ case SDL_BUTTON_MIDDLE:
+ if (Game) Game->OnMouseMiddleDown();
+ break;
+ }
+ break;
+
+ case SDL_MOUSEBUTTONUP:
+ switch (event->button.button) {
+ case SDL_BUTTON_LEFT:
+ if (Game) Game->OnMouseLeftUp();
+ break;
+ case SDL_BUTTON_RIGHT:
+ if (Game) Game->OnMouseRightUp();
+ break;
+ case SDL_BUTTON_MIDDLE:
+ if (Game) Game->OnMouseMiddleUp();
+ break;
+ }
+ break;
+//TODO
+/* case SDL_MOUSEWHEEL:
+ if (Game) Game->HandleMouseWheel(event->wheel.y);
+ break;
+
+ case SDL_KEYDOWN:
+ case SDL_TEXTINPUT:
+ if (Game) Game->HandleKeypress(event);
+ break;
+
+ case SDL_WINDOWEVENT:
+ switch (event->window.event) {
+ case SDL_WINDOWEVENT_FOCUS_GAINED:
+ case SDL_WINDOWEVENT_RESTORED:
+ if (Game) Game->OnActivate(true, true);
+ SDL_ShowCursor(SDL_DISABLE);
+ break;
+ case SDL_WINDOWEVENT_FOCUS_LOST:
+ case SDL_WINDOWEVENT_MINIMIZED:
+#ifndef __IPHONEOS__
+ if (Game) Game->OnActivate(false, false);
+ SDL_ShowCursor(SDL_ENABLE);
+#endif
+ break;
+
+ case SDL_WINDOWEVENT_CLOSE:
+ break;
+
+ }
+ break;
+*/
+ case SDL_QUIT:
+#ifdef __IPHONEOS__
+ if (Game) {
+ Game->AutoSaveOnExit();
+ Game->m_Quitting = true;
+ }
+#else
+ if (Game) Game->OnWindowClose();
+#endif
+
+ break;
+
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////
+int CBPlatform::SDLEventWatcher(void *userdata, SDL_Event *event) {
+ //TODO
+/* if (event->type == SDL_WINDOWEVENT && event->window.event == SDL_WINDOWEVENT_MINIMIZED) {
+ if (Game) Game->AutoSaveOnExit();
+ if (Game) Game->OnActivate(false, false);
+ SDL_ShowCursor(SDL_ENABLE);
+ }
+*/
+ return 1;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+// Win32 API bindings
+//////////////////////////////////////////////////////////////////////////
+HINSTANCE CBPlatform::ShellExecute(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd) {
+#ifdef __WIN32__
+ return ::ShellExecute(hwnd, lpOperation, lpFile, lpParameters, lpDirectory, nShowCmd);
+#else
+ return NULL;
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////////
+void CBPlatform::OutputDebugString(LPCSTR lpOutputString) {
+#ifdef __WIN32__
+ ::OutputDebugString(lpOutputString);
+#endif
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+uint32 CBPlatform::GetTime() {
+ return SDL_GetTicks();
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::GetCursorPos(LPPOINT lpPoint) {
+ CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->m_Renderer);
+
+ int x, y;
+ SDL_GetMouseState(&x, &y);
+ lpPoint->x = x;
+ lpPoint->y = y;
+
+ renderer->PointFromScreen(lpPoint);
+
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::SetCursorPos(int X, int Y) {
+ CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->m_Renderer);
+
+ POINT p;
+ p.x = X;
+ p.y = Y;
+ renderer->PointToScreen(&p);
+// TODO
+ //SDL_WarpMouseInWindow(renderer->GetSdlWindow(), p.x, p.y);
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::ShowWindow(HWND hWnd, int nCmdShow) {
+#ifdef __WIN32__
+ return ::ShowWindow(hWnd, nCmdShow);
+#else
+ return FALSE;
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool CBPlatform::DeleteFile(const char *lpFileName) {
+ return remove(lpFileName) ? true : false;
+}
+
+//////////////////////////////////////////////////////////////////////////
+bool CBPlatform::CopyFile(const char *from, const char *to, bool failIfExists) {
+// try {
+ warning("CBPlatform::CopyFile(%s, %s, %d) - not implemented", from, to, failIfExists);
+ return false;
+// if (failIfExists && boost::filesystem::exists(to)) return false;
+// boost::filesystem::copy_file(from, to);
+// return true;
+// } catch (...) {
+// return false;
+// }
+}
+
+//////////////////////////////////////////////////////////////////////////
+HWND CBPlatform::SetCapture(HWND hWnd) {
+#ifdef __WIN32__
+ return ::SetCapture(hWnd);
+#else
+ return NULL;
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::ReleaseCapture() {
+#ifdef __WIN32__
+ return ::ReleaseCapture();
+#else
+ return FALSE;
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::SetForegroundWindow(HWND hWnd) {
+#ifdef __WIN32__
+ return ::SetForegroundWindow(hWnd);
+#else
+ return FALSE;
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::SetRectEmpty(LPRECT lprc) {
+ lprc->left = lprc->right = lprc->top = lprc->bottom = 0;
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::IsRectEmpty(const LPRECT lprc) {
+ return (lprc->left >= lprc->right) || (lprc->top >= lprc->bottom);
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::PtInRect(LPRECT lprc, POINT p) {
+ return (p.x >= lprc->left) && (p.x < lprc->right) && (p.y >= lprc->top) && (p.y < lprc->bottom);
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::SetRect(LPRECT lprc, int left, int top, int right, int bottom) {
+ lprc->left = left;
+ lprc->top = top;
+ lprc->right = right;
+ lprc->bottom = bottom;
+
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::IntersectRect(LPRECT lprcDst, CONST LPRECT lprcSrc1, CONST LPRECT lprcSrc2) {
+ if (IsRectEmpty(lprcSrc1) || IsRectEmpty(lprcSrc2) ||
+ lprcSrc1->left >= lprcSrc2->right || lprcSrc2->left >= lprcSrc1->right ||
+ lprcSrc1->top >= lprcSrc2->bottom || lprcSrc2->top >= lprcSrc1->bottom) {
+ SetRectEmpty(lprcDst);
+ return FALSE;
+ }
+ lprcDst->left = MAX(lprcSrc1->left, lprcSrc2->left);
+ lprcDst->right = MIN(lprcSrc1->right, lprcSrc2->right);
+ lprcDst->top = MAX(lprcSrc1->top, lprcSrc2->top);
+ lprcDst->bottom = MIN(lprcSrc1->bottom, lprcSrc2->bottom);
+
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::UnionRect(LPRECT lprcDst, RECT *lprcSrc1, RECT *lprcSrc2) {
+ if (IsRectEmpty(lprcSrc1)) {
+ if (IsRectEmpty(lprcSrc2)) {
+ SetRectEmpty(lprcDst);
+ return FALSE;
+ } else {
+ *lprcDst = *lprcSrc2;
+ }
+ } else {
+ if (IsRectEmpty(lprcSrc2)) {
+ *lprcDst = *lprcSrc1;
+ } else {
+ lprcDst->left = MIN(lprcSrc1->left, lprcSrc2->left);
+ lprcDst->top = MIN(lprcSrc1->top, lprcSrc2->top);
+ lprcDst->right = MAX(lprcSrc1->right, lprcSrc2->right);
+ lprcDst->bottom = MAX(lprcSrc1->bottom, lprcSrc2->bottom);
+ }
+ }
+
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::CopyRect(LPRECT lprcDst, RECT *lprcSrc) {
+ if (lprcDst == NULL || lprcSrc == NULL) return FALSE;
+
+ *lprcDst = *lprcSrc;
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::OffsetRect(LPRECT lprc, int dx, int dy) {
+ if (lprc == NULL) return FALSE;
+
+ lprc->left += dx;
+ lprc->top += dy;
+ lprc->right += dx;
+ lprc->bottom += dy;
+
+ return TRUE;
+}
+
+//////////////////////////////////////////////////////////////////////////
+BOOL CBPlatform::EqualRect(LPRECT rect1, LPRECT rect2) {
+ return rect1->left == rect2->left && rect1->right == rect2->right && rect1->top == rect2->top && rect1->bottom == rect2->bottom;
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+AnsiString CBPlatform::GetSystemFontPath() {
+#ifdef __WIN32__
+ // we're looking for something like "c:\windows\fonts\";
+ char winDir[MAX_PATH + 1];
+ winDir[MAX_PATH] = '\0';
+ ::GetWindowsDirectory(winDir, MAX_PATH);
+ return PathUtil::Combine(AnsiString(winDir), "fonts");
+#else
+ // !PORTME
+ return "/Library/Fonts/";
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////////
+AnsiString CBPlatform::GetPlatformName() {
+ // TODO: Should conform to the WME-spec.
+ //return AnsiString(SDL_GetPlatform());
+ return AnsiString("ScummVM");
+}
+
+//////////////////////////////////////////////////////////////////////////
+int scumm_stricmp(const char *str1, const char *str2) {
+#ifdef __WIN32__
+ return ::stricmp(str1, str2);
+#else
+ return ::strcasecmp(str1, str2);
+#endif
+}
+
+//////////////////////////////////////////////////////////////////////////
+int scumm_strnicmp(const char *str1, const char *str2, size_t maxCount) {
+#ifdef __WIN32__
+ return ::strnicmp(str1, str2, maxCount);
+#else
+ return ::strncasecmp(str1, str2, maxCount);
+#endif
+}
+
+
+//////////////////////////////////////////////////////////////////////////
+char *CBPlatform::strupr(char *string) {
+ if (string) {
+ for (size_t i = 0; i < strlen(string); ++i) {
+ string[i] = toupper(string[i]);
+ }
+ }
+ return string;
+}
+
+//////////////////////////////////////////////////////////////////////////
+char *CBPlatform::strlwr(char *string) {
+ if (string) {
+ for (size_t i = 0; i < strlen(string); ++i) {
+ string[i] = tolower(string[i]);
+ }
+ }
+ return string;
+}
+
+} // end of namespace WinterMute
diff --git a/engines/wintermute/StringUtil.cpp b/engines/wintermute/StringUtil.cpp index a8af7f25ec..3fcc156ffc 100644 --- a/engines/wintermute/StringUtil.cpp +++ b/engines/wintermute/StringUtil.cpp @@ -315,7 +315,7 @@ int StringUtil::IndexOf(const WideString &str, const WideString &toFind, size_t if (index == NULL)
return -1;
else
- return str.c_str() - index;
+ return index - str.c_str();
}
//////////////////////////////////////////////////////////////////////////
diff --git a/engines/wintermute/module.mk b/engines/wintermute/module.mk index 2b5eca2c6a..2870ec47fe 100644 --- a/engines/wintermute/module.mk +++ b/engines/wintermute/module.mk @@ -1,6 +1,7 @@ MODULE := engines/wintermute MODULE_OBJS := \ + scriptables/ScEngine.o \ scriptables/ScScript.o \ scriptables/ScStack.o \ scriptables/ScValue.o \ @@ -8,6 +9,8 @@ MODULE_OBJS := \ scriptables/SXDate.o \ scriptables/SXMath.o \ scriptables/SXMemBuffer.o \ + scriptables/SXStore.o \ + scriptables/SXString.o \ AdActor.o \ AdActorDir.o \ AdEntity.o \ @@ -79,11 +82,13 @@ MODULE_OBJS := \ FontGlyphCache.o \ MathUtil.o \ PathUtil.o \ + PlatformSDL.o \ StringUtil.o \ SysClass.o \ SysClassRegistry.o \ SysInstance.o \ tinyxml.o \ + tinystr.o \ UIButton.o \ UIEdit.o \ UIEntity.o \ diff --git a/engines/wintermute/scriptables/SXArray.cpp b/engines/wintermute/scriptables/SXArray.cpp index 4a67cdfb5a..5203945053 100644 --- a/engines/wintermute/scriptables/SXArray.cpp +++ b/engines/wintermute/scriptables/SXArray.cpp @@ -168,7 +168,7 @@ HRESULT CSXArray::ScSetProperty(char *Name, CScValue *Value) { //////////////////////////////////////////////////////////////////////////
if (strcmp(Name, "Length") == 0) {
int OrigLength = m_Length;
- m_Length = std::max(Value->GetInt(0), 0);
+ m_Length = MAX(Value->GetInt(0), 0);
char PropName[20];
if (m_Length < OrigLength) {
diff --git a/engines/wintermute/scriptables/SXDate.cpp b/engines/wintermute/scriptables/SXDate.cpp index 39b50da528..232f2beefd 100644 --- a/engines/wintermute/scriptables/SXDate.cpp +++ b/engines/wintermute/scriptables/SXDate.cpp @@ -34,7 +34,7 @@ IMPLEMENT_PERSISTENT(CSXDate, false) //////////////////////////////////////////////////////////////////////////
CSXDate::CSXDate(CBGame *inGame, CScStack *Stack): CBScriptable(inGame) {
Stack->CorrectParams(6);
-
+#if 0
memset(&m_tm, 0, sizeof(m_tm));
CScValue *valYear = Stack->Pop();
@@ -52,6 +52,7 @@ CSXDate::CSXDate(CBGame *inGame, CScStack *Stack): CBScriptable(inGame) { }
mktime(&m_tm);
+#endif
}
@@ -63,12 +64,16 @@ CSXDate::~CSXDate() { //////////////////////////////////////////////////////////////////////////
char *CSXDate::ScToString() {
+#if 0
return asctime(&m_tm);
+#endif
+ return "";
}
//////////////////////////////////////////////////////////////////////////
HRESULT CSXDate::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisStack, char *Name) {
+#if 0
//////////////////////////////////////////////////////////////////////////
// GetYear
//////////////////////////////////////////////////////////////////////////
@@ -202,7 +207,9 @@ HRESULT CSXDate::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This return S_OK;
}
- else return E_FAIL;
+ else
+#endif
+ return E_FAIL;
}
@@ -241,24 +248,27 @@ HRESULT CSXDate::ScSetProperty(char *Name, CScValue *Value) { HRESULT CSXDate::Persist(CBPersistMgr *PersistMgr) {
CBScriptable::Persist(PersistMgr);
-
+#if 0
if (PersistMgr->m_Saving)
PersistMgr->PutBytes((byte *)&m_tm, sizeof(m_tm));
else
PersistMgr->GetBytes((byte *)&m_tm, sizeof(m_tm));
-
+#endif
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
int CSXDate::ScCompare(CBScriptable *Value) {
+#if 0
time_t time1 = mktime(&m_tm);
time_t time2 = mktime(&((CSXDate *)Value)->m_tm);
if (time1 < time2) return -1;
else if (time1 > time2) return 1;
- else return 0;
+ else
+#endif
+ return 0;
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/scriptables/SXDate.h b/engines/wintermute/scriptables/SXDate.h index fe9191368d..638816b6d1 100644 --- a/engines/wintermute/scriptables/SXDate.h +++ b/engines/wintermute/scriptables/SXDate.h @@ -45,7 +45,7 @@ public: HRESULT ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *ThisStack, char *Name);
char *ScToString();
char *m_String;
- struct tm m_tm;
+ //struct tm m_tm; // TODO!
};
} // end of namespace WinterMute
diff --git a/engines/wintermute/scriptables/SXFile.cpp b/engines/wintermute/scriptables/SXFile.cpp index 7615d3a01f..8e38e2608a 100644 --- a/engines/wintermute/scriptables/SXFile.cpp +++ b/engines/wintermute/scriptables/SXFile.cpp @@ -23,17 +23,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "SysClassRegistry.h"
-#include "SysClass.h"
-#include "ScStack.h"
-#include "ScValue.h"
-#include "ScScript.h"
-#include "utils.h"
-#include "BGame.h"
-#include "BFile.h"
-#include "BFileManager.h"
-#include "PlatformSDL.h"
-#include "scriptables/SXFile.h"
+#include "engines/wintermute/SysClassRegistry.h"
+#include "engines/wintermute/SysClass.h"
+#include "engines/wintermute/scriptables/ScStack.h"
+#include "engines/wintermute/scriptables/ScValue.h"
+#include "engines/wintermute/scriptables/ScScript.h"
+#include "engines/wintermute/utils.h"
+#include "engines/wintermute/BGame.h"
+#include "engines/wintermute/BFile.h"
+#include "engines/wintermute/BFileManager.h"
+#include "engines/wintermute/PlatformSDL.h"
+#include "engines/wintermute/scriptables/SXFile.h"
namespace WinterMute {
diff --git a/engines/wintermute/scriptables/SXMemBuffer.cpp b/engines/wintermute/scriptables/SXMemBuffer.cpp index 38468757ea..874aa2c9d1 100644 --- a/engines/wintermute/scriptables/SXMemBuffer.cpp +++ b/engines/wintermute/scriptables/SXMemBuffer.cpp @@ -43,7 +43,7 @@ CSXMemBuffer::CSXMemBuffer(CBGame *inGame, CScStack *Stack): CBScriptable(inGame m_Size = 0;
int NewSize = Stack->Pop()->GetInt();
- Resize(std::max(0, NewSize));
+ Resize(MAX(0, NewSize));
}
//////////////////////////////////////////////////////////////////////////
@@ -124,7 +124,7 @@ HRESULT CSXMemBuffer::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack if (strcmp(Name, "SetSize") == 0) {
Stack->CorrectParams(1);
int NewSize = Stack->Pop()->GetInt();
- NewSize = std::max(0, NewSize);
+ NewSize = MAX(0, NewSize);
if (SUCCEEDED(Resize(NewSize))) Stack->PushBool(true);
else Stack->PushBool(false);
diff --git a/engines/wintermute/scriptables/SXStore.cpp b/engines/wintermute/scriptables/SXStore.cpp index 50c970d41a..cdd62599d4 100644 --- a/engines/wintermute/scriptables/SXStore.cpp +++ b/engines/wintermute/scriptables/SXStore.cpp @@ -23,13 +23,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "BGame.h"
-#include "BRegistry.h"
-#include "scriptables/SXStore.h"
-#include "ScValue.h"
-#include "ScScript.h"
-#include "ScStack.h"
-#include "StringUtil.h"
+#include "engines/wintermute/BGame.h"
+#include "engines/wintermute/BRegistry.h"
+#include "engines/wintermute/scriptables/SXStore.h"
+#include "engines/wintermute/scriptables/ScValue.h"
+#include "engines/wintermute/scriptables/ScScript.h"
+#include "engines/wintermute/scriptables/ScStack.h"
+#include "engines/wintermute/StringUtil.h"
#ifdef __IPHONEOS__
# include "IOS_StoreKit_interface.h"
diff --git a/engines/wintermute/scriptables/SXString.cpp b/engines/wintermute/scriptables/SXString.cpp index 0283ee4895..0e4daf02aa 100644 --- a/engines/wintermute/scriptables/SXString.cpp +++ b/engines/wintermute/scriptables/SXString.cpp @@ -23,13 +23,13 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "BGame.h"
-#include "ScStack.h"
-#include "ScValue.h"
-#include "utils.h"
-#include "scriptables/SXString.h"
-#include "scriptables/SXArray.h"
-#include "StringUtil.h"
+#include "engines/wintermute/BGame.h"
+#include "engines/wintermute/scriptables/ScStack.h"
+#include "engines/wintermute/scriptables/ScValue.h"
+#include "engines/wintermute/utils.h"
+#include "engines/wintermute/scriptables/SXString.h"
+#include "engines/wintermute/scriptables/SXArray.h"
+#include "engines/wintermute/StringUtil.h"
namespace WinterMute {
@@ -44,7 +44,7 @@ CSXString::CSXString(CBGame *inGame, CScStack *Stack): CBScriptable(inGame) { CScValue *Val = Stack->Pop();
if (Val->IsInt()) {
- _capacity = std::max(0, Val->GetInt());
+ _capacity = MAX(0, Val->GetInt());
if (_capacity > 0) {
_string = new char[_capacity];
memset(_string, 0, _capacity);
@@ -102,22 +102,23 @@ HRESULT CSXString::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th if (end < start) CBUtils::Swap(&start, &end);
- try {
+ //try {
WideString str;
if (Game->m_TextEncoding == TEXT_UTF8)
str = StringUtil::Utf8ToWide(_string);
else
str = StringUtil::AnsiToWide(_string);
- WideString subStr = str.substr(start, end - start + 1);
+ //WideString subStr = str.substr(start, end - start + 1);
+ WideString subStr(str.c_str() + start, end - start + 1);
if (Game->m_TextEncoding == TEXT_UTF8)
Stack->PushString(StringUtil::WideToUtf8(subStr).c_str());
else
Stack->PushString(StringUtil::WideToAnsi(subStr).c_str());
- } catch (std::exception &) {
- Stack->PushNULL();
- }
+ // } catch (std::exception &) {
+ // Stack->PushNULL();
+ // }
return S_OK;
}
@@ -139,22 +140,23 @@ HRESULT CSXString::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th if (val->IsNULL()) len = strlen(_string) - start;
- try {
+// try {
WideString str;
if (Game->m_TextEncoding == TEXT_UTF8)
str = StringUtil::Utf8ToWide(_string);
else
str = StringUtil::AnsiToWide(_string);
- WideString subStr = str.substr(start, len);
+// WideString subStr = str.substr(start, len);
+ WideString subStr(str.c_str() + start, len);
if (Game->m_TextEncoding == TEXT_UTF8)
Stack->PushString(StringUtil::WideToUtf8(subStr).c_str());
else
Stack->PushString(StringUtil::WideToAnsi(subStr).c_str());
- } catch (std::exception &) {
- Stack->PushNULL();
- }
+// } catch (std::exception &) {
+// Stack->PushNULL();
+// }
return S_OK;
}
@@ -258,27 +260,29 @@ HRESULT CSXString::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *Th else
delims = StringUtil::AnsiToWide(Separators);
- std::vector<WideString> parts;
+ Common::Array<WideString> parts;
size_t start, pos;
start = 0;
do {
- pos = str.find_first_of(delims, start);
+ pos = StringUtil::IndexOf(Common::String(str.c_str() + start), delims, start);
+ //pos = str.find_first_of(delims, start);
if (pos == start) {
start = pos + 1;
- } else if (pos == WideString::npos) {
- parts.push_back(str.substr(start));
+ } else if (pos == str.size()) {
+ parts.push_back(Common::String(str.c_str() + start));
break;
} else {
- parts.push_back(str.substr(start, pos - start));
+ parts.push_back(Common::String(str.c_str() + start, pos - start));
start = pos + 1;
}
- start = str.find_first_not_of(delims, start);
+ //start = str.find_first_not_of(delims, start);
+ start = StringUtil::LastIndexOf(Common::String(str.c_str() + start), delims, start) + 1;
- } while (pos != WideString::npos);
+ } while (pos != str.size());
- for (std::vector<WideString>::iterator it = parts.begin(); it != parts.end(); ++it) {
+ for (Common::Array<WideString>::iterator it = parts.begin(); it != parts.end(); ++it) {
WideString &part = (*it);
if (Game->m_TextEncoding == TEXT_UTF8)
@@ -316,7 +320,7 @@ CScValue *CSXString::ScGetProperty(char *Name) { else if (strcmp(Name, "Length") == 0) {
if (Game->m_TextEncoding == TEXT_UTF8) {
WideString wstr = StringUtil::Utf8ToWide(_string);
- m_ScValue->SetInt(wstr.length());
+ m_ScValue->SetInt(wstr.size());
} else
m_ScValue->SetInt(strlen(_string));
diff --git a/engines/wintermute/scriptables/ScEngine.cpp b/engines/wintermute/scriptables/ScEngine.cpp index ce3ac5a94f..24272766c2 100644 --- a/engines/wintermute/scriptables/ScEngine.cpp +++ b/engines/wintermute/scriptables/ScEngine.cpp @@ -26,17 +26,17 @@ * Copyright (c) 2011 Jan Nedoma
*/
-#include "dcgf.h"
-#include "ScEngine.h"
-#include "StringUtil.h"
-#include "ScValue.h"
-#include "ScScript.h"
-#include "ScStack.h"
-#include "SXMath.h"
-#include "BRegistry.h"
-#include "BGame.h"
-#include "BSound.h"
-#include "BFileManager.h"
+#include "engines/wintermute/dcgf.h"
+#include "engines/wintermute/scriptables/ScEngine.h"
+#include "engines/wintermute/StringUtil.h"
+#include "engines/wintermute/scriptables/ScValue.h"
+#include "engines/wintermute/scriptables/ScScript.h"
+#include "engines/wintermute/scriptables/ScStack.h"
+#include "engines/wintermute/scriptables/SXMath.h"
+#include "engines/wintermute/BRegistry.h"
+#include "engines/wintermute/BGame.h"
+#include "engines/wintermute/BSound.h"
+#include "engines/wintermute/BFileManager.h"
#include <algorithm>
#include <vector>
@@ -150,7 +150,8 @@ CScEngine::~CScEngine() { Cleanup();
for (int i = 0; i < m_Breakpoints.GetSize(); i++) {
- SAFE_DELETE(m_Breakpoints[i]);
+ delete m_Breakpoints[i];
+ m_Breakpoints[i] = NULL;
}
m_Breakpoints.RemoveAll();
}
@@ -167,14 +168,15 @@ HRESULT CScEngine::Cleanup() { m_Scripts.RemoveAll();
-
- SAFE_DELETE(m_Globals);
+ delete m_Globals;
+ m_Globals = NULL;
EmptyScriptCache();
m_CurrentScript = NULL; // ref only
- SAFE_DELETE_ARRAY(m_FileToCompile);
+ delete[] m_FileToCompile;
+ m_FileToCompile = NULL;
m_CompileErrorCallback = NULL;
m_CompileErrorCallbackData = NULL;
@@ -523,7 +525,8 @@ int CScEngine::GetNumScripts(int *Running, int *Waiting, int *Persistent) { HRESULT CScEngine::EmptyScriptCache() {
for (int i = 0; i < MAX_CACHED_SCRIPTS; i++) {
if (m_CachedScripts[i]) {
- SAFE_DELETE(m_CachedScripts[i]);
+ delete m_CachedScripts[i];
+ m_CachedScripts[i] = NULL;
}
}
return S_OK;
@@ -602,7 +605,7 @@ HRESULT CScEngine::ResumeAll() { //////////////////////////////////////////////////////////////////////////
HRESULT CScEngine::SetFileToCompile(char *Filename) {
- SAFE_DELETE_ARRAY(m_FileToCompile);
+ delete[] m_FileToCompile;
m_FileToCompile = new char[strlen(Filename) + 1];
if (m_FileToCompile) {
strcpy(m_FileToCompile, Filename);
@@ -695,7 +698,7 @@ HRESULT CScEngine::RemoveBreakpoint(char *ScriptFilename, int Line) { if (m_Breakpoints[i]->m_Lines[j] == Line) {
m_Breakpoints[i]->m_Lines.RemoveAt(j);
if (m_Breakpoints[i]->m_Lines.GetSize() == 0) {
- SAFE_DELETE(m_Breakpoints[i]);
+ delete m_Breakpoints[i];
m_Breakpoints.RemoveAt(i);
}
// refresh changes
@@ -776,8 +779,10 @@ HRESULT CScEngine::LoadBreakpoints() { char *Line = CBUtils::StrEntry(1, breakpoint.c_str(), ':');
if (Path != NULL && Line != NULL) AddBreakpoint(Path, atoi(Line));
- SAFE_DELETE_ARRAY(Path);
- SAFE_DELETE_ARRAY(Line);
+ delete[] Path;
+ delete[] Line;
+ Path = NULL;
+ Line = NULL;
}
return S_OK;
@@ -817,14 +822,15 @@ void CScEngine::DisableProfiling() { //////////////////////////////////////////////////////////////////////////
void CScEngine::DumpStats() {
- uint32 totalTime = CBPlatform::GetTime() - m_ProfilingStartTime;
+ error("DumpStats not ported to ScummVM yet");
+/* uint32 totalTime = CBPlatform::GetTime() - m_ProfilingStartTime;
typedef std::vector <std::pair<uint32, std::string> > TimeVector;
TimeVector times;
ScriptTimes::iterator it;
for (it = m_ScriptTimes.begin(); it != m_ScriptTimes.end(); it++) {
- times.push_back(std::pair<uint32, std::string> (it->second, it->first));
+ times.push_back(std::pair<uint32, std::string> (it->_value, it->_key));
}
std::sort(times.begin(), times.end());
@@ -836,7 +842,7 @@ void CScEngine::DumpStats() { for (tit = times.rbegin(); tit != times.rend(); tit++) {
Game->LOG(0, " %-40s %fs (%f%%)", tit->second.c_str(), (float)tit->first / 1000, (float)tit->first / (float)totalTime * 100);
- }
+ }*/
}
} // end of namespace WinterMute
diff --git a/engines/wintermute/scriptables/ScValue.cpp b/engines/wintermute/scriptables/ScValue.cpp index 186f4ff9d2..f42cbf6a30 100644 --- a/engines/wintermute/scriptables/ScValue.cpp +++ b/engines/wintermute/scriptables/ScValue.cpp @@ -182,7 +182,7 @@ CScValue *CScValue::GetProp(char *Name) { if (ret == NULL) {
m_ValIter = m_ValObject.find(Name);
- if (m_ValIter != m_ValObject.end()) ret = m_ValIter->second;
+ if (m_ValIter != m_ValObject.end()) ret = m_ValIter->_value;
}
return ret;
}
@@ -193,8 +193,8 @@ HRESULT CScValue::DeleteProp(char *Name) { m_ValIter = m_ValObject.find(Name);
if (m_ValIter != m_ValObject.end()) {
- delete m_ValIter->second;
- m_ValIter->second = NULL;
+ delete m_ValIter->_value;
+ m_ValIter->_value = NULL;
}
return S_OK;
@@ -216,7 +216,7 @@ HRESULT CScValue::SetProp(char *Name, CScValue *Val, bool CopyWhole, bool SetAsC m_ValIter = m_ValObject.find(Name);
if (m_ValIter != m_ValObject.end()) {
- val = m_ValIter->second;
+ val = m_ValIter->_value;
}
if (!val) val = new CScValue(Game);
else val->Cleanup();
@@ -259,7 +259,7 @@ bool CScValue::PropExists(char *Name) { void CScValue::DeleteProps() {
m_ValIter = m_ValObject.begin();
while (m_ValIter != m_ValObject.end()) {
- delete(CScValue *)m_ValIter->second;
+ delete(CScValue *)m_ValIter->_value;
m_ValIter++;
}
m_ValObject.clear();
@@ -270,7 +270,7 @@ void CScValue::DeleteProps() { void CScValue::CleanProps(bool IncludingNatives) {
m_ValIter = m_ValObject.begin();
while (m_ValIter != m_ValObject.end()) {
- if (!m_ValIter->second->m_IsConstVar && (!m_ValIter->second->IsNative() || IncludingNatives)) m_ValIter->second->SetNULL();
+ if (!m_ValIter->_value->m_IsConstVar && (!m_ValIter->_value->IsNative() || IncludingNatives)) m_ValIter->_value->SetNULL();
m_ValIter++;
}
}
@@ -671,8 +671,8 @@ void CScValue::Copy(CScValue *orig, bool CopyWhole) { if (orig->m_Type == VAL_OBJECT && orig->m_ValObject.size() > 0) {
orig->m_ValIter = orig->m_ValObject.begin();
while (orig->m_ValIter != orig->m_ValObject.end()) {
- m_ValObject[orig->m_ValIter->first] = new CScValue(Game);
- m_ValObject[orig->m_ValIter->first]->Copy(orig->m_ValIter->second);
+ m_ValObject[orig->m_ValIter->_key] = new CScValue(Game);
+ m_ValObject[orig->m_ValIter->_key]->Copy(orig->m_ValIter->_value);
orig->m_ValIter++;
}
} else m_ValObject.clear();
@@ -727,9 +727,9 @@ HRESULT CScValue::Persist(CBPersistMgr *PersistMgr) { PersistMgr->Transfer("", &size);
m_ValIter = m_ValObject.begin();
while (m_ValIter != m_ValObject.end()) {
- str = (char *)m_ValIter->first.c_str();
+ str = (char *)m_ValIter->_key.c_str();
PersistMgr->Transfer("", &str);
- PersistMgr->Transfer("", &m_ValIter->second);
+ PersistMgr->Transfer("", &m_ValIter->_value);
m_ValIter++;
}
@@ -797,8 +797,8 @@ HRESULT CScValue::SaveAsText(CBDynBuffer *Buffer, int Indent) { m_ValIter = m_ValObject.begin();
while (m_ValIter != m_ValObject.end()) {
Buffer->PutTextIndent(Indent, "PROPERTY {\n");
- Buffer->PutTextIndent(Indent + 2, "NAME=\"%s\"\n", (char *)m_ValIter->first.c_str());
- Buffer->PutTextIndent(Indent + 2, "VALUE=\"%s\"\n", m_ValIter->second->GetString());
+ Buffer->PutTextIndent(Indent + 2, "NAME=\"%s\"\n", (char *)m_ValIter->_key.c_str());
+ Buffer->PutTextIndent(Indent + 2, "VALUE=\"%s\"\n", m_ValIter->_value->GetString());
Buffer->PutTextIndent(Indent, "}\n\n");
m_ValIter++;
@@ -855,7 +855,7 @@ int CScValue::CompareStrict(CScValue *Val1, CScValue *Val2) { HRESULT CScValue::DbgSendVariables(IWmeDebugClient *Client, EWmeDebuggerVariableType Type, CScScript *Script, unsigned int ScopeID) {
m_ValIter = m_ValObject.begin();
while (m_ValIter != m_ValObject.end()) {
- Client->OnVariableInit(Type, Script, ScopeID, m_ValIter->second, m_ValIter->first.c_str());
+ Client->OnVariableInit(Type, Script, ScopeID, m_ValIter->_value, m_ValIter->_key.c_str());
m_ValIter++;
}
return S_OK;
@@ -999,8 +999,8 @@ bool CScValue::DbgGetProperty(int Index, const char **Name, IWmeDebugProp **Valu m_ValIter = m_ValObject.begin();
while (m_ValIter != m_ValObject.end()) {
if (Count == Index) {
- *Name = m_ValIter->first.c_str();
- *Value = m_ValIter->second;
+ *Name = m_ValIter->_key.c_str();
+ *Value = m_ValIter->_value;
return true;
}
m_ValIter++;
diff --git a/engines/wintermute/scriptables/ScValue.h b/engines/wintermute/scriptables/ScValue.h index 40abe635ce..3d0c69d3f7 100644 --- a/engines/wintermute/scriptables/ScValue.h +++ b/engines/wintermute/scriptables/ScValue.h @@ -33,8 +33,8 @@ #include "engines/wintermute/BBase.h"
#include "engines/wintermute/persistent.h"
#include "engines/wintermute/dcscript.h" // Added by ClassView
-#include <map>
-#include <string>
+//#include <map>
+//#include <string>
#include "engines/wintermute/wme_debugger.h"
#include "common/str.h"
@@ -100,8 +100,8 @@ public: CScValue(CBGame *inGame, double Val);
CScValue(CBGame *inGame, const char *Val);
virtual ~CScValue();
- std::map<std::string, CScValue *> m_ValObject;
- std::map<std::string, CScValue *>::iterator m_ValIter;
+ Common::HashMap<Common::String, CScValue *> m_ValObject;
+ Common::HashMap<Common::String, CScValue *>::iterator m_ValIter;
bool SetProperty(const char *PropName, int Value);
bool SetProperty(const char *PropName, const char *Value);
diff --git a/engines/wintermute/wintermute.cpp b/engines/wintermute/wintermute.cpp index 4f791cabd1..39152acc5d 100644 --- a/engines/wintermute/wintermute.cpp +++ b/engines/wintermute/wintermute.cpp @@ -46,7 +46,7 @@ namespace WinterMute { // However this is the place to specify all default directories const Common::FSNode gameDataDir(ConfMan.get("path")); - SearchMan.addSubDirectoryMatching(gameDataDir, "sound"); + //SearchMan.addSubDirectoryMatching(gameDataDir, "sound"); // Here is the right place to set up the engine specific debug channels DebugMan.addDebugChannel(kWinterMuteDebugExample, "example", "this is just an example for a engine specific debug channel"); @@ -102,9 +102,9 @@ namespace WinterMute { // This test will show up if --debugflags=example or --debugflags=example2 or both of them and -d3 are specified on the commandline debugC(3, kWinterMuteDebugExample | kWinterMuteDebugExample2, "Example debug call two"); - return Common::kNoError; - CBGame game; + + return Common::kNoError; } } // End of namespace WinterMute
\ No newline at end of file |