From 1e3e2b992b8bb51eeb81b75b93fe943b903033e4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 30 Nov 2016 15:38:33 -0800 Subject: CRYO: Fix regression, get rid of CLScreenView_CenterIn --- engines/cryo/cryo.cpp | 3 +++ engines/cryo/cryolib.cpp | 25 +++++++++---------------- engines/cryo/cryolib.h | 2 -- engines/cryo/eden.cpp | 4 ++-- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/engines/cryo/cryo.cpp b/engines/cryo/cryo.cpp index 1f15b0e5b3..b3f155c6d5 100644 --- a/engines/cryo/cryo.cpp +++ b/engines/cryo/cryo.cpp @@ -83,6 +83,9 @@ Common::Error CryoEngine::run() { _game = new EdenGame(this); _video = new HnmPlayer(this); + ///// CLTimer + TimerTicks = 0; // incremented in realtime + // Initialize graphics using following: initGraphics(320, 200, false); _screen.create(320, 200, Graphics::PixelFormat::createFormatCLUT8()); diff --git a/engines/cryo/cryolib.cpp b/engines/cryo/cryolib.cpp index 961af6427c..48e57ec381 100644 --- a/engines/cryo/cryolib.cpp +++ b/engines/cryo/cryolib.cpp @@ -53,9 +53,6 @@ int32 TickCount() { return g_system->getMillis(); } -///// CLTimer -volatile int32 TimerTicks = 0; // incremented in realtime - ///// CLView void CLView_SetSrcZoomValues(View *view, int x, int y) { view->_zoom._srcLeft = x; @@ -112,13 +109,6 @@ void CLView_CenterIn(View *parent, View *child) { child->_zoom._dstTop = (parent->_height - child->_zoom._height) / 2; } -///// CLScreenView -View ScreenView; - -void CLScreenView_CenterIn(View *view) { - CLView_CenterIn(&ScreenView, view); -} - ///// CLPalette uint16 gIntervalLast, gIntervalFirst, gIntervalSet; int16 gMacintize = 0; @@ -229,9 +219,10 @@ void CLBlitter_CopyView2ViewSimpleSize(byte *src, int16 srcw, int16 srcp, int16 dst += dstp - dstw; } } + void CLBlitter_CopyView2ScreenCUSTOM(View *view) { if (!view->_doubled) { - View *dest = &ScreenView; + View *dest = &g_ed->ScreenView; int16 srcpitch = view->_pitch; int16 dstpitch = dest->_pitch; @@ -245,6 +236,7 @@ void CLBlitter_CopyView2ScreenCUSTOM(View *view) { } else assert(0); } + void CLBlitter_CopyView2Screen(View *view) { if (useNewPalette) { color_t palette[256]; @@ -257,9 +249,10 @@ void CLBlitter_CopyView2Screen(View *view) { if (view) CLBlitter_CopyView2ScreenCUSTOM(view); - g_system->copyRectToScreen(ScreenView._bufferPtr, ScreenView._pitch, 0, 0, ScreenView._width, ScreenView._height); + g_system->copyRectToScreen(g_ed->ScreenView._bufferPtr, g_ed->ScreenView._pitch, 0, 0, g_ed->ScreenView._width, g_ed->ScreenView._height); g_system->updateScreen(); } + void CLBlitter_UpdateScreen() { CLBlitter_CopyView2Screen(nullptr); } @@ -274,11 +267,11 @@ void CLBlitter_FillView(View *view, unsigned int fill) { d += view->_pitch - view->_width; } } + void CLBlitter_FillScreenView(unsigned int fill) { - CLBlitter_FillView(&ScreenView, fill); + CLBlitter_FillView(&g_ed->ScreenView, fill); } - ///// events wrapper int _mouseButton; byte _keyState[256]; @@ -431,13 +424,13 @@ void CLSoundChannel_SetVolumeLeft(soundchannel_t *ch, int16 volume) { void CLTimer_Action(void *arg) { // long& counter = *((long*)arg); // counter++; - TimerTicks++; + g_ed->TimerTicks++; } ///// CRYOLib void CRYOLib_ManagersInit() { g_system->getTimerManager()->installTimerProc(CLTimer_Action, 10000, nullptr, "100hz timer"); - CLView_InitDatas(&ScreenView, g_ed->_screen.w, g_ed->_screen.h, g_ed->_screen.getPixels()); + CLView_InitDatas(&g_ed->ScreenView, g_ed->_screen.w, g_ed->_screen.h, g_ed->_screen.getPixels()); } void CRYOLib_ManagersDone() { diff --git a/engines/cryo/cryolib.h b/engines/cryo/cryolib.h index aa23e3d3f3..7af53a1c7f 100644 --- a/engines/cryo/cryolib.h +++ b/engines/cryo/cryolib.h @@ -224,8 +224,6 @@ void CLView_InitDatas(View *view, int w, int h, void *buffer); View *CLView_New(int w, int h); void CLView_CenterIn(View *parent, View *child); -void CLScreenView_CenterIn(View *view); - void CRYOLib_ManagersInit(); void CRYOLib_ManagersDone(); diff --git a/engines/cryo/eden.cpp b/engines/cryo/eden.cpp index ee6add2103..3b70cbd0ce 100644 --- a/engines/cryo/eden.cpp +++ b/engines/cryo/eden.cpp @@ -5550,7 +5550,7 @@ void EdenGame::openwindow() { CLBlitter_FillView(p_mainview, 0xFFFFFFFF); CLView_SetSrcZoomValues(p_mainview, 0, 0); CLView_SetDisplayZoomValues(p_mainview, 640, 400); - CLScreenView_CenterIn(p_mainview); + CLView_CenterIn(&_vm->ScreenView, p_mainview); p_mainview_buf = p_mainview->_bufferPtr; mouse_x_center = p_mainview->_normal._dstLeft + p_mainview->_normal._width / 2; @@ -6225,7 +6225,7 @@ void EdenGame::showMovie(char arg1) { p_hnmview = CLView_New(_hnmContext->_header._width, _hnmContext->_header._height); CLView_SetSrcZoomValues(p_hnmview, 0, 0); CLView_SetDisplayZoomValues(p_hnmview, _hnmContext->_header._width * 2, _hnmContext->_header._height * 2); - CLScreenView_CenterIn(p_hnmview); + CLView_CenterIn(&_vm->ScreenView, p_hnmview); p_hnmview_buf = p_hnmview->_bufferPtr; if (arg1) { p_hnmview->_normal._height = 160; -- cgit v1.2.3