aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2012-05-05 20:54:21 +1000
committerPaul Gilbert2012-05-05 20:54:21 +1000
commit07c1369f98009a2d9f8b49a9f68ace7354469cba (patch)
treeb119f34aa2aedb355d620b43834796cabbb5b4d5 /engines
parentaa603d5a6719764e785e4bd096f16493f7ec7f6c (diff)
downloadscummvm-rg350-07c1369f98009a2d9f8b49a9f68ace7354469cba.tar.gz
scummvm-rg350-07c1369f98009a2d9f8b49a9f68ace7354469cba.tar.bz2
scummvm-rg350-07c1369f98009a2d9f8b49a9f68ace7354469cba.zip
TONY: Created dummy event loop and started work on converting RMWindow class
Diffstat (limited to 'engines')
-rw-r--r--engines/tony/gfxengine.cpp2
-rw-r--r--engines/tony/tony.cpp38
-rw-r--r--engines/tony/tony.h2
-rw-r--r--engines/tony/window.cpp538
-rw-r--r--engines/tony/window.h67
5 files changed, 60 insertions, 587 deletions
diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp
index 7f2515af7b..27db5c18bf 100644
--- a/engines/tony/gfxengine.cpp
+++ b/engines/tony/gfxengine.cpp
@@ -557,7 +557,7 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) {
m_bigBuf.DrawOT();
m_bigBuf.ClearOT();
delete load;
- _vm->m_wnd.GetNewFrame(*this, NULL);
+ _vm->_window.GetNewFrame(*this, NULL);
diff --git a/engines/tony/tony.cpp b/engines/tony/tony.cpp
index 457ba57153..293646e3f8 100644
--- a/engines/tony/tony.cpp
+++ b/engines/tony/tony.cpp
@@ -23,6 +23,7 @@
#include "common/scummsys.h"
#include "common/algorithm.h"
#include "common/config-manager.h"
+#include "common/events.h"
#include "common/file.h"
#include "tony/tony.h"
#include "tony/game.h"
@@ -66,6 +67,9 @@ Common::ErrorCode TonyEngine::Init() {
m_bDrawLocation = true;
m_startTime = g_system->getMillis();
+ // Initialise the graphics window
+ _window.Init();
+
// Initialise the function list
Common::fill(FuncList, FuncList + 300, (LPCUSTOMFUNCTION)NULL);
@@ -220,7 +224,7 @@ void TonyEngine::UnloadAllUtilSFX(void) {
void TonyEngine::InitMusic() {
int i;
- _theSound.Init(/*m_wnd*/);
+ _theSound.Init(/*_window*/);
_theSound.SetMasterVolume(63);
for (i = 0; i < 6; i++)
@@ -349,7 +353,7 @@ void TonyEngine::CloseVoiceDatabase() {
}
void TonyEngine::GrabThumbnail(void) {
- //m_wnd.GrabThumbnail(m_curThumbnail);
+ //_window.GrabThumbnail(m_curThumbnail);
warning("TODO: TonyEngine::GrabThumbnail");
}
@@ -369,8 +373,16 @@ void TonyEngine::Abort(void) {
}
void TonyEngine::Play(void) {
- warning("TODO TonyEngine::Play");
-
+ // Main game loop
+ while (!shouldQuit() && !m_bQuitNow) {
+ g_system->delayMillis(50);
+ _window.Repaint();
+
+ Common::Event evt;
+ while (g_system->getEventManager()->pollEvent(evt))
+ ;
+ }
+
#if 0
MSG msg;
@@ -388,14 +400,14 @@ void TonyEngine::Play(void) {
// Passa il buffer dall'engine alla finestra
if (!m_bPaused) {
if (!theEngine.m_bWiping)
- m_wnd.GetNewFrame(theEngine, NULL);
+ _window.GetNewFrame(theEngine, NULL);
else
- m_wnd.GetNewFrame(theEngine, &theEngine.m_rcWipeEllipse);
+ _window.GetNewFrame(theEngine, &theEngine.m_rcWipeEllipse);
}
// Loop minchia dei messaggi
- if (PeekMessage(&msg, m_wnd, 0, 0, true)) {
- if (!TranslateAccelerator(m_wnd, m_hacc, &msg)) {
+ if (PeekMessage(&msg, _window, 0, 0, true)) {
+ if (!TranslateAccelerator(_window, m_hacc, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@@ -411,12 +423,12 @@ void TonyEngine::Close(void) {
CloseHandle(m_hEndOfFrame);
_theBoxes.Close();
_theEngine.Close();
- m_wnd.Close();
+ _window.Close();
delete[] m_curThumbnail;
}
void TonyEngine::SwitchFullscreen(bool bFull) {
- m_wnd.SwitchFullscreen(bFull);
+ _window.SwitchFullscreen(bFull);
_theEngine.SwitchFullscreen(bFull);
}
@@ -434,7 +446,7 @@ void TonyEngine::PauseLoop(void) {
st = GetTime();
- while (m_bPaused && GetMessage(&msg,m_wnd,0,0)) {
+ while (m_bPaused && GetMessage(&msg,_window,0,0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
@@ -456,9 +468,9 @@ warning("TODO: TonyEninge::Pause");
theEngine.GDIControl(m_bPaused);
if (m_bPaused) {
- SetWindowText(m_wnd, "Tony Tough and the night of Roasted Moths - PAUSED");
+ SetWindowText(_window, "Tony Tough and the night of Roasted Moths - PAUSED");
} else {
- SetWindowText(m_wnd, "Tony Tough and the night of Roasted Moths");
+ SetWindowText(_window, "Tony Tough and the night of Roasted Moths");
}
*/
}
diff --git a/engines/tony/tony.h b/engines/tony/tony.h
index c64bc884d6..e1526db026 100644
--- a/engines/tony/tony.h
+++ b/engines/tony/tony.h
@@ -116,7 +116,7 @@ public:
// Bounding box list manager
RMGameBoxes _theBoxes;
- RMWindow m_wnd;
+ RMWindow _window;
RMGfxEngine _theEngine;
bool m_bQuitNow;
diff --git a/engines/tony/window.cpp b/engines/tony/window.cpp
index ae8d3612c3..c05af6b5e0 100644
--- a/engines/tony/window.cpp
+++ b/engines/tony/window.cpp
@@ -45,6 +45,8 @@
* *
**************************************************************************/
+#include "common/scummsys.h"
+#include "util.h"
#include "tony/window.h"
#include "tony/game.h"
#include "tony/tony.h"
@@ -61,7 +63,7 @@ static uint16 m_wPrecalcTable[0x10000];
\****************************************************************************/
RMWindow::RMWindow() {
- m_Primary = NULL; m_Back = NULL;
+
}
RMWindow::~RMWindow() {
@@ -69,188 +71,9 @@ RMWindow::~RMWindow() {
RMText::Unload();
}
-#ifdef REFACTOR_ME
-LRESULT CALLBACK GlobalWindowProc(HWND hWnd, uint32 msg, uint16 wParam, int32 lParam) {
- if ((HWND)theGame.m_wnd == NULL)
- return DefWindowProc(hWnd, msg, wParam, lParam);
-
- switch (msg) {
- case WM_CREATE:
- return 0;
-
- case WM_CLOSE:
- PostQuitMessage(0);
- return 0;
-
- default:
- return theGame.m_wnd.WindowProc(msg, wParam, lParam);
- }
-}
-#endif
-
-#ifdef REFACTOR_ME
-LRESULT RMWindow::WindowProc(uint32 msg, uint16 wParam, int32 lParam) {
- switch (msg) {
- case WM_ACTIVATE:
- if (LOWORD(wParam)!=WA_INACTIVE)
- theGame.Pause(false);
- else
- theGame.Pause(true);
- return 0;
-
- case WM_ENTERMENULOOP:
- case WM_ENTERSIZEMOVE:
- if (!m_bFullscreen)
- theGame.Pause(true);
- return 0;
-
- case WM_EXITMENULOOP:
- case WM_EXITSIZEMOVE:
- if (!m_bFullscreen)
- theGame.Pause(false);
- return 0;
-/*
- case WM_KEYDOWN:
- switch (wParam) {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9':
- if (GetAsyncKeyState(VK_CONTROL)&0x8000)
- theGame.SaveState(wParam-'0');
- else if (GetAsyncKeyState(VK_SHIFT)&0x8000)
- theGame.LoadState(wParam-'0');
- return 0;
- }
- return 0;
-*/
-
- case WM_PAINT:
-// Repaint();
- ValidateRect(m_hWnd, NULL);
- return 0;
-
- case WM_COMMAND:
- switch LOWORD(wParam) {
-/*
- case ID_OPTIONS:
- theGame.OptionScreen();
- break;
-*/
-
- case ID_FULLSCREEN:
- theGame.SwitchFullscreen(!m_bFullscreen);
- break;
-/*
- case ID_ENABLEINPUT:
- theGame.GetEngine()->EnableInput();
- break;
-*/
- case ID_SCREENSHOT:
- m_bGrabScreenshot = true;
-// m_bGrabMovie = !m_bGrabMovie;
- break;
-
- case ID_MOVIE:
-// m_bGrabMovie = !m_bGrabMovie;
- break;
-/*
- case ID_BLACKWHITE:
- m_bBlackWhite = !m_bBlackWhite;
- break;
-*/
- default:
- return DefWindowProc(m_hWnd, msg, wParam, lParam);
- }
- return 0;
-
- case WM_SYSKEYDOWN:
- if (m_bFullscreen)
- return 0;
- else
- return DefWindowProc(m_hWnd ,msg, wParam, lParam);
-
- default:
- if (m_hWnd != NULL) // Fix del bug visto da BoundsChecker
- return DefWindowProc(m_hWnd, msg, wParam, lParam);
- return 0;
- }
-}
-#endif
-
-/*
-HANDLE hWaitFlip;
-bool bExitThread;
-
-void DoFlipThread(LPDIRECTDRAWSURFACE lpDDSPrimary) {
- bExitThread=false;
- while (1) {
- WaitForSingleObject(hWaitFlip,INFINITE);
- if (bExitThread) _endthread();
- lpDDSPrimary->Flip(NULL,DDFLIP_WAIT);
- }
-}
-*/
-
-void RMWindow::InitDirectDraw(void) {
-#ifdef REFACTOR_ME
- DDInit();
-
- ShowCursor(false);
- ShowWindow(m_hWnd, SW_SHOW);
- UpdateWindow(m_hWnd);
-#endif
-}
-
-void RMWindow::Init(/*HINSTANCE hInst*/) {
-#ifdef REFACTOR_ME
- WNDCLASS wc;
-
- // Registra la classe di finestra
- wc.style = CS_HREDRAW|CS_VREDRAW;
- wc.lpfnWndProc = GlobalWindowProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInst;
- wc.hIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_ICON1));
- wc.hCursor = LoadCursor(NULL,IDC_ARROW);
- wc.hbrBackground = NULL;
- wc.lpszMenuName = NULL;
- wc.lpszClassName = "RMClass";
- RegisterClass(&wc);
-
- m_hWnd = CreateWindow(
- "RMClass",
- "Tony Tough and the night of Roasted Moths",
- WS_OVERLAPPEDWINDOW & (~WS_THICKFRAME) & (~WS_BORDER) & (~WS_MAXIMIZEBOX),
- 50, 50,
- RM_SX + GetSystemMetrics(SM_CXDLGFRAME) * 2,
- RM_SY + GetSystemMetrics(SM_CYDLGFRAME) * 2 + GetSystemMetrics(SM_CYMENU) + GetSystemMetrics(SM_CYCAPTION),
- NULL,
- NULL,
- hInst,
- NULL
- );
-
- if (m_hWnd == NULL) {
- int err = GetLastError();
- RMString str;
-
- str.Format("error: %u",err);
- MessageBox(NULL,str,"sux",MB_OK);
-
- assert(0);
- }
-
- // Inizializza la finestra directdraw
- //DDInit();
+void RMWindow::Init() {
+ initGraphics(RM_SX, RM_SY, false);
// Inizializza i conteggi degli FPS
fps = lastfcount = fcount = lastsecond = 0;
@@ -258,361 +81,20 @@ void RMWindow::Init(/*HINSTANCE hInst*/) {
m_bGrabScreenshot = false;
m_bGrabThumbnail = false;
m_bGrabMovie = false;
-
- //hWaitFlip = CreateEvent(NULL,false,false, NULL);
-#endif
}
void RMWindow::Close(void) {
- DDClose();
-#ifdef REFACTOR_ME
- DestroyWindow(m_hWnd);
-#endif
}
void RMWindow::GrabThumbnail(uint16 *thumbmem) {
- m_bGrabThumbnail = true;
- m_wThumbBuf = thumbmem;
-}
-
-float RGB_to_HSL(float r,float g, float b, float *h, float *s, float *l) {
- float v;
- float m;
- float vm;
- float r2, g2, b2;
-
- if (r > g) v = r; else v = g;
- if (v > b) v = v; else v = b;
- if (r < b) m = r; else m = b;
- if (m < b) m = m; else m = b;
-
- if ((*l = (m + v) / 2.0f) <= 0.0f) return *l;
- if ((*s = vm = v - m) > 0.0f) {
- *s /= (*l <= 0.5f) ? (v + m) : (2.0f - v - m) ;
- } else
- return *l;
-
- r2 = (v - r) / vm;
- g2 = (v - g) / vm;
- b2 = (v - b) / vm;
-
- if (r == v)
- *h = (g == m ? 5.0f + b2 : 1.0f - g2);
- else if (g == v)
- *h = (b == m ? 1.0f + r2 : 3.0f - b2);
- else
- *h = (r == m ? 3.0f + g2 : 5.0f - r2);
-
- *h /= 6;
-
- return *l;
-}
-
-#define ITOF(val) (float)((float)(val) / 31.0f)
-#define FTOI(val) (int)(((float)(val) * 31.0f + 0.5f))
-
-void RMWindow::CreateBWPrecalcTable(void) {
-#define CLAMP(var, min, max) var = (var < min ? min : (var > max ? max : var));
-
- int i;
- int r, g, b;
- int min, max;
- int shiftR, shiftG, shiftB;
-
- // Calcola i valori di shift in base alle maschere
- for (shiftR = 15; (mskRed & (1 << shiftR)) == 0; shiftR--)
- ;
- for (shiftG = 15; (mskGreen & (1 << shiftG)) == 0; shiftG--)
- ;
- for (shiftB = 15; (mskBlue & (1 << shiftB)) == 0; shiftB--)
- ;
-
- shiftR -= 4;
- shiftG -= 4;
- shiftB -= 4;
-
- // @@@ CLAMP inutile (in teoria)
- CLAMP(shiftR, 0, 15);
- CLAMP(shiftG, 0, 15);
- CLAMP(shiftB, 0, 15);
-
- for (i = 0; i < 0x10000; i++) {
- r=(i >> shiftR) & 0x1F;
- g=(i >> shiftG) & 0x1F;
- b=(i >> shiftB) & 0x1F;
-
-#if 1
- if (r < g) min=r; else min = g;
- if (b < min) min = b;
- if (r > g) max = r; else max = g;
- if (b > max) max = b;
- min = (min + max) / 2;
-#else
- // Nuova formula B&W. L'immagine è più fedele all'originale, ma l'effetto è peggiore
- float fr, fg, fb;
-
- fr = (float)r / 63.0f;
- fg = (float)g / 63.0f;
- fb = (float)b / 63.0f;
-
- min = (int)((fr*0.11f + fg*0.69f + fb*0.33f)*63.f);
-#endif
-
- /*
- RGB_to_HSL(ITOF(r), ITOF(g), ITOF(b), &h, &s, &l);
- min = FTOI(l);
- */
-
- r = min + 8 - 8;
- g = min + 5 - 8;
- b = min + 0 - 8;
-
- CLAMP(r, 0, 31);
- CLAMP(g, 0, 31);
- CLAMP(b, 0, 31);
-
- m_wPrecalcTable[i] = (b << shiftB) | (g << shiftG) | (r << shiftR);
- }
-}
-
-
-void RMWindow::DDClose(void) {
-#ifdef REFACTOR_ME
- DDRELEASE(m_Back);
- DDRELEASE(m_Primary);
- DDRELEASE(m_MainClipper);
- DDRELEASE(m_BackClipper);
- DDRELEASE(m_DD);
-#endif
-}
-
-void RMWindow::DDInit(void) {
-#ifdef REFACTOR_ME
- HRESULT err;
-
- // Crea DirectDraw
- err = DirectDrawCreate(NULL, &m_DD, NULL);
- assert(err == DD_OK);
-
- // Crea il clipper
- err = DirectDrawCreateClipper(0, &m_MainClipper, NULL);
- err=DirectDrawCreateClipper(0, &m_BackClipper, NULL);
-
- // Lo associa alla finestra
- m_MainClipper->SetHWnd(0, m_hWnd);
-
- // Setta la cooperazione a normal
- m_DD->SetCooperativeLevel(m_hWnd, DDSCL_NORMAL);
-
-#ifdef STARTFULLSCREEN
- // Di default in fullscreen
- m_bFullscreen=false; // Fa finta, per obbligarlo a cambiare
- m_Primary=m_Back=NULL;
- SwitchFullscreen(true);
-#else
- // Di default in finestra
- m_bFullscreen = true; // Fa finta, per obbligarlo a cambiare
- m_Primary = m_Back = NULL;
- SwitchFullscreen(false);
-#endif
-
-/*
- if (!ISMODE1() && !ISMODE2() && !ISMODE3() && !ISMODE4()) {
- RMString str;
- str.Format("Graphic mode not supported: %04x %04x %04x",mskRed,mskGreen,mskBlue);
- MessageBox(m_hWnd,str,"Debug",MB_OK);
- }
-*/
-#endif
+ warning("TODO: RMWindow::GrabThumbnail");
}
-
-void RMWindow::SwitchFullscreen(bool bFull) {
-#ifdef REFACTOR_ME
- HRESULT err;
- DDSURFACEDESC ddsd;
- DDSCAPS ddscaps;
- DDBLTFX ddbltfx;
- Common::Rect rcWin;
-
- // Se non c'e' niente da fare, esci
- if (bFull == m_bFullscreen)
- return;
-
- // Termina il thread di flipping
- //bExitThread = true;
-
- // Rilascia le superfici create in precedenza (se ce n'erano)
- DDRELEASE(m_Back);
- DDRELEASE(m_Primary);
-
- // Legge le coordinate della finestra
- if (m_bFullscreen) {
- rcWin.left = 50;
- rcWin.top = 50;
- } else {
- GetWindowRect(m_hWnd, &rcWin);
- }
-
- if (bFull) {
- // Setta la risoluzione
- m_DD->SetCooperativeLevel(m_hWnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN | DDSCL_ALLOWREBOOT);
- m_DD->SetDisplayMode(RM_SX, RM_SY, 16);
-
- // A tutto schermo, possiamo creare una catena di flipping
- ZeroMemory(&ddsd, sizeof(ddsd));
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS|DDSD_BACKBUFFERCOUNT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_COMPLEX | DDSCAPS_FLIP;
- ddsd.dwBackBufferCount = 1;
- if ((err=m_DD->CreateSurface(&ddsd, &m_Primary, NULL)) != DD_OK) {
- //wsprintf(errbuf,"Error creating primary surface2 (%lx)",err);
- //MessageBox(hWnd,errbuf,"grSwitchFullscreen()",MB_OK);
- assert(0);
- }
-
- ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
- if ((err=m_Primary->GetAttachedSurface(&ddscaps, &m_Back)) != DD_OK) {
- //wsprintf(errbuf,"Error getting attached surface2 (%lx)",err);
- //MessageBox(hWnd,errbuf,"grSwitchFullscreen()",MB_OK);
- assert(0);
- }
-
- // Pulisce i buffer
- ddbltfx.dwSize = sizeof(ddbltfx);
- ddbltfx.dwFillColor = 0;
- m_Back->Blt(NULL, NULL, NULL,DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
-
- ddbltfx.dwSize=sizeof(ddbltfx);
- ddbltfx.dwFillColor = 0;
- m_Primary->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
-
- // Inizializza il thread
- //_beginthread((void (*)(void*))DoFlipThread,10240,(void*)m_Primary);
- } else {
- // In windowed, non possiamo fare flipping (purtroppo)
- m_DD->RestoreDisplayMode();
- m_DD->SetCooperativeLevel(m_hWnd,DDSCL_NORMAL);
-
- ZeroMemory(&ddsd,sizeof(ddsd));
- ddsd.dwSize=sizeof(ddsd);
- ddsd.dwFlags=DDSD_CAPS;
- ddsd.ddsCaps.dwCaps=DDSCAPS_PRIMARYSURFACE;
- if ((err=m_DD->CreateSurface(&ddsd,&m_Primary, NULL)) != DD_OK) {
- //wsprintf(errbuf,"Error creating primary surface (%lx)",err);
- //MessageBox(hWnd,errbuf,"ChangeResolution()",MB_OK);
- assert(0);
- }
-
- ZeroMemory(&ddsd,sizeof(ddsd));
- ddsd.dwSize=sizeof(ddsd);
- ddsd.dwFlags=DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT;
- ddsd.ddsCaps.dwCaps=DDSCAPS_OFFSCREENPLAIN; // se puo', in video memory
- ddsd.dwWidth=RM_SX;
- ddsd.dwHeight=RM_SY;
- if ((err=m_DD->CreateSurface(&ddsd,&m_Back, NULL)) != DD_OK) {
- //wsprintf(errbuf,"Error creating backbuffer surface (%lx)",err);
- //MessageBox(hWnd,errbuf,"ChangeResolution()",MB_OK);
- assert(0);
- }
-
- // Pulizia per favore
- ddbltfx.dwSize = sizeof(ddbltfx);
- ddbltfx.dwFillColor = 0;
- m_Back->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &ddbltfx);
- }
-
- // Posiziona e ridimensiona la finestra
- if (bFull) {
- SetWindowPos(m_hWnd, HWND_TOP, 0, 0, RM_SX, RM_SY, 0);
-
- // Disabilita il clipper (non necessario)
- m_Primary->SetClipper(NULL);
- } else {
- SetWindowPos(m_hWnd, HWND_TOP, rcWin.left, rcWin.top, RM_SX + GetSystemMetrics(SM_CXDLGFRAME) * 2,
- RM_SY + GetSystemMetrics(SM_CYDLGFRAME) * 2 + GetSystemMetrics(SM_CYCAPTION), 0);
-
- m_Primary->SetClipper(m_MainClipper);
- //m_Primary->SetClipper(NULL);
- }
-
- // Si ricorda il nuovo stato
- m_bFullscreen = bFull;
- InvalidateRect(m_hWnd, NULL, false);
-
- // Legge il nuovo pixel format
- UpdatePixelFormat();
-#endif
-}
-
-void RMWindow::UpdatePixelFormat(void) {
-#ifdef REFACTOR_ME
- DDPIXELFORMAT ddpf;
-
- // Si fa ridare il nuovo pixel format
- ddpf.dwSize = sizeof(ddpf);
- m_Primary->GetPixelFormat(&ddpf);
-
- // Copia le componenti dei colori
- mskRed = ddpf.dwRBitMask;
- mskGreen = ddpf.dwGBitMask;
- mskBlue = ddpf.dwBBitMask;
-
- // Ricalcola la tabella per l'effetto b&w
- CreateBWPrecalcTable();
-#endif
-}
-
-
+/**
+ * Repaint the screen
+ */
void RMWindow::Repaint(void) {
-#ifdef REFACTOR_ME
- Common::Rect rcWin;
- HRESULT err;
-
- if (m_Primary==NULL)
- return;
-
- // Se siamo a tutto schermo, basta un flip
- if (m_bFullscreen) {
- m_DD->WaitForVerticalBlank(DDWAITVB_BLOCKBEGIN, NULL);
-
- // Flippa flappa
- while (1) {
- //err=m_Primary->Flip(NULL,DDFLIP_WAIT);
- err = m_Primary->BltFast(0, 0, m_Back, NULL, DDBLTFAST_WAIT);
-
- if (err==DD_OK)
- break;
- else if (err == DDERR_SURFACELOST) {
- //MessageBox(NULL,"Primary lost!","RMWindow::Repaint()",MB_OK);
- m_Primary->Restore();
- return;
- }
- }
- }
- // Altrimenti bisogna andare di blit
- else {
- // Si calcola il rettangolo effettivamente visibile
- GetWindowRect(m_hWnd, &rcWin);
- OffsetRect(&rcWin, GetSystemMetrics(SM_CXDLGFRAME), GetSystemMetrics(SM_CYDLGFRAME) + GetSystemMetrics(SM_CYCAPTION));
-
- // Aggiusta le dimensioni del rettangolo
- rcWin.right = rcWin.left + RM_SX;
- rcWin.bottom = rcWin.top + RM_SY;
-
- // Blit del back nel primary
- while (1) {
- err = m_Primary->Blt(&rcWin, m_Back, NULL,DDBLT_WAIT, NULL);
- if (err == DD_OK)
- break;
- else if (err == DDERR_SURFACELOST) {
- //MessageBox(NULL,"Primary lost!","RMWindow::Repaint()",MB_OK);
- m_Primary->Restore();
- return;
- }
- }
- }
-#endif
+ g_system->updateScreen();
}
diff --git a/engines/tony/window.h b/engines/tony/window.h
index 5949450e8f..2edf409ad0 100644
--- a/engines/tony/window.h
+++ b/engines/tony/window.h
@@ -81,28 +81,7 @@ private:
bool Lock(DDSURFACEDESC &ddsd);
void Unlock(DDSURFACEDESC &ddsd);
- // Inizializza DirectDraw
- void DDInit(void);
-
- // Chiude DirectDraw
- void DDClose(void);
-
- // Repaint grafico tramite DirectDraw
- void Repaint(void);
-
- // Window Proc principale che richiama la WindowProc dentro la classe
-// friend LRESULT CALLBACK GlobalWindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
- // Procedura di gestione messaggi
-// LRESULT WindowProc(UINT msg, WPARAM wParam, LPARAM lParam);
-
protected:
- HWND m_hWnd;
- bool m_bFullscreen;
-
- void * /*LPDIRECTDRAW*/ m_DD;
- void * /*LPDIRECTDRAWSURFACE*/ m_Primary;
- void * /*LPDIRECTDRAWSURFACE*/ m_Back;
void * /*LPDIRECTDRAWCLIPPER*/ m_MainClipper;
void * /*LPDIRECTDRAWCLIPPER*/ m_BackClipper;
@@ -117,37 +96,37 @@ protected:
uint16 *m_wThumbBuf;
void CreateBWPrecalcTable(void);
- void UpdatePixelFormat(void);
void WipeEffect(Common::Rect &rcBoundEllipse);
- public:
- RMWindow();
- ~RMWindow();
+public:
+ RMWindow();
+ ~RMWindow();
- // Inizializzazione
- void Init(/*HINSTANCE hInst*/);
- void InitDirectDraw(void);
- void Close(void);
+ // Inizializzazione
+ void Init(/*HINSTANCE hInst*/);
+ void InitDirectDraw(void);
+ void Close(void);
- // Switch tra windowed e fullscreen
- void SwitchFullscreen(bool bFull);
+ // Repaint grafico tramite DirectDraw
+ void Repaint(void);
- // Legge il prossimo frame
- void GetNewFrame(byte *lpBuf, Common::Rect *rcBoundEllipse);
+ // Switch tra windowed e fullscreen
+ void SwitchFullscreen(bool bFull) {}
- // Avverte di grabbare un thumbnail per il salvataggio
- void GrabThumbnail(uint16 *buf);
+ // Legge il prossimo frame
+ void GetNewFrame(byte *lpBuf, Common::Rect *rcBoundEllipse);
- operator HWND() { return m_hWnd; }
+ // Avverte di grabbare un thumbnail per il salvataggio
+ void GrabThumbnail(uint16 *buf);
- // Modi pixel format
- // MODE1: 1555
- // MODE2: 5515
- // MODE3: 5551
- bool ISMODE1() { return (mskRed == 0x7C00 && mskGreen == 0x3E0 && mskBlue== 0x1F); }
- bool ISMODE2() { return (mskRed == 0xF800 && mskGreen == 0x7E0 && mskBlue== 0x1F); }
- bool ISMODE3() { return (mskRed == 0xF800 && mskGreen == 0x7C0 && mskBlue== 0x3E); }
- bool ISMODE4() { return (mskBlue == 0xF800 && mskGreen == 0x7E0 && mskRed== 0x1F); }
+ // Modi pixel format
+ // MODE1: 1555
+ // MODE2: 5515
+ // MODE3: 5551
+ bool ISMODE1() { return (mskRed == 0x7C00 && mskGreen == 0x3E0 && mskBlue== 0x1F); }
+ bool ISMODE2() { return (mskRed == 0xF800 && mskGreen == 0x7E0 && mskBlue== 0x1F); }
+ bool ISMODE3() { return (mskRed == 0xF800 && mskGreen == 0x7C0 && mskBlue== 0x3E); }
+ bool ISMODE4() { return (mskBlue == 0xF800 && mskGreen == 0x7E0 && mskRed== 0x1F); }
};
} // End of namespace Tony