diff options
-rw-r--r-- | engines/wintermute/BRenderSDL.cpp | 2 | ||||
-rw-r--r-- | engines/wintermute/BRenderSDL.h | 2 | ||||
-rw-r--r-- | engines/wintermute/BRenderer.cpp | 2 | ||||
-rw-r--r-- | engines/wintermute/BRenderer.h | 2 | ||||
-rw-r--r-- | engines/wintermute/BTransitionMgr.cpp | 4 | ||||
-rw-r--r-- | engines/wintermute/PlatformSDL.cpp | 60 | ||||
-rw-r--r-- | engines/wintermute/PlatformSDL.h | 32 | ||||
-rw-r--r-- | engines/wintermute/coll_templ.h | 2 | ||||
-rw-r--r-- | engines/wintermute/scriptables/SXFile.cpp | 4 | ||||
-rw-r--r-- | engines/wintermute/wintypes.h | 51 |
10 files changed, 65 insertions, 96 deletions
diff --git a/engines/wintermute/BRenderSDL.cpp b/engines/wintermute/BRenderSDL.cpp index b74967b815..0574b3e7b9 100644 --- a/engines/wintermute/BRenderSDL.cpp +++ b/engines/wintermute/BRenderSDL.cpp @@ -226,7 +226,7 @@ HRESULT CBRenderSDL::Fill(byte r, byte g, byte b, RECT *rect) { }
//////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderSDL::Fade(WORD Alpha) {
+HRESULT CBRenderSDL::Fade(uint16 Alpha) {
uint32 dwAlpha = 255 - Alpha;
return FadeToColor(dwAlpha << 24);
}
diff --git a/engines/wintermute/BRenderSDL.h b/engines/wintermute/BRenderSDL.h index 11b1b74054..0c5760470e 100644 --- a/engines/wintermute/BRenderSDL.h +++ b/engines/wintermute/BRenderSDL.h @@ -49,7 +49,7 @@ public: HRESULT Flip();
HRESULT Fill(byte r, byte g, byte b, RECT *rect);
- HRESULT Fade(WORD Alpha);
+ HRESULT Fade(uint16 Alpha);
HRESULT FadeToColor(uint32 Color, RECT *rect = NULL);
HRESULT SwitchFullscreen();
diff --git a/engines/wintermute/BRenderer.cpp b/engines/wintermute/BRenderer.cpp index 88ad581e6f..714981ea49 100644 --- a/engines/wintermute/BRenderer.cpp +++ b/engines/wintermute/BRenderer.cpp @@ -180,7 +180,7 @@ HRESULT CBRenderer::DrawRect(int X1, int Y1, int X2, int Y2, uint32 Color, int W //////////////////////////////////////////////////////////////////////////
-HRESULT CBRenderer::Fade(WORD Alpha) {
+HRESULT CBRenderer::Fade(uint16 Alpha) {
return E_FAIL;
}
diff --git a/engines/wintermute/BRenderer.h b/engines/wintermute/BRenderer.h index 7a586775dd..bd2d23071b 100644 --- a/engines/wintermute/BRenderer.h +++ b/engines/wintermute/BRenderer.h @@ -51,7 +51,7 @@ public: virtual HRESULT SetViewport(int left, int top, int right, int bottom);
virtual HRESULT SetViewport(RECT *Rect);
virtual HRESULT SetScreenViewport();
- virtual HRESULT Fade(WORD Alpha);
+ virtual HRESULT Fade(uint16 Alpha);
virtual HRESULT FadeToColor(uint32 Color, RECT *rect = NULL);
virtual HRESULT DrawLine(int X1, int Y1, int X2, int Y2, uint32 Color);
virtual HRESULT DrawRect(int X1, int Y1, int X2, int Y2, uint32 Color, int Width = 1);
diff --git a/engines/wintermute/BTransitionMgr.cpp b/engines/wintermute/BTransitionMgr.cpp index 87cbb86a3d..c5c421250a 100644 --- a/engines/wintermute/BTransitionMgr.cpp +++ b/engines/wintermute/BTransitionMgr.cpp @@ -99,7 +99,7 @@ HRESULT CBTransitionMgr::Update() { uint32 time = CBPlatform::GetTime() - _lastTime;
int Alpha = 255 - (float)time / (float)FADE_DURATION * 255;
Alpha = MIN(255, MAX(Alpha, 0));
- Game->_renderer->Fade((WORD)Alpha);
+ Game->_renderer->Fade((uint16)Alpha);
if (time > FADE_DURATION) _state = TRANS_MGR_READY;
}
@@ -109,7 +109,7 @@ HRESULT CBTransitionMgr::Update() { uint32 time = CBPlatform::GetTime() - _lastTime;
int Alpha = (float)time / (float)FADE_DURATION * 255;
Alpha = MIN(255, MAX(Alpha, 0));
- Game->_renderer->Fade((WORD)Alpha);
+ Game->_renderer->Fade((uint16)Alpha);
if (time > FADE_DURATION) _state = TRANS_MGR_READY;
}
diff --git a/engines/wintermute/PlatformSDL.cpp b/engines/wintermute/PlatformSDL.cpp index 0fc8c1628a..3335bd3155 100644 --- a/engines/wintermute/PlatformSDL.cpp +++ b/engines/wintermute/PlatformSDL.cpp @@ -322,7 +322,7 @@ int CBPlatform::SDLEventWatcher(void *userdata, Common::Event *event) { //////////////////////////////////////////////////////////////////////////
// Win32 API bindings
//////////////////////////////////////////////////////////////////////////
-HINSTANCE CBPlatform::ShellExecute(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd) {
+HINSTANCE CBPlatform::ShellExecute(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, int nShowCmd) {
return NULL;
}
@@ -342,7 +342,7 @@ uint32 CBPlatform::GetTime() { }
//////////////////////////////////////////////////////////////////////////
-BOOL CBPlatform::GetCursorPos(LPPOINT lpPoint) {
+bool CBPlatform::GetCursorPos(LPPOINT lpPoint) {
CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->_renderer);
Common::Point p = g_system->getEventManager()->getMousePos();
@@ -351,11 +351,11 @@ BOOL CBPlatform::GetCursorPos(LPPOINT lpPoint) { renderer->PointFromScreen(lpPoint);
- return TRUE;
+ return true;
}
//////////////////////////////////////////////////////////////////////////
-BOOL CBPlatform::SetCursorPos(int X, int Y) {
+bool CBPlatform::SetCursorPos(int X, int Y) {
CBRenderSDL *renderer = static_cast<CBRenderSDL *>(Game->_renderer);
POINT p;
@@ -364,12 +364,12 @@ BOOL CBPlatform::SetCursorPos(int X, int Y) { renderer->PointToScreen(&p);
// TODO
//SDL_WarpMouseInWindow(renderer->GetSdlWindow(), p.x, p.y);
- return TRUE;
+ return true;
}
//////////////////////////////////////////////////////////////////////////
-BOOL CBPlatform::ShowWindow(HWND hWnd, int nCmdShow) {
- return FALSE;
+bool CBPlatform::ShowWindow(HWND hWnd, int nCmdShow) {
+ return false;
}
//////////////////////////////////////////////////////////////////////////
@@ -396,63 +396,63 @@ HWND CBPlatform::SetCapture(HWND hWnd) { }
//////////////////////////////////////////////////////////////////////////
-BOOL CBPlatform::ReleaseCapture() {
- return FALSE;
+bool CBPlatform::ReleaseCapture() {
+ return false;
}
//////////////////////////////////////////////////////////////////////////
-BOOL CBPlatform::SetForegroundWindow(HWND hWnd) {
- return FALSE;
+bool CBPlatform::SetForegroundWindow(HWND hWnd) {
+ return false;
}
//////////////////////////////////////////////////////////////////////////
-BOOL CBPlatform::SetRectEmpty(LPRECT lprc) {
+bool CBPlatform::SetRectEmpty(LPRECT lprc) {
lprc->left = lprc->right = lprc->top = lprc->bottom = 0;
- return TRUE;
+ return true;
}
//////////////////////////////////////////////////////////////////////////
-BOOL CBPlatform::IsRectEmpty(const LPRECT lprc) {
+bool CBPlatform::IsRectEmpty(const LPRECT lprc) {
return (lprc->left >= lprc->right) || (lprc->top >= lprc->bottom);
}
//////////////////////////////////////////////////////////////////////////
-BOOL CBPlatform::PtInRect(LPRECT lprc, POINT p) {
+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) {
+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;
+ return true;
}
//////////////////////////////////////////////////////////////////////////
-BOOL CBPlatform::IntersectRect(LPRECT lprcDst, CONST LPRECT lprcSrc1, CONST LPRECT lprcSrc2) {
+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;
+ 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;
+ return true;
}
//////////////////////////////////////////////////////////////////////////
-BOOL CBPlatform::UnionRect(LPRECT lprcDst, RECT *lprcSrc1, RECT *lprcSrc2) {
+bool CBPlatform::UnionRect(LPRECT lprcDst, RECT *lprcSrc1, RECT *lprcSrc2) {
if (IsRectEmpty(lprcSrc1)) {
if (IsRectEmpty(lprcSrc2)) {
SetRectEmpty(lprcDst);
- return FALSE;
+ return false;
} else {
*lprcDst = *lprcSrc2;
}
@@ -467,31 +467,31 @@ BOOL CBPlatform::UnionRect(LPRECT lprcDst, RECT *lprcSrc1, RECT *lprcSrc2) { }
}
- return TRUE;
+ return true;
}
//////////////////////////////////////////////////////////////////////////
-BOOL CBPlatform::CopyRect(LPRECT lprcDst, RECT *lprcSrc) {
- if (lprcDst == NULL || lprcSrc == NULL) return FALSE;
+bool CBPlatform::CopyRect(LPRECT lprcDst, RECT *lprcSrc) {
+ if (lprcDst == NULL || lprcSrc == NULL) return false;
*lprcDst = *lprcSrc;
- return TRUE;
+ return true;
}
//////////////////////////////////////////////////////////////////////////
-BOOL CBPlatform::OffsetRect(LPRECT lprc, int dx, int dy) {
- if (lprc == NULL) return FALSE;
+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;
+ return true;
}
//////////////////////////////////////////////////////////////////////////
-BOOL CBPlatform::EqualRect(LPRECT rect1, LPRECT rect2) {
+bool CBPlatform::EqualRect(LPRECT rect1, LPRECT rect2) {
return rect1->left == rect2->left && rect1->right == rect2->right && rect1->top == rect2->top && rect1->bottom == rect2->bottom;
}
diff --git a/engines/wintermute/PlatformSDL.h b/engines/wintermute/PlatformSDL.h index 27de188030..faf4a7e934 100644 --- a/engines/wintermute/PlatformSDL.h +++ b/engines/wintermute/PlatformSDL.h @@ -49,27 +49,27 @@ public: static AnsiString GetPlatformName();
// Win32 API bindings
- static HINSTANCE ShellExecute(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, INT nShowCmd);
+ static HINSTANCE ShellExecute(HWND hwnd, LPCSTR lpOperation, LPCSTR lpFile, LPCSTR lpParameters, LPCSTR lpDirectory, int nShowCmd);
static void OutputDebugString(LPCSTR lpOutputString);
static uint32 GetTime();
- static BOOL GetCursorPos(LPPOINT lpPoint);
- static BOOL SetCursorPos(int X, int Y);
- static BOOL ShowWindow(HWND hWnd, int nCmdShow);
+ static bool GetCursorPos(LPPOINT lpPoint);
+ static bool SetCursorPos(int X, int Y);
+ static bool ShowWindow(HWND hWnd, int nCmdShow);
static bool DeleteFile(const char *lpFileName);
static bool CopyFile(const char *from, const char *to, bool failIfExists);
static HWND SetCapture(HWND hWnd);
- static BOOL ReleaseCapture();
- static BOOL SetForegroundWindow(HWND hWnd);
-
- static BOOL SetRectEmpty(LPRECT lprc);
- static BOOL IsRectEmpty(const LPRECT lprc);
- static BOOL PtInRect(LPRECT lprc, POINT p);
- static BOOL SetRect(LPRECT lprc, int left, int top, int right, int bottom);
- static BOOL IntersectRect(LPRECT lprcDst, const LPRECT lprcSrc1, const LPRECT lprcSrc2);
- static BOOL UnionRect(LPRECT lprcDst, RECT *lprcSrc1, RECT *lprcSrc2);
- static BOOL CopyRect(LPRECT lprcDst, RECT *lprcSrc);
- static BOOL OffsetRect(LPRECT lprc, int dx, int dy);
- static BOOL EqualRect(LPRECT rect1, LPRECT rect2);
+ static bool ReleaseCapture();
+ static bool SetForegroundWindow(HWND hWnd);
+
+ static bool SetRectEmpty(LPRECT lprc);
+ static bool IsRectEmpty(const LPRECT lprc);
+ static bool PtInRect(LPRECT lprc, POINT p);
+ static bool SetRect(LPRECT lprc, int left, int top, int right, int bottom);
+ static bool IntersectRect(LPRECT lprcDst, const LPRECT lprcSrc1, const LPRECT lprcSrc2);
+ static bool UnionRect(LPRECT lprcDst, RECT *lprcSrc1, RECT *lprcSrc2);
+ static bool CopyRect(LPRECT lprcDst, RECT *lprcSrc);
+ static bool OffsetRect(LPRECT lprc, int dx, int dy);
+ static bool EqualRect(LPRECT rect1, LPRECT rect2);
// string functions
diff --git a/engines/wintermute/coll_templ.h b/engines/wintermute/coll_templ.h index ec6ef4f202..9c3a5ab15d 100644 --- a/engines/wintermute/coll_templ.h +++ b/engines/wintermute/coll_templ.h @@ -64,7 +64,7 @@ inline void DCCopyElements(TYPE *pDest, const TYPE *pSrc, int nCount) { /////////////////////////////////////////////////////////////////////////////
template<class TYPE, class ARG_TYPE>
-BOOL DCCompareElements(const TYPE *pElement1, const ARG_TYPE *pElement2) {
+bool DCCompareElements(const TYPE *pElement1, const ARG_TYPE *pElement2) {
return *pElement1 == *pElement2;
}
diff --git a/engines/wintermute/scriptables/SXFile.cpp b/engines/wintermute/scriptables/SXFile.cpp index 7d6b0ebcc1..e25825bebe 100644 --- a/engines/wintermute/scriptables/SXFile.cpp +++ b/engines/wintermute/scriptables/SXFile.cpp @@ -175,7 +175,7 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This else if (strcmp(Name, "Delete") == 0) {
Stack->CorrectParams(0);
Close();
- Stack->PushBool(CBPlatform::DeleteFile(_filename) != FALSE);
+ Stack->PushBool(CBPlatform::DeleteFile(_filename) != false);
return S_OK;
}
@@ -188,7 +188,7 @@ HRESULT CSXFile::ScCallMethod(CScScript *Script, CScStack *Stack, CScStack *This bool Overwrite = Stack->Pop()->GetBool(true);
Close();
- Stack->PushBool(CBPlatform::CopyFile(_filename, Dest, !Overwrite) != FALSE);
+ Stack->PushBool(CBPlatform::CopyFile(_filename, Dest, !Overwrite) != false);
return S_OK;
}
diff --git a/engines/wintermute/wintypes.h b/engines/wintermute/wintypes.h index 4f826e9337..e3dd615063 100644 --- a/engines/wintermute/wintypes.h +++ b/engines/wintermute/wintypes.h @@ -33,68 +33,38 @@ #include "common/scummsys.h"
//namespace WinterMute {
-//#include <cstdio>
-//#include <stdio.h>
#ifndef __WIN32__
#define WINAPI
#define CALLBACK
-#ifndef __OBJC__
-typedef int BOOL;
-#endif
-
-#ifndef TRUE
-# define TRUE 1
-# define FALSE 0
-#endif
-
#define PI ((float) 3.141592653589793f)
#define DRGBA(r,g,b,a) ((uint32)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
#define D3DCOLGetB(rgb) ((byte )(rgb))
-#define D3DCOLGetG(rgb) ((byte )(((WORD)(rgb)) >> 8))
+#define D3DCOLGetG(rgb) ((byte )(((uint16)(rgb)) >> 8))
#define D3DCOLGetR(rgb) ((byte )((rgb)>>16))
#define D3DCOLGetA(rgb) ((byte )((rgb)>>24))
-/*
-#ifndef MAX
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
-#endif
-
-#ifndef MIN
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-*/
-#define CONST const
#define MAX_PATH 512
-typedef char CHAR;
-typedef short SHORT;
-typedef int32_t LONG;
-
-typedef uint16 WORD;
-//typedef uint32 QWORD; // HACK for now
-typedef int INT;
-typedef unsigned int UINT;
-
-typedef CHAR *NPSTR, *LPSTR, *PSTR;
+typedef char *NPSTR, *LPSTR, *PSTR;
typedef PSTR *PZPSTR;
typedef const PSTR *PCZPSTR;
-typedef const CHAR *LPCSTR, *PCSTR;
+typedef const char *LPCSTR, *PCSTR;
typedef PCSTR *PZPCSTR;
typedef struct tagRECT {
- LONG left;
- LONG top;
- LONG right;
- LONG bottom;
+ uint32 left;
+ uint32 top;
+ uint32 right;
+ uint32 bottom;
} RECT, *LPRECT;
typedef struct tagPOINT {
- LONG x;
- LONG y;
+ uint32 x;
+ uint32 y;
} POINT, *LPPOINT;
@@ -102,8 +72,7 @@ typedef uint32 HINSTANCE; typedef uint32 HMODULE;
typedef uint32 HWND;
-//typedef uint32 HRESULT;
-typedef long HRESULT;
+typedef int32 HRESULT;
#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0)
#define FAILED(hr) (((HRESULT)(hr)) < 0)
|