From b0eef829728183b7ea170b30a33eca091bcc4574 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 30 Apr 2012 09:27:12 +1000 Subject: TONY: Added include files for graphics engine and all dependent classes --- engines/tony/gfxengine.cpp | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 engines/tony/gfxengine.cpp (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp new file mode 100644 index 0000000000..02ee7c8e8e --- /dev/null +++ b/engines/tony/gfxengine.cpp @@ -0,0 +1,53 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + */ +/************************************************************************** + * ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ * + * Nayma Software srl * + * e -= We create much MORE than ALL =- * + * u- z$$$c '. ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ * + * .d" d$$$$$b "b. * + * .z$* d$$$$$$$L ^*$c. * + * #$$$. $$$$$$$$$ .$$$" Project: Roasted Moths........ * + * ^*$b 4$$$$$$$$$F .d$*" * + * ^$$. 4$$$$$$$$$F .$P" Module: GfxEngine.CPP........ * + * *$. '$$$$$$$$$ 4$P 4 * + * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * + * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * + * z$" "" #$F^ "" '$c * + * z$$beu .ue=" $ "=e.. .zed$$c * + * "#$e z$*" . `. ^*Nc e$"" * + * "$$". .r" ^4. .^$$" * + * ^.@*"6L=\ebu^+C$"*b." * + * "**$. "c 4$$$ J" J$P*" OS: [ ] DOS [X] WIN95 [ ] PORT * + * ^"--.^ 9$" .--"" COMP: [ ] WATCOM [X] VISUAL C++ * + * " [ ] EIFFEL [ ] GCC/GXX/DJGPP * + * * + * This source code is Copyright (C) Nayma Software. ALL RIGHTS RESERVED * + * * + **************************************************************************/ + +#include "tony/gfxEngine.h" + +namespace Tony { + + +} // End of namespace Tony -- cgit v1.2.3 From 7d9156b12faf36197e8c3e97532675dcb9094f19 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 1 May 2012 23:00:03 +1000 Subject: TONY: Implemented GfxEngine code --- engines/tony/gfxengine.cpp | 949 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 949 insertions(+) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 02ee7c8e8e..b8accda7c6 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -45,9 +45,958 @@ * * **************************************************************************/ +#include "common/savefile.h" +#include "tony/mpal/lzo.h" +#include "tony/mpal/mpalutils.h" +#include "tony/custom.h" #include "tony/gfxEngine.h" +#include "tony/tony.h" namespace Tony { +extern bool bIdleExited; +extern bool bPatIrqFreeze; +extern bool bSkipSfxNoLoop; + +extern void ExitAllIdles(int nCurLoc); + +/****************************************************************************\ +* Metodi di RMGfxEngine +\****************************************************************************/ + +RMGfxEngine::RMGfxEngine() { + // Crea il big buffer dove verranno disegnati i frame + m_bigBuf.Create(RM_BBX,RM_BBY,16); + m_bigBuf.OffsetY(RM_SKIPY); +} + +RMGfxEngine::~RMGfxEngine() { + // Chiude il buffer + m_bigBuf.Destroy(); +} + +void RMGfxEngine::OpenOptionScreen(int type) { + bool bRes = false; + + switch (type) { + case 0: + bRes = m_opt.Init(m_bigBuf); + break; + case 1: + bRes = m_opt.InitLoadMenuOnly(m_bigBuf,true); + break; + case 2: + bRes = m_opt.InitNoLoadSave(m_bigBuf); + break; + case 3: + bRes = m_opt.InitLoadMenuOnly(m_bigBuf,false); + break; + case 4: + bRes = m_opt.InitSaveMenuOnly(m_bigBuf,false); + break; + } + + if (bRes) { + _vm->PauseSound(true); + + DisableInput(); + m_inv.EndCombine(); + m_curActionObj = 0; + m_curAction = TA_GOTO; + m_point.SetAction(m_curAction); + m_point.SetSpecialPointer(RMPointer::PTR_NONE); + m_point.SetCustomPointer(NULL); + EnableMouse(); + _vm->GrabThumbnail(); + + // Esce la IDLE onde evitare la morte prematura in caricamento + m_bMustEnterMenu = true; + if (type == 1 || type == 2) { + bIdleExited = true; + } else { + m_tony.StopNoAction(); + + uint32 id; + bIdleExited = false; + CreateThread(NULL, 10240, (LPTHREAD_START_ROUTINE)ExitAllIdles, (void *)m_nCurLoc, 0, &id); + } + } +} + +void RMGfxEngine::DoFrame(bool bDrawLocation) { + g_system->lockMutex(csMainLoop); + + // Poll dei dispositivi di input + m_input.Poll(); + + if (m_bMustEnterMenu && bIdleExited) { + m_bOption = true; + m_bMustEnterMenu = false; + bIdleExited = false; + } + + if (m_bOption) { + m_opt.DoFrame(&m_input); + m_bOption = !m_opt.IsClosing(); + if (!m_bOption) { + DisableMouse(); + EnableInput(); + mpalStartIdlePoll(m_nCurLoc); + _vm->PauseSound(false); + } + } + + if (bDrawLocation && m_bLocationLoaded) { + // Locazione e oggetti + m_loc.DoFrame(&m_bigBuf); + + // Controlla gli input del mouse + if (m_bInput && !m_tony.InAction()) { + // Se siamo sull'inventario, è lui che controlla tutti gli input + if (m_inv.HaveFocus(m_input.MousePos()) && !m_inter.Active()) { + // CLICK SINISTRO + // ************** + if (m_input.MouseLeftClicked()/* && m_itemName.IsItemSelected()*/) { + // Left click attiva il combine, se siamo su un oggetto + if (m_inv.LeftClick(m_input.MousePos(),m_curActionObj)) { + m_curAction = TA_COMBINE; + m_point.SetAction(m_curAction); + } + } + else + + // CLICK DESTRO + // ************ + if (m_input.MouseRightClicked()) { + if(m_itemName.IsItemSelected()) { + m_curActionObj=0; + m_inv.RightClick(m_input.MousePos()); + } else + m_inv.RightClick(m_input.MousePos()); + } else + + // RILASCIO DESTRO + // *************** + if (m_input.MouseRightReleased()) { + if (m_inv.RightRelease(m_input.MousePos(), m_curAction)) { + m_tony.MoveAndDoAction(m_itemName.GetHotspot(),m_itemName.GetSelectedItem(),m_curAction); + + m_curAction = TA_GOTO; + m_point.SetAction(m_curAction); + } + } + } else { + // Menu Opzioni + // ************ + if (m_bGUIOption) { + if (!m_tony.InAction() && m_bInput) { + if ((m_input.MouseLeftClicked() && m_input.MousePos().x < 3 && m_input.MousePos().y < 3)) { + OpenOptionScreen(0); + goto SKIPCLICKSINISTRO; + } else if ((GetAsyncKeyState(Common::KEYCODE_ESCAPE)&0x8001) == 0x8001) + OpenOptionScreen(0); + else if (_vm->getIsDemo()) { + if ((GetAsyncKeyState(Common::KEYCODE_F3) & 0x8001) == 0x8001) + OpenOptionScreen(3); + else if ((GetAsyncKeyState(Common::KEYCODE_F2) & 0x8001) == 0x8001) + OpenOptionScreen(4); + } + } + } + + // CLICK SINISTRO + // ************** + if (m_input.MouseLeftClicked() && !m_inter.Active()) + { + // Se clicko dentro un oggetto, esegui l'azione + //if (m_itemName.IsItemSelected()) + { + if (m_curAction != TA_COMBINE) + m_tony.MoveAndDoAction(m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_point.CurAction()); + else if (m_itemName.GetSelectedItem() != NULL) + m_tony.MoveAndDoAction(m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), TA_COMBINE, m_curActionObj); + } + + if (m_curAction == TA_COMBINE) { + m_inv.EndCombine(); + m_point.SetSpecialPointer(RMPointer::PTR_NONE); + } + + m_curAction = TA_GOTO; + m_point.SetAction(m_curAction); + } + +SKIPCLICKSINISTRO: + // CLICK DESTRO + // ************ + if (m_curAction == TA_COMBINE) { + // Durante il combine, lo annulla. + if (m_input.MouseRightClicked()) { + m_inv.EndCombine(); + m_curActionObj = 0; + m_curAction = TA_GOTO; + m_point.SetAction(m_curAction); + m_point.SetSpecialPointer(RMPointer::PTR_NONE); + } + } else if (m_input.MouseRightClicked() && m_itemName.IsItemSelected() && m_point.GetSpecialPointer() == RMPointer::PTR_NONE) { + if (m_bGUIInterface) { + // Prima di aprire l'interfaccia, rimette GOTO + m_curAction = TA_GOTO; + m_curActionObj = 0; + m_point.SetAction(m_curAction); + m_inter.Clicked(m_input.MousePos()); + } + } + + + // RILASCIO DESTRO + // *************** + if (m_input.MouseRightReleased()) { + if (m_bGUIInterface) { + if (m_inter.Released(m_input.MousePos(),m_curAction)) { + m_point.SetAction(m_curAction); + m_tony.MoveAndDoAction(m_itemName.GetHotspot(),m_itemName.GetSelectedItem(), m_curAction); + + m_curAction = TA_GOTO; + m_point.SetAction(m_curAction); + } + } + } + } + + // Aggiorna il nome sotto il puntatore del mouse + m_itemName.SetMouseCoord(m_input.MousePos()); + if (!m_inter.Active() && !m_inv.MiniActive()) + m_itemName.DoFrame(m_bigBuf,m_loc,m_point,m_inv); + } + + // Inventario & interfaccia + m_inter.DoFrame(m_bigBuf, m_input.MousePos()); + m_inv.DoFrame(m_bigBuf, m_point, m_input.MousePos(), (!m_tony.InAction() && !m_inter.Active() && m_bGUIInventory)); + } + + // Anima Tony + m_tony.DoFrame(&m_bigBuf,m_nCurLoc); + + // Aggiorna lo scrolling per tenere Tony dentro lo schermo + if (m_tony.MustUpdateScrolling() && m_bLocationLoaded) { + RMPoint showThis = m_tony.Position(); + showThis.y -= 60; + m_loc.UpdateScrolling(showThis); + } + + if (m_bLocationLoaded) + m_tony.SetScrollPosition(m_loc.ScrollPosition()); + + if ((!m_tony.InAction() && m_bInput) || m_bAlwaysDrawMouse) { + m_point.SetCoord(m_input.MousePos()); + m_point.DoFrame(&m_bigBuf); + } + + // ********************** + // Disegna la lista di OT + // ********************** + m_bigBuf.DrawOT(); + +#define FSTEP (480/32) + + // Wipe + if (m_bWiping) { + switch (m_nWipeType) { + case 1: + if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top >= FSTEP * 2)) { + SetEvent(m_hWipeEvent); + m_nWipeType = 3; + break; + } + + m_rcWipeEllipse.top += FSTEP; + m_rcWipeEllipse.left += FSTEP; + m_rcWipeEllipse.right -= FSTEP; + m_rcWipeEllipse.bottom -= FSTEP; + break; + + case 2: + if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top < 480 - FSTEP)) { + SetEvent(m_hWipeEvent); + m_nWipeType = 3; + break; + } + + m_rcWipeEllipse.top -= FSTEP; + m_rcWipeEllipse.left -= FSTEP; + m_rcWipeEllipse.right += FSTEP; + m_rcWipeEllipse.bottom += FSTEP; + break; + } + } + + g_system->unlockMutex(csMainLoop); +} + + +void RMGfxEngine::InitCustomDll(void) { + SetupGlobalVars(&m_tony, &m_point, &_vm->_theBoxes, &m_loc, &m_inv, &m_input); +} + +void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) { + static RMGfxEngine *This = NULL; + RMItem *item; + + // Inizializzazione! + if ((int)dwItem == -1) { + This = (RMGfxEngine*)nPattern; + return; + } + + if (This->m_bLocationLoaded) { + item=This->m_loc.GetItemFromCode(dwItem); + if (item != NULL) { + if (nPattern!=-1) { + if (bPatIrqFreeze) + MainFreeze(); + item->SetPattern(nPattern,true); + if (bPatIrqFreeze) + MainUnfreeze(); + } + if (nStatus!=-1) + item->SetStatus(nStatus); + } + } +} + +/* + // WINBUG: This is a special case for the file open/save dialog, + // which sometimes pumps while it is coming up but before it has + // disabled the main window. + HWND hWndFocus = ::GetFocus(); + bool bEnableParent = false; + m_ofn.hwndOwner = PreModal(); + AfxUnhookWindowCreate(); + if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner)) + { + bEnableParent = true; + ::EnableWindow(m_ofn.hwndOwner, false); + } + + _AFX_THREAD_STATE* pThreadState = AfxGetThreadState(); + ASSERT(pThreadState->m_pAlternateWndInit == NULL); + + if (m_ofn.Flags & OFN_EXPLORER) + pThreadState->m_pAlternateWndInit = this; + else + AfxHookWindowCreate(this); + + int nResult; + if (m_bOpenFileDialog) + nResult = ::GetOpenFileName(&m_ofn); + else + nResult = ::GetSaveFileName(&m_ofn); + + if (nResult) + ASSERT(pThreadState->m_pAlternateWndInit == NULL); + pThreadState->m_pAlternateWndInit = NULL; + + // WINBUG: Second part of special case for file open/save dialog. + if (bEnableParent) + ::EnableWindow(m_ofn.hwndOwner, true); + if (::IsWindow(hWndFocus)) + ::SetFocus(hWndFocus); +*/ + + +void RMGfxEngine::SelectLocation(RMPoint ptTonyStart, RMPoint start) { +#if 0 + OPENFILENAME ofn; + char lpszFileName[512]; + + // @@@ Con TonyStart=-1,-1 allora usa la posizione scritta nella locazione + + // Sceglie la locazione + ZeroMemory(lpszFileName,512); + ZeroMemory(&ofn,sizeof(ofn)); + ofn.lStructSize=sizeof(ofn); + ofn.hwndOwner=NULL; + ofn.lpstrFilter="Locazione (*.LOC)\0*.LOC\0Locazione ottimizzata (*.LOX)\0*.LOX\0Tutti i files (*.*)\0*.*\0"; + ofn.lpstrCustomFilter=NULL; + ofn.nFilterIndex=1; + ofn.lpstrFile=lpszFileName; + ofn.nMaxFile=512; + ofn.lpstrInitialDir=NULL; + ofn.lpstrTitle="Load Location"; + ofn.Flags=OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST; + + if (!GetOpenFileName(&ofn)) + ASSERT(0); + + // Carica la locazione + m_loc.Load(lpszFileName); + m_bLocationLoaded = true; + m_nCurLoc=m_loc.TEMPGetNumLoc(); + + if (ptTonyStart.x==-1 && ptTonyStart.y==-1) + InitForNewLocation(m_loc.TEMPGetNumLoc(),m_loc.TEMPGetTonyStart(),RMPoint(-1,-1)); + else + InitForNewLocation(m_loc.TEMPGetNumLoc(),ptTonyStart,start); +#endif +} + +void RMGfxEngine::InitForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { + if (start.x == -1 || start.y == -1) { + start.x = ptTonyStart.x-RM_SX / 2; + start.y = ptTonyStart.y-RM_SY / 2; + } + + m_loc.SetScrollPosition(start); + + if (ptTonyStart.x==0 && ptTonyStart.y == 0) { + } else { + m_tony.SetPosition(ptTonyStart,nLoc); + m_tony.SetScrollPosition(start); + } + + m_curAction = TA_GOTO; + m_point.SetCustomPointer(NULL); + m_point.SetSpecialPointer(RMPointer::PTR_NONE); + m_point.SetAction(m_curAction); + m_inter.Reset(); + m_inv.Reset(); + + mpalStartIdlePoll(m_nCurLoc); +} + +HANDLE RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { + bool bLoaded; + int i; + + m_nCurLoc=nLoc; + + bLoaded = false; + for (i=0; i < 5; i++) { + // Retry sul loading della locazione + RMRes res(m_nCurLoc); + if (!res.IsValid()) + continue; +#if 0 + // codice per dumpare una locazione in caso serva una modifica + if (nLoc == 106) + { + FILE *f = fopen("loc106.lox", "wb"); + fwrite(res.DataPointer(), res.Size(), 1, f); + fclose(f); + } +#endif + m_loc.Load(res); + InitForNewLocation(nLoc,ptTonyStart,start); + bLoaded = true; + break; + } + + if (!bLoaded) + SelectLocation(ptTonyStart,start); + + if (m_bOption) + m_opt.ReInit(m_bigBuf); + + m_bLocationLoaded = true; + + // On Enter per la locazion + return INVALID_HANDLE_VALUE; //mpalQueryDoAction(0,m_nCurLoc,0); +} + +HANDLE RMGfxEngine::UnloadLocation(bool bDoOnExit) +{ + HANDLE h; + + // Scarica tutta la memoria della locazione + mpalEndIdlePoll(m_nCurLoc); + + // On Exit? + if (bDoOnExit) + { + h=mpalQueryDoAction(1,m_nCurLoc,0); + if (h!=INVALID_HANDLE_VALUE) + WaitForSingleObject(h,INFINITE); + } + + MainFreeze(); + + m_bLocationLoaded = false; + + m_bigBuf.ClearOT(); + m_loc.Unload(); + + return INVALID_HANDLE_VALUE; +} + +void RMGfxEngine::Init(/*HINSTANCE hInst*/) { +/* + //RECUPERARE UNA LOCAZIONE: + + RMRes res(5); + ASSERT(res.IsValid()); + FILE *f; + f=fopen("c:\\code\\rm\\new\\pippo.loc","wb"); + fwrite(res,1,5356900,f); + fclose(f); +*/ + + // Schermata di loading + RMResRaw *raw; + RMGfxSourceBuffer16 *load = NULL; + INIT_GFX16_FROMRAW(20038, load); + m_bigBuf.AddPrim(new RMGfxPrimitive(load)); + m_bigBuf.DrawOT(); + m_bigBuf.ClearOT(); + delete load; + _vm->m_wnd.GetNewFrame(*this, NULL); + + + + bPatIrqFreeze = true; + + // GUI attivabile + m_bGUIOption = true; + m_bGUIInterface = true; + m_bGUIInventory = true; + + bSkipSfxNoLoop = false; + m_bMustEnterMenu = false; + bIdleExited = false; + m_bOption = false; + m_bWiping = false; + m_hWipeEvent = CreateEvent(NULL, false, false, NULL); + + // Inizializza la funzione di IRQ di Item per l'MPAL + ItemIrq((uint32)-1, (uint32)this, 0); + mpalInstallItemIrq(ItemIrq); + + // Inizializza DirectInput + m_input.Init(/*hInst*/); + + // Inizializza il puntatore del mouse + m_point.Init(); + + // Inizializza Tony + m_tony.Init(); + m_tony.LinkToBoxes(&_vm->_theBoxes); + + // Inizializza l'inventario e l'interfaccia + m_inv.Init(); + m_inter.Init(); + + // Carica la locazione e setta le priorità @@@@@ + m_bLocationLoaded = false; +/* + m_nCurLoc=1; + RMRes res(m_nCurLoc); + m_loc.Load(res); + m_loc.SetPriority(1); + m_tony.SetPosition(RMPoint(201,316),1); + //m_tony.SetPosition(RMPoint(522,305),2); + //m_tony.SetPosition(RMPoint(158,398),4); + m_tony.SetPattern(m_tony.PAT_STANDDOWN); + m_curAction=TA_GOTO; +*/ + EnableInput(); + + // Inizio del gioco + //m_tony.ExecuteAction(4,1,0); //PREGAME + + m_tony.ExecuteAction(20,1,0); + +// theLog << "Seleziona la locazione\n"; + //LoadLocation(1,RMPoint(201,316),RMPoint(-1,-1)); + //SelectLocation(); + //LoadLocation(5,RMPoint(685,338),RMPoint(-1,-1)); + //LoadLocation(7,RMPoint(153,424),RMPoint(-1,-1)); + //LoadLocation(70,RMPoint(10,10),RMPoint(-1,-1)); + //LoadLocation(20,RMPoint(112,348),RMPoint(-1,-1)); + //LoadLocation(26,RMPoint(95,456),RMPoint(-1,-1)); + //LoadLocation(12,RMPoint(221,415),RMPoint(-1,-1)); + //LoadLocation(25,RMPoint(221,415),RMPoint(-1,-1)); + //LoadLocation(16,RMPoint(111,438),RMPoint(-1,-1)); + //LoadLocation(60,RMPoint(18,302),RMPoint(-1,-1)); + + // CASTELLO + + //LoadLocation(40,RMPoint(233,441),RMPoint(-1,-1)); +} + +void RMGfxEngine::Close(void) +{ + m_bigBuf.ClearOT(); + + m_inter.Close(); + m_inv.Close(); + m_tony.Close(); + m_point.Close(); + m_input.Close(); +} + +void RMGfxEngine::SwitchFullscreen(bool bFull) +{ + m_input.SwitchFullscreen(bFull); +} + +void RMGfxEngine::GDIControl(bool bCon) +{ + m_input.GDIControl(bCon); +} + +/* +void RMGfxEngine::OptionScreen(void) +{ + if (!m_bOption) + { + if (m_opt.Init(m_bigBuf)) + { + m_bOption = true; + DisableInput(); + EnableMouse(); + } + } + else + { + if (m_opt.Close()) + { + m_bOption = false; + DisableMouse(); + EnableInput(); + } + } +} +*/ + +void RMGfxEngine::EnableInput(void) +{ + m_bInput = true; +} + +void RMGfxEngine::DisableInput(void) +{ + m_bInput = false; + m_inter.Reset(); +} + +void RMGfxEngine::EnableMouse(void) +{ + m_bAlwaysDrawMouse = true; +} + +void RMGfxEngine::DisableMouse(void) +{ + m_bAlwaysDrawMouse = false; +} + +void RMGfxEngine::Freeze(void) +{ + g_system->lockMutex(csMainLoop); +} + +void RMGfxEngine::Unfreeze(void) +{ + g_system->unlockMutex(csMainLoop); +} + +void CharsSaveAll(Common::OutSaveFile *f); +void CharsLoadAll(Common::InSaveFile *f); +void MCharResetCodes(void); +void SaveChangedHotspot(Common::OutSaveFile *f); +void LoadChangedHotspot(Common::InSaveFile *f); +void ReapplyChangedHotspot(void); + +void RestoreMusic(void); +void SaveMusic(Common::OutSaveFile *f); +void LoadMusic(Common::InSaveFile *f); + +unsigned char wrkmem[LZO1X_999_MEM_COMPRESS]; + +void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bool bFastCompress) { + Common::OutSaveFile *f; + byte *state, *statecmp; + byte *thumbcmp; + uint thumbsizecmp, thumbsize; + uint size, sizecmp; + int i; + char buf[4]; + RMPoint tp = m_tony.Position(); + + // Salvataggio: variabili mpal + locazione corrente + posizione di tony + inventario + + // Per ora salviamo solo lo stato MPAL + size=mpalGetSaveStateSize(); + state = new byte[size]; + statecmp = new byte[size*2]; + mpalSaveState(state); + + thumbcmp = new byte[160 * 120 * 4]; + thumbsize = 160 * 120 * 2; + + if (bFastCompress) { + lzo1x_1_compress(state,size,statecmp,&sizecmp,wrkmem); + lzo1x_1_compress(curThumb,thumbsize,thumbcmp,&thumbsizecmp,wrkmem); + } else { + lzo1x_999_compress(state,size,statecmp,&sizecmp,wrkmem); + lzo1x_999_compress(curThumb,thumbsize,thumbcmp,&thumbsizecmp,wrkmem); + } + + buf[0] = 'R'; + buf[1] = 'M'; + buf[2] = 'S'; + buf[3] = 0x7; + + f = g_system->getSavefileManager()->openForSaving(fn); + if (f==NULL) return; + f->write(buf, 4); + f->writeUint32LE(thumbsizecmp); + f->write(thumbcmp, thumbsizecmp); + + // Livello di difficoltà + i = mpalQueryGlobalVar("VERSIONEFACILE"); + f->writeByte(i); + + i=strlen(name); + f->writeByte(i); + f->write(name, i); + f->writeUint32LE(m_nCurLoc); + f->writeUint32LE(tp.x); + f->writeUint32LE(tp.y); + f->writeUint32LE(size); + f->writeUint32LE(sizecmp); + f->write(statecmp, sizecmp); + delete[] state; + delete[] statecmp; + delete[] thumbcmp; + + // inventario + size = m_inv.GetSaveStateSize(); + state = new byte[size]; + m_inv.SaveState(state); + f->writeUint32LE(size); + f->write(state, size); + delete[] state; + + // boxes + size = _vm->_theBoxes.GetSaveStateSize(); + state = new byte[size]; + _vm->_theBoxes.SaveState(state); + f->writeUint32LE(size); + f->write(state, size); + delete[] state; + + // New Ver5 + bool bStat; + + // Salva lo stato della pastorella e del palesati + bStat = m_tony.GetPastorella(); + f->writeByte(bStat); + bStat = m_inter.GetPalesati(); + f->writeByte(bStat); + + // Salva gli mchar + CharsSaveAll(f); + + // Salva le opzioni + f->writeByte(bCfgInvLocked); + f->writeByte(bCfgInvNoScroll); + f->writeByte(bCfgTimerizedText); + f->writeByte(bCfgInvUp); + f->writeByte(bCfgAnni30); + f->writeByte(bCfgAntiAlias); + f->writeByte(bCfgSottotitoli); + f->writeByte(bCfgTransparence); + f->writeByte(bCfgInterTips); + f->writeByte(bCfgDubbing); + f->writeByte(bCfgMusic); + f->writeByte(bCfgSFX); + f->writeByte(nCfgTonySpeed); + f->writeByte(nCfgTextSpeed); + f->writeByte(nCfgDubbingVolume); + f->writeByte(nCfgMusicVolume); + f->writeByte(nCfgSFXVolume); + + // Salva gli hotspot + SaveChangedHotspot(f); + + // Salva la musica + SaveMusic(f); + + f->finalize(); + delete f; +} + +void RMGfxEngine::LoadState(const char *fn) { + // PROBLEMA: Bisognerebbe caricare la locazione in un thread a parte per fare la OnEnter ... + Common::InSaveFile *f; + byte *state, *statecmp; + uint size, sizecmp; + char buf[4]; + RMPoint tp; + int loc; + int ver; + int i; + + f = g_system->getSavefileManager()->openForLoading(fn); + if (f == NULL) return; + f->read(buf, 4); + if (buf[0] != 'R' || buf[1] != 'M' || buf[2] != 'S') { + delete f; + return; + } + + ver = buf[3]; + + if (ver != 0x1 && ver != 0x2 && ver != 0x3 && ver != 0x4 && ver != 0x5 && ver != 0x6 && ver != 0x7) { + delete f; + return; + } + + if (ver >= 0x3) { + // C'è il thumbnail. Se ver >= 5, è compresso + if (ver >= 0x5) { + i = 0; + i = f->readUint32LE(); + f->seek(i); + } else + f->seek(160 * 120 * 2, SEEK_CUR); + } + + if (ver >= 0x5) { + // Skip del livello di difficoltà + f->seek(1, SEEK_CUR); + } + + if (ver >= 0x4) { // Skippa il nome, che non serve a nessuno + i = f->readByte(); + f->seek(i, SEEK_CUR); + } + + loc = f->readUint32LE(); + loc = f->readUint32LE(); + tp.x = f->readUint32LE(); + tp.y = f->readUint32LE(); + size = f->readUint32LE(); + + if (ver >= 0x5) { + // Stato MPAL compresso! + sizecmp = f->readUint32LE(); + state = new byte[size]; + statecmp = new byte[sizecmp]; + f->read(statecmp, sizecmp); + lzo1x_decompress(statecmp,sizecmp,state,&size); + delete[] statecmp; + } else { + state = new byte[size]; + f->read(state, size); + } + + mpalLoadState(state); + delete[] state; + + + // inventario + size = f->readUint32LE(); + state = new byte[size]; + f->read(state, size); + m_inv.LoadState(state); + delete[] state; + + if (ver >= 0x2) { // Versione 2: box please + size = f->readUint32LE(); + state = new byte[size]; + f->read(state, size); + _vm->_theBoxes.LoadState(state); + delete[] state; + } + + if (ver >= 5) { + // Versione 5: + bool bStat = false; + + bStat = f->readByte(); + m_tony.SetPastorella(bStat); + bStat = f->readByte(); + m_inter.SetPalesati(bStat); + + CharsLoadAll(f); + } + + if (ver >= 6) { + // Carica le opzioni + bCfgInvLocked = f->readByte(); + bCfgInvNoScroll = f->readByte(); + bCfgTimerizedText = f->readByte(); + bCfgInvUp = f->readByte(); + bCfgAnni30 = f->readByte(); + bCfgAntiAlias = f->readByte(); + bCfgSottotitoli = f->readByte(); + bCfgTransparence = f->readByte(); + bCfgInterTips = f->readByte(); + bCfgDubbing = f->readByte(); + bCfgMusic = f->readByte(); + bCfgSFX = f->readByte(); + nCfgTonySpeed = f->readByte(); + nCfgTextSpeed = f->readByte(); + nCfgDubbingVolume = f->readByte(); + nCfgMusicVolume = f->readByte(); + nCfgSFXVolume = f->readByte(); + + // Carica gli hotspot + LoadChangedHotspot(f); + } + + if (ver >= 7) { + LoadMusic(f); + } + + delete f; + + UnloadLocation(false); + LoadLocation(loc,tp,RMPoint(-1, -1)); + m_tony.SetPattern(RMTony::PAT_STANDRIGHT); + MainUnfreeze(); + + // Le versioni vecchie necessitano di On enter + if (ver < 5) + mpalQueryDoAction(0,loc,0); + else { + // In quelle nuove, ci basta resettare gli mcode + MCharResetCodes(); + } + + if (ver >= 6) + ReapplyChangedHotspot(); + + RestoreMusic(); + + m_bGUIInterface = true; + m_bGUIInventory = true; + m_bGUIOption = true; +} + +void RMGfxEngine::PauseSound(bool bPause) { + if (m_bLocationLoaded) + m_loc.PauseSound(bPause); +} + +void RMGfxEngine::InitWipe(int type) { + m_bWiping = true; + m_nWipeType=type; + m_nWipeStep=0; + + if (m_nWipeType == 1) + m_rcWipeEllipse = Common::Rect(80, 0, 640 - 80, 480); + else if (m_nWipeType == 2) + m_rcWipeEllipse = Common::Rect(320 - FSTEP, 240 - FSTEP, 320 + FSTEP, 240 + FSTEP); +} + +void RMGfxEngine::CloseWipe(void) { + m_bWiping = false; +} + +void RMGfxEngine::WaitWipeEnd(void) { + WaitForSingleObject(m_hWipeEvent,INFINITE); +} } // End of namespace Tony -- cgit v1.2.3 From a2982a0b20027f658c9b47266a8ddbec74a15878 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 3 May 2012 22:49:30 +1000 Subject: TONY: Engine is now compiling and linking again --- engines/tony/gfxengine.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index b8accda7c6..d4ea8ee821 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -58,15 +58,25 @@ extern bool bIdleExited; extern bool bPatIrqFreeze; extern bool bSkipSfxNoLoop; -extern void ExitAllIdles(int nCurLoc); /****************************************************************************\ * Metodi di RMGfxEngine \****************************************************************************/ +bool bIdleExited; + +void ExitAllIdles(int nCurLoc) { + // Chiude le idle + bSkipSfxNoLoop = true; + mpalEndIdlePoll(nCurLoc); + bIdleExited = true; + bSkipSfxNoLoop = false; + ExitThread(0); +} + RMGfxEngine::RMGfxEngine() { // Crea il big buffer dove verranno disegnati i frame - m_bigBuf.Create(RM_BBX,RM_BBY,16); + m_bigBuf.Create(RM_BBX, RM_BBY, 16); m_bigBuf.OffsetY(RM_SKIPY); } -- cgit v1.2.3 From 6d0f1fca46c8bd9b5b4e7ccaf6631850c29d1447 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 3 May 2012 23:08:19 +1000 Subject: TONY: Formatting fixes --- engines/tony/gfxengine.cpp | 74 +++++++++++----------------------------------- 1 file changed, 18 insertions(+), 56 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index d4ea8ee821..77a196f853 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -139,7 +139,7 @@ void RMGfxEngine::DoFrame(bool bDrawLocation) { // Poll dei dispositivi di input m_input.Poll(); - if (m_bMustEnterMenu && bIdleExited) { + if (m_bMustEnterMenu && bIdleExited) { m_bOption = true; m_bMustEnterMenu = false; bIdleExited = false; @@ -216,8 +216,7 @@ void RMGfxEngine::DoFrame(bool bDrawLocation) { // CLICK SINISTRO // ************** - if (m_input.MouseLeftClicked() && !m_inter.Active()) - { + if (m_input.MouseLeftClicked() && !m_inter.Active()) { // Se clicko dentro un oggetto, esegui l'azione //if (m_itemName.IsItemSelected()) { @@ -383,8 +382,7 @@ void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) { bool bEnableParent = false; m_ofn.hwndOwner = PreModal(); AfxUnhookWindowCreate(); - if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner)) - { + if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner)) { bEnableParent = true; ::EnableWindow(m_ofn.hwndOwner, false); } @@ -489,8 +487,7 @@ HANDLE RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { continue; #if 0 // codice per dumpare una locazione in caso serva una modifica - if (nLoc == 106) - { + if (nLoc == 106) { FILE *f = fopen("loc106.lox", "wb"); fwrite(res.DataPointer(), res.Size(), 1, f); fclose(f); @@ -514,19 +511,17 @@ HANDLE RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { return INVALID_HANDLE_VALUE; //mpalQueryDoAction(0,m_nCurLoc,0); } -HANDLE RMGfxEngine::UnloadLocation(bool bDoOnExit) -{ +HANDLE RMGfxEngine::UnloadLocation(bool bDoOnExit) { HANDLE h; // Scarica tutta la memoria della locazione mpalEndIdlePoll(m_nCurLoc); // On Exit? - if (bDoOnExit) - { - h=mpalQueryDoAction(1,m_nCurLoc,0); - if (h!=INVALID_HANDLE_VALUE) - WaitForSingleObject(h,INFINITE); + if (bDoOnExit) { + h = mpalQueryDoAction(1, m_nCurLoc, 0); + if (h != INVALID_HANDLE_VALUE) + WaitForSingleObject(h, INFINITE); } MainFreeze(); @@ -633,8 +628,7 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { //LoadLocation(40,RMPoint(233,441),RMPoint(-1,-1)); } -void RMGfxEngine::Close(void) -{ +void RMGfxEngine::Close(void) { m_bigBuf.ClearOT(); m_inter.Close(); @@ -644,68 +638,36 @@ void RMGfxEngine::Close(void) m_input.Close(); } -void RMGfxEngine::SwitchFullscreen(bool bFull) -{ +void RMGfxEngine::SwitchFullscreen(bool bFull) { m_input.SwitchFullscreen(bFull); } -void RMGfxEngine::GDIControl(bool bCon) -{ +void RMGfxEngine::GDIControl(bool bCon) { m_input.GDIControl(bCon); } -/* -void RMGfxEngine::OptionScreen(void) -{ - if (!m_bOption) - { - if (m_opt.Init(m_bigBuf)) - { - m_bOption = true; - DisableInput(); - EnableMouse(); - } - } - else - { - if (m_opt.Close()) - { - m_bOption = false; - DisableMouse(); - EnableInput(); - } - } -} -*/ - -void RMGfxEngine::EnableInput(void) -{ +void RMGfxEngine::EnableInput(void) { m_bInput = true; } -void RMGfxEngine::DisableInput(void) -{ +void RMGfxEngine::DisableInput(void) { m_bInput = false; m_inter.Reset(); } -void RMGfxEngine::EnableMouse(void) -{ +void RMGfxEngine::EnableMouse(void) { m_bAlwaysDrawMouse = true; } -void RMGfxEngine::DisableMouse(void) -{ +void RMGfxEngine::DisableMouse(void) { m_bAlwaysDrawMouse = false; } -void RMGfxEngine::Freeze(void) -{ +void RMGfxEngine::Freeze(void) { g_system->lockMutex(csMainLoop); } -void RMGfxEngine::Unfreeze(void) -{ +void RMGfxEngine::Unfreeze(void) { g_system->unlockMutex(csMainLoop); } -- cgit v1.2.3 From 5b2c69b1f291b1ee3d7f3be4ffd40e427b437ac6 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 4 May 2012 00:11:38 +1000 Subject: TONY: Implemented some missing and incorrect init code --- engines/tony/gfxengine.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 77a196f853..940fb2afe8 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -572,6 +572,9 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { m_bWiping = false; m_hWipeEvent = CreateEvent(NULL, false, false, NULL); + // Crea l'evento di freeze + csMainLoop = g_system->createMutex(); + // Inizializza la funzione di IRQ di Item per l'MPAL ItemIrq((uint32)-1, (uint32)this, 0); mpalInstallItemIrq(ItemIrq); -- cgit v1.2.3 From 9482eac1f2fc7202eb4aaa72f63552bd35f5c66e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 4 May 2012 22:09:24 +1000 Subject: TONY: Some formatting fixes --- engines/tony/gfxengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 940fb2afe8..dd557efafd 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -49,7 +49,7 @@ #include "tony/mpal/lzo.h" #include "tony/mpal/mpalutils.h" #include "tony/custom.h" -#include "tony/gfxEngine.h" +#include "tony/gfxengine.h" #include "tony/tony.h" namespace Tony { @@ -934,7 +934,7 @@ void RMGfxEngine::LoadState(const char *fn) { // Le versioni vecchie necessitano di On enter if (ver < 5) - mpalQueryDoAction(0,loc,0); + mpalQueryDoAction(0, loc, 0); else { // In quelle nuove, ci basta resettare gli mcode MCharResetCodes(); -- cgit v1.2.3 From 3454a0a9c3738b09ac8de417297cb1f8adb0d2da Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 May 2012 00:40:23 +1000 Subject: TONY: A few more compiler warning fixes --- engines/tony/gfxengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index dd557efafd..6b5105bc35 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -934,7 +934,7 @@ void RMGfxEngine::LoadState(const char *fn) { // Le versioni vecchie necessitano di On enter if (ver < 5) - mpalQueryDoAction(0, loc, 0); + mpalQueryDoActionU32(0, loc, 0); else { // In quelle nuove, ci basta resettare gli mcode MCharResetCodes(); -- cgit v1.2.3 From 734fae9193fdabd6dcac5f40f765d904c030f7d1 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 May 2012 10:32:43 +1000 Subject: TONY: Fixed some memory leaks identified by Valgrind --- engines/tony/gfxengine.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 6b5105bc35..7f2515af7b 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -78,11 +78,14 @@ RMGfxEngine::RMGfxEngine() { // Crea il big buffer dove verranno disegnati i frame m_bigBuf.Create(RM_BBX, RM_BBY, 16); m_bigBuf.OffsetY(RM_SKIPY); + + csMainLoop = NULL; } RMGfxEngine::~RMGfxEngine() { // Chiude il buffer m_bigBuf.Destroy(); + g_system->deleteMutex(csMainLoop); } void RMGfxEngine::OpenOptionScreen(int type) { -- cgit v1.2.3 From 07c1369f98009a2d9f8b49a9f68ace7354469cba Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 May 2012 20:54:21 +1000 Subject: TONY: Created dummy event loop and started work on converting RMWindow class --- engines/tony/gfxengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/tony/gfxengine.cpp') 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); -- cgit v1.2.3 From 4fc57f13491781893edf4b4aa6e477b0e0fc02b8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 5 May 2012 22:33:13 +1000 Subject: TONY: Added some class field initialisations --- engines/tony/gfxengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 27db5c18bf..f98942403d 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -288,7 +288,7 @@ SKIPCLICKSINISTRO: } // Anima Tony - m_tony.DoFrame(&m_bigBuf,m_nCurLoc); + m_tony.DoFrame(&m_bigBuf, m_nCurLoc); // Aggiorna lo scrolling per tenere Tony dentro lo schermo if (m_tony.MustUpdateScrolling() && m_bLocationLoaded) { -- cgit v1.2.3 From 770e55d06578f7f51959ea331da7baaaaa0e360d Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 May 2012 15:18:03 +1000 Subject: TONY: Further conversion of initially launched threads to processes. This includes all the dependent routines that they call. --- engines/tony/gfxengine.cpp | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index f98942403d..1858221350 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -65,13 +65,21 @@ extern bool bSkipSfxNoLoop; bool bIdleExited; -void ExitAllIdles(int nCurLoc) { +void ExitAllIdles(CORO_PARAM, int nCurLoc) { + CORO_BEGIN_CONTEXT; + CORO_END_CONTEXT(_ctx); + + CORO_BEGIN_CODE(_ctx); + // Chiude le idle bSkipSfxNoLoop = true; - mpalEndIdlePoll(nCurLoc); + + CORO_INVOKE_2(mpalEndIdlePoll, nCurLoc, NULL); + bIdleExited = true; bSkipSfxNoLoop = false; - ExitThread(0); + + CORO_END_CODE; } RMGfxEngine::RMGfxEngine() { @@ -514,17 +522,21 @@ HANDLE RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { return INVALID_HANDLE_VALUE; //mpalQueryDoAction(0,m_nCurLoc,0); } -HANDLE RMGfxEngine::UnloadLocation(bool bDoOnExit) { - HANDLE h; +void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, HANDLE *result) { + CORO_BEGIN_CONTEXT; + HANDLE h; + CORO_END_CONTEXT(_ctx); + + CORO_BEGIN_CODE(_ctx); // Scarica tutta la memoria della locazione - mpalEndIdlePoll(m_nCurLoc); + CORO_INVOKE_2(mpalEndIdlePoll, m_nCurLoc, NULL); // On Exit? if (bDoOnExit) { - h = mpalQueryDoAction(1, m_nCurLoc, 0); - if (h != INVALID_HANDLE_VALUE) - WaitForSingleObject(h, INFINITE); + _ctx->h = mpalQueryDoAction(1, m_nCurLoc, 0); + if (_ctx->h != INVALID_HANDLE_VALUE) + WaitForSingleObject(_ctx->h, INFINITE); } MainFreeze(); @@ -534,7 +546,10 @@ HANDLE RMGfxEngine::UnloadLocation(bool bDoOnExit) { m_bigBuf.ClearOT(); m_loc.Unload(); - return INVALID_HANDLE_VALUE; + if (result != NULL) + *result = INVALID_HANDLE_VALUE; + + CORO_END_CODE; } void RMGfxEngine::Init(/*HINSTANCE hInst*/) { @@ -930,7 +945,7 @@ void RMGfxEngine::LoadState(const char *fn) { delete f; - UnloadLocation(false); + UnloadLocation(nullContext, false, NULL); LoadLocation(loc,tp,RMPoint(-1, -1)); m_tony.SetPattern(RMTony::PAT_STANDRIGHT); MainUnfreeze(); -- cgit v1.2.3 From 8bfc60f5c9bdba4b1f37fcf42df4b0aa360c325f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 6 May 2012 16:39:42 +1000 Subject: TONY: Refactored RMInput class to use ScummVM event loop --- engines/tony/gfxengine.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 1858221350..acf6339e73 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -660,11 +660,9 @@ void RMGfxEngine::Close(void) { } void RMGfxEngine::SwitchFullscreen(bool bFull) { - m_input.SwitchFullscreen(bFull); } void RMGfxEngine::GDIControl(bool bCon) { - m_input.GDIControl(bCon); } void RMGfxEngine::EnableInput(void) { -- cgit v1.2.3 From 26898dd7ad399a641f63eabf04aa2d839f8508fc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 9 May 2012 00:42:27 +1000 Subject: TONY: Completed bulk of initial coro refactoring --- engines/tony/gfxengine.cpp | 90 +++++++++++++++++++++++++--------------------- 1 file changed, 50 insertions(+), 40 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index acf6339e73..12de3573eb 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -65,10 +65,12 @@ extern bool bSkipSfxNoLoop; bool bIdleExited; -void ExitAllIdles(CORO_PARAM, int nCurLoc) { +void ExitAllIdles(CORO_PARAM, const void *param) { CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); + int nCurLoc = *(const int *)param; + CORO_BEGIN_CODE(_ctx); // Chiude le idle @@ -96,28 +98,27 @@ RMGfxEngine::~RMGfxEngine() { g_system->deleteMutex(csMainLoop); } -void RMGfxEngine::OpenOptionScreen(int type) { - bool bRes = false; - - switch (type) { - case 0: - bRes = m_opt.Init(m_bigBuf); - break; - case 1: - bRes = m_opt.InitLoadMenuOnly(m_bigBuf,true); - break; - case 2: - bRes = m_opt.InitNoLoadSave(m_bigBuf); - break; - case 3: - bRes = m_opt.InitLoadMenuOnly(m_bigBuf,false); - break; - case 4: - bRes = m_opt.InitSaveMenuOnly(m_bigBuf,false); - break; - } +void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) { + CORO_BEGIN_CONTEXT; + bool bRes; + CORO_END_CONTEXT(_ctx); - if (bRes) { + CORO_BEGIN_CODE(_ctx); + + _ctx->bRes = false; + + if (type == 0) + _ctx->bRes = m_opt.Init(m_bigBuf); + else if (type == 1) + _ctx->bRes = m_opt.InitLoadMenuOnly(m_bigBuf, true); + else if (type == 2) + _ctx->bRes = m_opt.InitNoLoadSave(m_bigBuf); + else if (type == 3) + _ctx->bRes = m_opt.InitLoadMenuOnly(m_bigBuf, false); + else if (type == 4) + _ctx->bRes = m_opt.InitSaveMenuOnly(m_bigBuf, false); + + if (_ctx->bRes) { _vm->PauseSound(true); DisableInput(); @@ -135,16 +136,23 @@ void RMGfxEngine::OpenOptionScreen(int type) { if (type == 1 || type == 2) { bIdleExited = true; } else { - m_tony.StopNoAction(); + CORO_INVOKE_0(m_tony.StopNoAction); - uint32 id; bIdleExited = false; - CreateThread(NULL, 10240, (LPTHREAD_START_ROUTINE)ExitAllIdles, (void *)m_nCurLoc, 0, &id); + + g_scheduler->createProcess(ExitAllIdles, &m_nCurLoc, sizeof(int)); } } + + CORO_END_CODE; } -void RMGfxEngine::DoFrame(bool bDrawLocation) { +void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { + CORO_BEGIN_CONTEXT; + CORO_END_CONTEXT(_ctx); + + CORO_BEGIN_CODE(_ctx); + g_system->lockMutex(csMainLoop); // Poll dei dispositivi di input @@ -212,15 +220,15 @@ void RMGfxEngine::DoFrame(bool bDrawLocation) { if (m_bGUIOption) { if (!m_tony.InAction() && m_bInput) { if ((m_input.MouseLeftClicked() && m_input.MousePos().x < 3 && m_input.MousePos().y < 3)) { - OpenOptionScreen(0); + OpenOptionScreen(nullContext, 0); goto SKIPCLICKSINISTRO; } else if ((GetAsyncKeyState(Common::KEYCODE_ESCAPE)&0x8001) == 0x8001) - OpenOptionScreen(0); + OpenOptionScreen(nullContext, 0); else if (_vm->getIsDemo()) { if ((GetAsyncKeyState(Common::KEYCODE_F3) & 0x8001) == 0x8001) - OpenOptionScreen(3); + OpenOptionScreen(nullContext, 3); else if ((GetAsyncKeyState(Common::KEYCODE_F2) & 0x8001) == 0x8001) - OpenOptionScreen(4); + OpenOptionScreen(nullContext, 4); } } } @@ -287,7 +295,7 @@ SKIPCLICKSINISTRO: // Aggiorna il nome sotto il puntatore del mouse m_itemName.SetMouseCoord(m_input.MousePos()); if (!m_inter.Active() && !m_inv.MiniActive()) - m_itemName.DoFrame(m_bigBuf,m_loc,m_point,m_inv); + CORO_INVOKE_4(m_itemName.DoFrame, m_bigBuf, m_loc, m_point, m_inv); } // Inventario & interfaccia @@ -325,7 +333,7 @@ SKIPCLICKSINISTRO: switch (m_nWipeType) { case 1: if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top >= FSTEP * 2)) { - SetEvent(m_hWipeEvent); + g_scheduler->setEvent(m_hWipeEvent); m_nWipeType = 3; break; } @@ -338,7 +346,7 @@ SKIPCLICKSINISTRO: case 2: if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top < 480 - FSTEP)) { - SetEvent(m_hWipeEvent); + g_scheduler->setEvent(m_hWipeEvent); m_nWipeType = 3; break; } @@ -352,6 +360,8 @@ SKIPCLICKSINISTRO: } g_system->unlockMutex(csMainLoop); + + CORO_END_CODE; } @@ -524,7 +534,7 @@ HANDLE RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, HANDLE *result) { CORO_BEGIN_CONTEXT; - HANDLE h; + uint32 h; CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); @@ -534,9 +544,9 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, HANDLE *result) { // On Exit? if (bDoOnExit) { - _ctx->h = mpalQueryDoAction(1, m_nCurLoc, 0); - if (_ctx->h != INVALID_HANDLE_VALUE) - WaitForSingleObject(_ctx->h, INFINITE); + _ctx->h = mpalQueryDoActionU32(1, m_nCurLoc, 0); + if (_ctx->h != INVALID_PID_VALUE) + CORO_INVOKE_2(g_scheduler->waitForSingleObject, _ctx->h, INFINITE); } MainFreeze(); @@ -588,7 +598,7 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { bIdleExited = false; m_bOption = false; m_bWiping = false; - m_hWipeEvent = CreateEvent(NULL, false, false, NULL); + m_hWipeEvent = g_scheduler->createEvent(false, false); // Crea l'evento di freeze csMainLoop = g_system->createMutex(); @@ -986,8 +996,8 @@ void RMGfxEngine::CloseWipe(void) { m_bWiping = false; } -void RMGfxEngine::WaitWipeEnd(void) { - WaitForSingleObject(m_hWipeEvent,INFINITE); +void RMGfxEngine::WaitWipeEnd(CORO_PARAM) { + g_scheduler->waitForSingleObject(coroParam, m_hWipeEvent, INFINITE); } } // End of namespace Tony -- cgit v1.2.3 From 5a069cdc861538fe763de48de8628d7d754f7959 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 9 May 2012 23:15:41 +1000 Subject: TONY: Refactored out usage of nullContext in favour of proper coroutines --- engines/tony/gfxengine.cpp | 206 +++++++++++++++++++++++---------------------- 1 file changed, 106 insertions(+), 100 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 12de3573eb..3952d0c227 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -165,7 +165,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { } if (m_bOption) { - m_opt.DoFrame(&m_input); + CORO_INVOKE_1(m_opt.DoFrame, &m_input); m_bOption = !m_opt.IsClosing(); if (!m_bOption) { DisableMouse(); @@ -220,15 +220,15 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { if (m_bGUIOption) { if (!m_tony.InAction() && m_bInput) { if ((m_input.MouseLeftClicked() && m_input.MousePos().x < 3 && m_input.MousePos().y < 3)) { - OpenOptionScreen(nullContext, 0); + CORO_INVOKE_1(OpenOptionScreen, 0); goto SKIPCLICKSINISTRO; } else if ((GetAsyncKeyState(Common::KEYCODE_ESCAPE)&0x8001) == 0x8001) - OpenOptionScreen(nullContext, 0); + CORO_INVOKE_1(OpenOptionScreen, 0); else if (_vm->getIsDemo()) { if ((GetAsyncKeyState(Common::KEYCODE_F3) & 0x8001) == 0x8001) - OpenOptionScreen(nullContext, 3); + CORO_INVOKE_1(OpenOptionScreen, 3); else if ((GetAsyncKeyState(Common::KEYCODE_F2) & 0x8001) == 0x8001) - OpenOptionScreen(nullContext, 4); + CORO_INVOKE_1(OpenOptionScreen, 4); } } } @@ -494,7 +494,7 @@ void RMGfxEngine::InitForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint star mpalStartIdlePoll(m_nCurLoc); } -HANDLE RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { +uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { bool bLoaded; int i; @@ -529,10 +529,10 @@ HANDLE RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { m_bLocationLoaded = true; // On Enter per la locazion - return INVALID_HANDLE_VALUE; //mpalQueryDoAction(0,m_nCurLoc,0); + return INVALID_PID_VALUE; //mpalQueryDoAction(0,m_nCurLoc,0); } -void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, HANDLE *result) { +void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { CORO_BEGIN_CONTEXT; uint32 h; CORO_END_CONTEXT(_ctx); @@ -544,7 +544,7 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, HANDLE *result) { // On Exit? if (bDoOnExit) { - _ctx->h = mpalQueryDoActionU32(1, m_nCurLoc, 0); + _ctx->h = mpalQueryDoAction(1, m_nCurLoc, 0); if (_ctx->h != INVALID_PID_VALUE) CORO_INVOKE_2(g_scheduler->waitForSingleObject, _ctx->h, INFINITE); } @@ -557,7 +557,7 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, HANDLE *result) { m_loc.Unload(); if (result != NULL) - *result = INVALID_HANDLE_VALUE; + *result = INVALID_PID_VALUE; CORO_END_CODE; } @@ -707,7 +707,7 @@ void SaveChangedHotspot(Common::OutSaveFile *f); void LoadChangedHotspot(Common::InSaveFile *f); void ReapplyChangedHotspot(void); -void RestoreMusic(void); +void RestoreMusic(CORO_PARAM); void SaveMusic(Common::OutSaveFile *f); void LoadMusic(Common::InSaveFile *f); @@ -827,153 +827,159 @@ void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bo delete f; } -void RMGfxEngine::LoadState(const char *fn) { +void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { // PROBLEMA: Bisognerebbe caricare la locazione in un thread a parte per fare la OnEnter ... - Common::InSaveFile *f; - byte *state, *statecmp; - uint size, sizecmp; - char buf[4]; - RMPoint tp; - int loc; - int ver; - int i; + CORO_BEGIN_CONTEXT; + Common::InSaveFile *f; + byte *state, *statecmp; + uint size, sizecmp; + char buf[4]; + RMPoint tp; + int loc; + int ver; + int i; + CORO_END_CONTEXT(_ctx); + + CORO_BEGIN_CODE(_ctx); - f = g_system->getSavefileManager()->openForLoading(fn); - if (f == NULL) return; - f->read(buf, 4); - if (buf[0] != 'R' || buf[1] != 'M' || buf[2] != 'S') { - delete f; + _ctx->f = g_system->getSavefileManager()->openForLoading(fn); + if (_ctx->f == NULL) return; + _ctx->f->read(_ctx->buf, 4); + if (_ctx->buf[0] != 'R' || _ctx->buf[1] != 'M' || _ctx->buf[2] != 'S') { + delete _ctx->f; return; } - ver = buf[3]; + _ctx->ver = _ctx->buf[3]; - if (ver != 0x1 && ver != 0x2 && ver != 0x3 && ver != 0x4 && ver != 0x5 && ver != 0x6 && ver != 0x7) { - delete f; + if (_ctx->ver != 0x1 && _ctx->ver != 0x2 && _ctx->ver != 0x3 && _ctx->ver != 0x4 && _ctx->ver != 0x5 && _ctx->ver != 0x6 && _ctx->ver != 0x7) { + delete _ctx->f; return; } - if (ver >= 0x3) { - // C'è il thumbnail. Se ver >= 5, è compresso - if (ver >= 0x5) { - i = 0; - i = f->readUint32LE(); - f->seek(i); + if (_ctx->ver >= 0x3) { + // C'è il thumbnail. Se _ctx->ver >= 5, è compresso + if (_ctx->ver >= 0x5) { + _ctx->i = 0; + _ctx->i = _ctx->f->readUint32LE(); + _ctx->f->seek(_ctx->i); } else - f->seek(160 * 120 * 2, SEEK_CUR); + _ctx->f->seek(160 * 120 * 2, SEEK_CUR); } - if (ver >= 0x5) { + if (_ctx->ver >= 0x5) { // Skip del livello di difficoltà - f->seek(1, SEEK_CUR); + _ctx->f->seek(1, SEEK_CUR); } - if (ver >= 0x4) { // Skippa il nome, che non serve a nessuno - i = f->readByte(); - f->seek(i, SEEK_CUR); + if (_ctx->ver >= 0x4) { // Skippa il nome, che non serve a nessuno + _ctx->i = _ctx->f->readByte(); + _ctx->f->seek(_ctx->i, SEEK_CUR); } - loc = f->readUint32LE(); - loc = f->readUint32LE(); - tp.x = f->readUint32LE(); - tp.y = f->readUint32LE(); - size = f->readUint32LE(); + _ctx->loc = _ctx->f->readUint32LE(); + _ctx->loc = _ctx->f->readUint32LE(); + _ctx->tp.x = _ctx->f->readUint32LE(); + _ctx->tp.y = _ctx->f->readUint32LE(); + _ctx->size = _ctx->f->readUint32LE(); - if (ver >= 0x5) { + if (_ctx->ver >= 0x5) { // Stato MPAL compresso! - sizecmp = f->readUint32LE(); - state = new byte[size]; - statecmp = new byte[sizecmp]; - f->read(statecmp, sizecmp); - lzo1x_decompress(statecmp,sizecmp,state,&size); - delete[] statecmp; + _ctx->sizecmp = _ctx->f->readUint32LE(); + _ctx->state = new byte[_ctx->size]; + _ctx->statecmp = new byte[_ctx->sizecmp]; + _ctx->f->read(_ctx->statecmp, _ctx->sizecmp); + lzo1x_decompress(_ctx->statecmp,_ctx->sizecmp,_ctx->state,&_ctx->size); + delete[] _ctx->statecmp; } else { - state = new byte[size]; - f->read(state, size); + _ctx->state = new byte[_ctx->size]; + _ctx->f->read(_ctx->state, _ctx->size); } - mpalLoadState(state); - delete[] state; + mpalLoadState(_ctx->state); + delete[] _ctx->state; // inventario - size = f->readUint32LE(); - state = new byte[size]; - f->read(state, size); - m_inv.LoadState(state); - delete[] state; - - if (ver >= 0x2) { // Versione 2: box please - size = f->readUint32LE(); - state = new byte[size]; - f->read(state, size); - _vm->_theBoxes.LoadState(state); - delete[] state; + _ctx->size = _ctx->f->readUint32LE(); + _ctx->state = new byte[_ctx->size]; + _ctx->f->read(_ctx->state, _ctx->size); + m_inv.LoadState(_ctx->state); + delete[] _ctx->state; + + if (_ctx->ver >= 0x2) { // Versione 2: box please + _ctx->size = _ctx->f->readUint32LE(); + _ctx->state = new byte[_ctx->size]; + _ctx->f->read(_ctx->state, _ctx->size); + _vm->_theBoxes.LoadState(_ctx->state); + delete[] _ctx->state; } - if (ver >= 5) { + if (_ctx->ver >= 5) { // Versione 5: bool bStat = false; - bStat = f->readByte(); + bStat = _ctx->f->readByte(); m_tony.SetPastorella(bStat); - bStat = f->readByte(); + bStat = _ctx->f->readByte(); m_inter.SetPalesati(bStat); - CharsLoadAll(f); + CharsLoadAll(_ctx->f); } - if (ver >= 6) { + if (_ctx->ver >= 6) { // Carica le opzioni - bCfgInvLocked = f->readByte(); - bCfgInvNoScroll = f->readByte(); - bCfgTimerizedText = f->readByte(); - bCfgInvUp = f->readByte(); - bCfgAnni30 = f->readByte(); - bCfgAntiAlias = f->readByte(); - bCfgSottotitoli = f->readByte(); - bCfgTransparence = f->readByte(); - bCfgInterTips = f->readByte(); - bCfgDubbing = f->readByte(); - bCfgMusic = f->readByte(); - bCfgSFX = f->readByte(); - nCfgTonySpeed = f->readByte(); - nCfgTextSpeed = f->readByte(); - nCfgDubbingVolume = f->readByte(); - nCfgMusicVolume = f->readByte(); - nCfgSFXVolume = f->readByte(); + bCfgInvLocked = _ctx->f->readByte(); + bCfgInvNoScroll = _ctx->f->readByte(); + bCfgTimerizedText = _ctx->f->readByte(); + bCfgInvUp = _ctx->f->readByte(); + bCfgAnni30 = _ctx->f->readByte(); + bCfgAntiAlias = _ctx->f->readByte(); + bCfgSottotitoli = _ctx->f->readByte(); + bCfgTransparence = _ctx->f->readByte(); + bCfgInterTips = _ctx->f->readByte(); + bCfgDubbing = _ctx->f->readByte(); + bCfgMusic = _ctx->f->readByte(); + bCfgSFX = _ctx->f->readByte(); + nCfgTonySpeed = _ctx->f->readByte(); + nCfgTextSpeed = _ctx->f->readByte(); + nCfgDubbingVolume = _ctx->f->readByte(); + nCfgMusicVolume = _ctx->f->readByte(); + nCfgSFXVolume = _ctx->f->readByte(); // Carica gli hotspot - LoadChangedHotspot(f); + LoadChangedHotspot(_ctx->f); } - if (ver >= 7) { - LoadMusic(f); + if (_ctx->ver >= 7) { + LoadMusic(_ctx->f); } - delete f; + delete _ctx->f; - UnloadLocation(nullContext, false, NULL); - LoadLocation(loc,tp,RMPoint(-1, -1)); + CORO_INVOKE_2(UnloadLocation, false, NULL); + LoadLocation(_ctx->loc,_ctx->tp,RMPoint(-1, -1)); m_tony.SetPattern(RMTony::PAT_STANDRIGHT); MainUnfreeze(); // Le versioni vecchie necessitano di On enter - if (ver < 5) - mpalQueryDoActionU32(0, loc, 0); + if (_ctx->ver < 5) + mpalQueryDoAction(0, _ctx->loc, 0); else { // In quelle nuove, ci basta resettare gli mcode MCharResetCodes(); } - if (ver >= 6) + if (_ctx->ver >= 6) ReapplyChangedHotspot(); - RestoreMusic(); + CORO_INVOKE_0(RestoreMusic); m_bGUIInterface = true; m_bGUIInventory = true; m_bGUIOption = true; + + CORO_END_CODE; } void RMGfxEngine::PauseSound(bool bPause) { -- cgit v1.2.3 From 82361a3ea3efb9b6454eb4805e777cd4bfc3a0e3 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 11 May 2012 00:09:34 +1000 Subject: TONY: Fixed some missed methods to coroutines --- engines/tony/gfxengine.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 3952d0c227..5a9c0555e0 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -208,7 +208,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { // *************** if (m_input.MouseRightReleased()) { if (m_inv.RightRelease(m_input.MousePos(), m_curAction)) { - m_tony.MoveAndDoAction(m_itemName.GetHotspot(),m_itemName.GetSelectedItem(),m_curAction); + CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction); m_curAction = TA_GOTO; m_point.SetAction(m_curAction); @@ -240,9 +240,9 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { //if (m_itemName.IsItemSelected()) { if (m_curAction != TA_COMBINE) - m_tony.MoveAndDoAction(m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_point.CurAction()); + CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_point.CurAction()); else if (m_itemName.GetSelectedItem() != NULL) - m_tony.MoveAndDoAction(m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), TA_COMBINE, m_curActionObj); + CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), TA_COMBINE, m_curActionObj); } if (m_curAction == TA_COMBINE) { @@ -283,7 +283,7 @@ SKIPCLICKSINISTRO: if (m_bGUIInterface) { if (m_inter.Released(m_input.MousePos(),m_curAction)) { m_point.SetAction(m_curAction); - m_tony.MoveAndDoAction(m_itemName.GetHotspot(),m_itemName.GetSelectedItem(), m_curAction); + CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction); m_curAction = TA_GOTO; m_point.SetAction(m_curAction); @@ -304,7 +304,7 @@ SKIPCLICKSINISTRO: } // Anima Tony - m_tony.DoFrame(&m_bigBuf, m_nCurLoc); + CORO_INVOKE_2(m_tony.DoFrame, &m_bigBuf, m_nCurLoc); // Aggiorna lo scrolling per tenere Tony dentro lo schermo if (m_tony.MustUpdateScrolling() && m_bLocationLoaded) { -- cgit v1.2.3 From 68c1b0b0e46b0575a4670d1ffda2fa3c8ae94ed8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Fri, 11 May 2012 23:15:59 +1000 Subject: TONY: Refactored Tony to use the Common coroutine scheduler --- engines/tony/gfxengine.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 5a9c0555e0..88aac99ebe 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -140,7 +140,7 @@ void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) { bIdleExited = false; - g_scheduler->createProcess(ExitAllIdles, &m_nCurLoc, sizeof(int)); + CoroScheduler.createProcess(ExitAllIdles, &m_nCurLoc, sizeof(int)); } } @@ -242,7 +242,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { if (m_curAction != TA_COMBINE) CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_point.CurAction()); else if (m_itemName.GetSelectedItem() != NULL) - CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), TA_COMBINE, m_curActionObj); + CORO_INVOKE_4(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), TA_COMBINE, m_curActionObj); } if (m_curAction == TA_COMBINE) { @@ -333,7 +333,7 @@ SKIPCLICKSINISTRO: switch (m_nWipeType) { case 1: if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top >= FSTEP * 2)) { - g_scheduler->setEvent(m_hWipeEvent); + CoroScheduler.setEvent(m_hWipeEvent); m_nWipeType = 3; break; } @@ -346,7 +346,7 @@ SKIPCLICKSINISTRO: case 2: if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top < 480 - FSTEP)) { - g_scheduler->setEvent(m_hWipeEvent); + CoroScheduler.setEvent(m_hWipeEvent); m_nWipeType = 3; break; } @@ -529,7 +529,7 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { m_bLocationLoaded = true; // On Enter per la locazion - return INVALID_PID_VALUE; //mpalQueryDoAction(0,m_nCurLoc,0); + return CORO_INVALID_PID_VALUE; //mpalQueryDoAction(0,m_nCurLoc,0); } void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { @@ -545,8 +545,8 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { // On Exit? if (bDoOnExit) { _ctx->h = mpalQueryDoAction(1, m_nCurLoc, 0); - if (_ctx->h != INVALID_PID_VALUE) - CORO_INVOKE_2(g_scheduler->waitForSingleObject, _ctx->h, INFINITE); + if (_ctx->h != CORO_INVALID_PID_VALUE) + CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE); } MainFreeze(); @@ -557,7 +557,7 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { m_loc.Unload(); if (result != NULL) - *result = INVALID_PID_VALUE; + *result = CORO_INVALID_PID_VALUE; CORO_END_CODE; } @@ -598,7 +598,7 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { bIdleExited = false; m_bOption = false; m_bWiping = false; - m_hWipeEvent = g_scheduler->createEvent(false, false); + m_hWipeEvent = CoroScheduler.createEvent(false, false); // Crea l'evento di freeze csMainLoop = g_system->createMutex(); @@ -1003,7 +1003,7 @@ void RMGfxEngine::CloseWipe(void) { } void RMGfxEngine::WaitWipeEnd(CORO_PARAM) { - g_scheduler->waitForSingleObject(coroParam, m_hWipeEvent, INFINITE); + CoroScheduler.waitForSingleObject(coroParam, m_hWipeEvent, CORO_INFINITE); } } // End of namespace Tony -- cgit v1.2.3 From 109e5f8226c1db18926e307d4ecb9c3c83fdd7bc Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 May 2012 20:49:36 +1000 Subject: TONY: Conversion of more methods to coroutines --- engines/tony/gfxengine.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 88aac99ebe..b5278b3b05 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -108,15 +108,15 @@ void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) { _ctx->bRes = false; if (type == 0) - _ctx->bRes = m_opt.Init(m_bigBuf); + CORO_INVOKE_2(m_opt.Init, m_bigBuf, _ctx->bRes); else if (type == 1) - _ctx->bRes = m_opt.InitLoadMenuOnly(m_bigBuf, true); + CORO_INVOKE_3(m_opt.InitLoadMenuOnly, m_bigBuf, true, _ctx->bRes); else if (type == 2) - _ctx->bRes = m_opt.InitNoLoadSave(m_bigBuf); + CORO_INVOKE_2(m_opt.InitNoLoadSave, m_bigBuf, _ctx->bRes); else if (type == 3) - _ctx->bRes = m_opt.InitLoadMenuOnly(m_bigBuf, false); + CORO_INVOKE_3(m_opt.InitLoadMenuOnly, m_bigBuf, false, _ctx->bRes); else if (type == 4) - _ctx->bRes = m_opt.InitSaveMenuOnly(m_bigBuf, false); + CORO_INVOKE_3(m_opt.InitSaveMenuOnly, m_bigBuf, false, _ctx->bRes); if (_ctx->bRes) { _vm->PauseSound(true); @@ -222,12 +222,14 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { if ((m_input.MouseLeftClicked() && m_input.MousePos().x < 3 && m_input.MousePos().y < 3)) { CORO_INVOKE_1(OpenOptionScreen, 0); goto SKIPCLICKSINISTRO; - } else if ((GetAsyncKeyState(Common::KEYCODE_ESCAPE)&0x8001) == 0x8001) + } else if (m_input.GetAsyncKeyState(Common::KEYCODE_ESCAPE)) CORO_INVOKE_1(OpenOptionScreen, 0); - else if (_vm->getIsDemo()) { - if ((GetAsyncKeyState(Common::KEYCODE_F3) & 0x8001) == 0x8001) + else if (!_vm->getIsDemo()) { + if (m_input.GetAsyncKeyState(Common::KEYCODE_F3) || m_input.GetAsyncKeyState(Common::KEYCODE_F5)) + // Save game screen CORO_INVOKE_1(OpenOptionScreen, 3); - else if ((GetAsyncKeyState(Common::KEYCODE_F2) & 0x8001) == 0x8001) + else if (m_input.GetAsyncKeyState(Common::KEYCODE_F2) || m_input.GetAsyncKeyState(Common::KEYCODE_F7)) + // Load game screen CORO_INVOKE_1(OpenOptionScreen, 4); } } @@ -324,7 +326,7 @@ SKIPCLICKSINISTRO: // ********************** // Disegna la lista di OT // ********************** - m_bigBuf.DrawOT(); + m_bigBuf.DrawOT(Common::nullContext); #define FSTEP (480/32) @@ -579,7 +581,7 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { RMGfxSourceBuffer16 *load = NULL; INIT_GFX16_FROMRAW(20038, load); m_bigBuf.AddPrim(new RMGfxPrimitive(load)); - m_bigBuf.DrawOT(); + m_bigBuf.DrawOT(Common::nullContext); m_bigBuf.ClearOT(); delete load; _vm->_window.GetNewFrame(*this, NULL); -- cgit v1.2.3 From 073e46503cd09130c3d7e2372ae50e47402569d2 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 12 May 2012 21:54:37 +1000 Subject: TONY: Properly implement game saving and loading. Saving isn't enabled in the demo, so for testing purposes I'm currently dissbling the ADGF_DEMO flag in the detection tables so saving is enabled. --- engines/tony/gfxengine.cpp | 95 ++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 50 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index b5278b3b05..579983ad75 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -713,66 +713,55 @@ void RestoreMusic(CORO_PARAM); void SaveMusic(Common::OutSaveFile *f); void LoadMusic(Common::InSaveFile *f); -unsigned char wrkmem[LZO1X_999_MEM_COMPRESS]; +#define TONY_SAVEGAME_VERSION 8 void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bool bFastCompress) { Common::OutSaveFile *f; - byte *state, *statecmp; - byte *thumbcmp; - uint thumbsizecmp, thumbsize; - uint size, sizecmp; + byte *state; + uint thumbsize; + uint size; int i; char buf[4]; RMPoint tp = m_tony.Position(); - // Salvataggio: variabili mpal + locazione corrente + posizione di tony + inventario + // Saving: mpal variables, current location, + tony inventory position - // Per ora salviamo solo lo stato MPAL - size=mpalGetSaveStateSize(); + // For now, we only save the MPAL state + size = mpalGetSaveStateSize(); state = new byte[size]; - statecmp = new byte[size*2]; mpalSaveState(state); - thumbcmp = new byte[160 * 120 * 4]; thumbsize = 160 * 120 * 2; - if (bFastCompress) { - lzo1x_1_compress(state,size,statecmp,&sizecmp,wrkmem); - lzo1x_1_compress(curThumb,thumbsize,thumbcmp,&thumbsizecmp,wrkmem); - } else { - lzo1x_999_compress(state,size,statecmp,&sizecmp,wrkmem); - lzo1x_999_compress(curThumb,thumbsize,thumbcmp,&thumbsizecmp,wrkmem); - } - buf[0] = 'R'; buf[1] = 'M'; buf[2] = 'S'; - buf[3] = 0x7; + buf[3] = TONY_SAVEGAME_VERSION; f = g_system->getSavefileManager()->openForSaving(fn); - if (f==NULL) return; + if (f == NULL) + return; + f->write(buf, 4); - f->writeUint32LE(thumbsizecmp); - f->write(thumbcmp, thumbsizecmp); + f->writeUint32LE(thumbsize); + f->write(curThumb, thumbsize); - // Livello di difficoltà + // Difficulty level i = mpalQueryGlobalVar("VERSIONEFACILE"); f->writeByte(i); - i=strlen(name); + i = strlen(name); f->writeByte(i); f->write(name, i); f->writeUint32LE(m_nCurLoc); f->writeUint32LE(tp.x); f->writeUint32LE(tp.y); + f->writeUint32LE(size); - f->writeUint32LE(sizecmp); - f->write(statecmp, sizecmp); + f->write(state, size); delete[] state; - delete[] statecmp; - delete[] thumbcmp; - // inventario + // Inventory size = m_inv.GetSaveStateSize(); state = new byte[size]; m_inv.SaveState(state); @@ -791,16 +780,16 @@ void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bo // New Ver5 bool bStat; - // Salva lo stato della pastorella e del palesati + // Saves the state of the shepherdess and show yourself bStat = m_tony.GetPastorella(); f->writeByte(bStat); bStat = m_inter.GetPalesati(); f->writeByte(bStat); - // Salva gli mchar + // Save the chars CharsSaveAll(f); - // Salva le opzioni + // Save the options f->writeByte(bCfgInvLocked); f->writeByte(bCfgInvNoScroll); f->writeByte(bCfgTimerizedText); @@ -819,10 +808,10 @@ void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bo f->writeByte(nCfgMusicVolume); f->writeByte(nCfgSFXVolume); - // Salva gli hotspot + // Save the hotspots SaveChangedHotspot(f); - // Salva la musica + // Save the music SaveMusic(f); f->finalize(); @@ -845,8 +834,10 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { CORO_BEGIN_CODE(_ctx); _ctx->f = g_system->getSavefileManager()->openForLoading(fn); - if (_ctx->f == NULL) return; + if (_ctx->f == NULL) + return; _ctx->f->read(_ctx->buf, 4); + if (_ctx->buf[0] != 'R' || _ctx->buf[1] != 'M' || _ctx->buf[2] != 'S') { delete _ctx->f; return; @@ -854,39 +845,43 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { _ctx->ver = _ctx->buf[3]; - if (_ctx->ver != 0x1 && _ctx->ver != 0x2 && _ctx->ver != 0x3 && _ctx->ver != 0x4 && _ctx->ver != 0x5 && _ctx->ver != 0x6 && _ctx->ver != 0x7) { + if (_ctx->ver == 0 || _ctx->ver > TONY_SAVEGAME_VERSION) { delete _ctx->f; return; } if (_ctx->ver >= 0x3) { - // C'è il thumbnail. Se _ctx->ver >= 5, è compresso - if (_ctx->ver >= 0x5) { + // There is a thumbnail. If the version is between 5 and 7, it's compressed + if ((_ctx->ver >= 0x5) && (_ctx->ver <= 0x7)) { _ctx->i = 0; _ctx->i = _ctx->f->readUint32LE(); _ctx->f->seek(_ctx->i); - } else + } else { + if (_ctx->ver >= 8) + // Skip thumbnail size + _ctx->f->skip(4); + _ctx->f->seek(160 * 120 * 2, SEEK_CUR); + } } if (_ctx->ver >= 0x5) { - // Skip del livello di difficoltà + // Skip the difficulty level _ctx->f->seek(1, SEEK_CUR); } - if (_ctx->ver >= 0x4) { // Skippa il nome, che non serve a nessuno + if (_ctx->ver >= 0x4) { // Skip the savegame name, which serves no purpose _ctx->i = _ctx->f->readByte(); _ctx->f->seek(_ctx->i, SEEK_CUR); } - _ctx->loc = _ctx->f->readUint32LE(); _ctx->loc = _ctx->f->readUint32LE(); _ctx->tp.x = _ctx->f->readUint32LE(); _ctx->tp.y = _ctx->f->readUint32LE(); _ctx->size = _ctx->f->readUint32LE(); - if (_ctx->ver >= 0x5) { - // Stato MPAL compresso! + if ((_ctx->ver >= 0x5) && (_ctx->ver <= 7)) { + // MPAL was packed! _ctx->sizecmp = _ctx->f->readUint32LE(); _ctx->state = new byte[_ctx->size]; _ctx->statecmp = new byte[_ctx->sizecmp]; @@ -894,6 +889,7 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { lzo1x_decompress(_ctx->statecmp,_ctx->sizecmp,_ctx->state,&_ctx->size); delete[] _ctx->statecmp; } else { + // Read uncompressed MPAL data _ctx->state = new byte[_ctx->size]; _ctx->f->read(_ctx->state, _ctx->size); } @@ -901,8 +897,7 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { mpalLoadState(_ctx->state); delete[] _ctx->state; - - // inventario + // Inventory _ctx->size = _ctx->f->readUint32LE(); _ctx->state = new byte[_ctx->size]; _ctx->f->read(_ctx->state, _ctx->size); @@ -930,7 +925,7 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { } if (_ctx->ver >= 6) { - // Carica le opzioni + // Load options bCfgInvLocked = _ctx->f->readByte(); bCfgInvNoScroll = _ctx->f->readByte(); bCfgTimerizedText = _ctx->f->readByte(); @@ -949,7 +944,7 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { nCfgMusicVolume = _ctx->f->readByte(); nCfgSFXVolume = _ctx->f->readByte(); - // Carica gli hotspot + // Load hotspots LoadChangedHotspot(_ctx->f); } @@ -964,11 +959,11 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { m_tony.SetPattern(RMTony::PAT_STANDRIGHT); MainUnfreeze(); - // Le versioni vecchie necessitano di On enter + // On older versions, need to an enter action if (_ctx->ver < 5) mpalQueryDoAction(0, _ctx->loc, 0); else { - // In quelle nuove, ci basta resettare gli mcode + // In the new ones, we just reset the mcode MCharResetCodes(); } -- cgit v1.2.3 From 09afc8a1fa354bc25a118a181d261e54c81f97c9 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 May 2012 00:25:32 +1000 Subject: TONY: Added FIXME for unsafe pointer conversion --- engines/tony/gfxengine.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 579983ad75..bbb6eb8f3e 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -371,6 +371,7 @@ void RMGfxEngine::InitCustomDll(void) { SetupGlobalVars(&m_tony, &m_point, &_vm->_theBoxes, &m_loc, &m_inv, &m_input); } +// FIXME: Casting nPattern from int to RMGfxEngine * void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) { static RMGfxEngine *This = NULL; RMItem *item; -- cgit v1.2.3 From 8a88ad861d68bd4c5a1a932d9da2518569ecc4ff Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 May 2012 00:43:02 +1000 Subject: TONY: Converted object passing to use const reference where appropriate. This should cut down on the number of redunndant creations of temporary objects. --- engines/tony/gfxengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index bbb6eb8f3e..1b09e00956 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -437,7 +437,7 @@ void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) { */ -void RMGfxEngine::SelectLocation(RMPoint ptTonyStart, RMPoint start) { +void RMGfxEngine::SelectLocation(const RMPoint &ptTonyStart, const RMPoint &start) { #if 0 OPENFILENAME ofn; char lpszFileName[512]; -- cgit v1.2.3 From c35b5397168299176eab69622044a98c8995a369 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 May 2012 09:42:09 +1000 Subject: TONY: Some further initialisation of object fields --- engines/tony/gfxengine.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 1b09e00956..f6d047d267 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -90,6 +90,17 @@ RMGfxEngine::RMGfxEngine() { m_bigBuf.OffsetY(RM_SKIPY); csMainLoop = NULL; + m_nCurLoc = 0; + m_curAction = TA_GOTO; + m_curActionObj = 0; + m_nWipeType = 0; + m_hWipeEvent = 0; + m_nWipeStep = 0; + m_bMustEnterMenu = false; + m_bWiping = false; + m_bGUIOption = false; + m_bGUIInterface = false; + m_bGUIInventory = false; } RMGfxEngine::~RMGfxEngine() { -- cgit v1.2.3 From 60deca7f54f395974c58683c9e8ce0a079a90ebf Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 May 2012 09:58:07 +1000 Subject: TONY: Fix some more uninitialised field values --- engines/tony/gfxengine.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index f6d047d267..2c8543326f 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -101,6 +101,10 @@ RMGfxEngine::RMGfxEngine() { m_bGUIOption = false; m_bGUIInterface = false; m_bGUIInventory = false; + m_bAlwaysDrawMouse = false; + m_bOption = false; + m_bLocationLoaded = false; + m_bInput = false; } RMGfxEngine::~RMGfxEngine() { -- cgit v1.2.3 From 089d7048b60b8ac880b47a0835b5c2890d8d4423 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 May 2012 15:50:15 +1000 Subject: TONY: Bugfix for crash when removing item from inventory --- engines/tony/gfxengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 2c8543326f..8f7d27dafc 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -341,7 +341,7 @@ SKIPCLICKSINISTRO: // ********************** // Disegna la lista di OT // ********************** - m_bigBuf.DrawOT(Common::nullContext); + CORO_INVOKE_0(m_bigBuf.DrawOT); #define FSTEP (480/32) -- cgit v1.2.3 From 546f47ddcee07b5bd7ecad5f25f4bb022944e234 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 13 May 2012 22:34:40 +1000 Subject: TONY: Beginnings of refactoring Globals into their own class --- engines/tony/gfxengine.cpp | 98 ++++++++++++++++++++++------------------------ 1 file changed, 46 insertions(+), 52 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 8f7d27dafc..bf1a08f245 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -54,17 +54,11 @@ namespace Tony { -extern bool bIdleExited; -extern bool bPatIrqFreeze; -extern bool bSkipSfxNoLoop; - /****************************************************************************\ * Metodi di RMGfxEngine \****************************************************************************/ -bool bIdleExited; - void ExitAllIdles(CORO_PARAM, const void *param) { CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); @@ -74,12 +68,12 @@ void ExitAllIdles(CORO_PARAM, const void *param) { CORO_BEGIN_CODE(_ctx); // Chiude le idle - bSkipSfxNoLoop = true; + GLOBALS.bSkipSfxNoLoop = true; CORO_INVOKE_2(mpalEndIdlePoll, nCurLoc, NULL); - bIdleExited = true; - bSkipSfxNoLoop = false; + GLOBALS.bIdleExited = true; + GLOBALS.bSkipSfxNoLoop = false; CORO_END_CODE; } @@ -149,11 +143,11 @@ void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) { // Esce la IDLE onde evitare la morte prematura in caricamento m_bMustEnterMenu = true; if (type == 1 || type == 2) { - bIdleExited = true; + GLOBALS.bIdleExited = true; } else { CORO_INVOKE_0(m_tony.StopNoAction); - bIdleExited = false; + GLOBALS.bIdleExited = false; CoroScheduler.createProcess(ExitAllIdles, &m_nCurLoc, sizeof(int)); } @@ -173,10 +167,10 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { // Poll dei dispositivi di input m_input.Poll(); - if (m_bMustEnterMenu && bIdleExited) { + if (m_bMustEnterMenu && GLOBALS.bIdleExited) { m_bOption = true; m_bMustEnterMenu = false; - bIdleExited = false; + GLOBALS.bIdleExited = false; } if (m_bOption) { @@ -401,10 +395,10 @@ void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) { item=This->m_loc.GetItemFromCode(dwItem); if (item != NULL) { if (nPattern!=-1) { - if (bPatIrqFreeze) + if (GLOBALS.bPatIrqFreeze) MainFreeze(); item->SetPattern(nPattern,true); - if (bPatIrqFreeze) + if (GLOBALS.bPatIrqFreeze) MainUnfreeze(); } if (nStatus!=-1) @@ -604,16 +598,16 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { - bPatIrqFreeze = true; + GLOBALS.bPatIrqFreeze = true; // GUI attivabile m_bGUIOption = true; m_bGUIInterface = true; m_bGUIInventory = true; - bSkipSfxNoLoop = false; + GLOBALS.bSkipSfxNoLoop = false; m_bMustEnterMenu = false; - bIdleExited = false; + GLOBALS.bIdleExited = false; m_bOption = false; m_bWiping = false; m_hWipeEvent = CoroScheduler.createEvent(false, false); @@ -806,23 +800,23 @@ void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bo CharsSaveAll(f); // Save the options - f->writeByte(bCfgInvLocked); - f->writeByte(bCfgInvNoScroll); - f->writeByte(bCfgTimerizedText); - f->writeByte(bCfgInvUp); - f->writeByte(bCfgAnni30); - f->writeByte(bCfgAntiAlias); - f->writeByte(bCfgSottotitoli); - f->writeByte(bCfgTransparence); - f->writeByte(bCfgInterTips); - f->writeByte(bCfgDubbing); - f->writeByte(bCfgMusic); - f->writeByte(bCfgSFX); - f->writeByte(nCfgTonySpeed); - f->writeByte(nCfgTextSpeed); - f->writeByte(nCfgDubbingVolume); - f->writeByte(nCfgMusicVolume); - f->writeByte(nCfgSFXVolume); + f->writeByte(GLOBALS.bCfgInvLocked); + f->writeByte(GLOBALS.bCfgInvNoScroll); + f->writeByte(GLOBALS.bCfgTimerizedText); + f->writeByte(GLOBALS.bCfgInvUp); + f->writeByte(GLOBALS.bCfgAnni30); + f->writeByte(GLOBALS.bCfgAntiAlias); + f->writeByte(GLOBALS.bCfgSottotitoli); + f->writeByte(GLOBALS.bCfgTransparence); + f->writeByte(GLOBALS.bCfgInterTips); + f->writeByte(GLOBALS.bCfgDubbing); + f->writeByte(GLOBALS.bCfgMusic); + f->writeByte(GLOBALS.bCfgSFX); + f->writeByte(GLOBALS.nCfgTonySpeed); + f->writeByte(GLOBALS.nCfgTextSpeed); + f->writeByte(GLOBALS.nCfgDubbingVolume); + f->writeByte(GLOBALS.nCfgMusicVolume); + f->writeByte(GLOBALS.nCfgSFXVolume); // Save the hotspots SaveChangedHotspot(f); @@ -942,23 +936,23 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { if (_ctx->ver >= 6) { // Load options - bCfgInvLocked = _ctx->f->readByte(); - bCfgInvNoScroll = _ctx->f->readByte(); - bCfgTimerizedText = _ctx->f->readByte(); - bCfgInvUp = _ctx->f->readByte(); - bCfgAnni30 = _ctx->f->readByte(); - bCfgAntiAlias = _ctx->f->readByte(); - bCfgSottotitoli = _ctx->f->readByte(); - bCfgTransparence = _ctx->f->readByte(); - bCfgInterTips = _ctx->f->readByte(); - bCfgDubbing = _ctx->f->readByte(); - bCfgMusic = _ctx->f->readByte(); - bCfgSFX = _ctx->f->readByte(); - nCfgTonySpeed = _ctx->f->readByte(); - nCfgTextSpeed = _ctx->f->readByte(); - nCfgDubbingVolume = _ctx->f->readByte(); - nCfgMusicVolume = _ctx->f->readByte(); - nCfgSFXVolume = _ctx->f->readByte(); + GLOBALS.bCfgInvLocked = _ctx->f->readByte(); + GLOBALS.bCfgInvNoScroll = _ctx->f->readByte(); + GLOBALS.bCfgTimerizedText = _ctx->f->readByte(); + GLOBALS.bCfgInvUp = _ctx->f->readByte(); + GLOBALS.bCfgAnni30 = _ctx->f->readByte(); + GLOBALS.bCfgAntiAlias = _ctx->f->readByte(); + GLOBALS.bCfgSottotitoli = _ctx->f->readByte(); + GLOBALS.bCfgTransparence = _ctx->f->readByte(); + GLOBALS.bCfgInterTips = _ctx->f->readByte(); + GLOBALS.bCfgDubbing = _ctx->f->readByte(); + GLOBALS.bCfgMusic = _ctx->f->readByte(); + GLOBALS.bCfgSFX = _ctx->f->readByte(); + GLOBALS.nCfgTonySpeed = _ctx->f->readByte(); + GLOBALS.nCfgTextSpeed = _ctx->f->readByte(); + GLOBALS.nCfgDubbingVolume = _ctx->f->readByte(); + GLOBALS.nCfgMusicVolume = _ctx->f->readByte(); + GLOBALS.nCfgSFXVolume = _ctx->f->readByte(); // Load hotspots LoadChangedHotspot(_ctx->f); -- cgit v1.2.3 From 099fe1e9e62ada666a312e08d7dca5cd2083de0b Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 May 2012 07:43:50 +0200 Subject: TONY: Remove original header --- engines/tony/gfxengine.cpp | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index bf1a08f245..4a0fdc0795 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -19,31 +19,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * */ -/************************************************************************** - * ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ * - * Nayma Software srl * - * e -= We create much MORE than ALL =- * - * u- z$$$c '. ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ * - * .d" d$$$$$b "b. * - * .z$* d$$$$$$$L ^*$c. * - * #$$$. $$$$$$$$$ .$$$" Project: Roasted Moths........ * - * ^*$b 4$$$$$$$$$F .d$*" * - * ^$$. 4$$$$$$$$$F .$P" Module: GfxEngine.CPP........ * - * *$. '$$$$$$$$$ 4$P 4 * - * J *$ "$$$$$$$" $P r Author: Giovanni Bajo........ * - * z$ '$$$P*4c.*$$$*.z@*R$$$ $. * - * z$" "" #$F^ "" '$c * - * z$$beu .ue=" $ "=e.. .zed$$c * - * "#$e z$*" . `. ^*Nc e$"" * - * "$$". .r" ^4. .^$$" * - * ^.@*"6L=\ebu^+C$"*b." * - * "**$. "c 4$$$ J" J$P*" OS: [ ] DOS [X] WIN95 [ ] PORT * - * ^"--.^ 9$" .--"" COMP: [ ] WATCOM [X] VISUAL C++ * - * " [ ] EIFFEL [ ] GCC/GXX/DJGPP * - * * - * This source code is Copyright (C) Nayma Software. ALL RIGHTS RESERVED * - * * - **************************************************************************/ + +/* + * This code is based on original Tony Tough source code + * + * Copyright (c) 1997-2003 Nayma Software + */ #include "common/savefile.h" #include "tony/mpal/lzo.h" -- cgit v1.2.3 From 4bf61b2f02bc933f66588332de37e1fdb996468b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Mon, 14 May 2012 20:20:02 +1000 Subject: TONY: Fixed nasty cast in ItemIrq initialisation --- engines/tony/gfxengine.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 4a0fdc0795..a2b58f660e 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -361,28 +361,21 @@ void RMGfxEngine::InitCustomDll(void) { SetupGlobalVars(&m_tony, &m_point, &_vm->_theBoxes, &m_loc, &m_inv, &m_input); } -// FIXME: Casting nPattern from int to RMGfxEngine * void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) { - static RMGfxEngine *This = NULL; RMItem *item; + assert(GLOBALS.GfxEngine); - // Inizializzazione! - if ((int)dwItem == -1) { - This = (RMGfxEngine*)nPattern; - return; - } - - if (This->m_bLocationLoaded) { - item=This->m_loc.GetItemFromCode(dwItem); + if (GLOBALS.GfxEngine->m_bLocationLoaded) { + item = GLOBALS.GfxEngine->m_loc.GetItemFromCode(dwItem); if (item != NULL) { - if (nPattern!=-1) { + if (nPattern != -1) { if (GLOBALS.bPatIrqFreeze) MainFreeze(); item->SetPattern(nPattern,true); if (GLOBALS.bPatIrqFreeze) MainUnfreeze(); } - if (nStatus!=-1) + if (nStatus != -1) item->SetStatus(nStatus); } } @@ -597,7 +590,7 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { csMainLoop = g_system->createMutex(); // Inizializza la funzione di IRQ di Item per l'MPAL - ItemIrq((uint32)-1, (uint32)this, 0); + GLOBALS.GfxEngine = this; mpalInstallItemIrq(ItemIrq); // Inizializza DirectInput -- cgit v1.2.3 From 88762667b52e4b904c56ecc94bf304c1a91e9feb Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 14 May 2012 21:29:27 +0200 Subject: TONY: Fix some formatting --- engines/tony/gfxengine.cpp | 357 ++++++++++++++++++++++----------------------- 1 file changed, 178 insertions(+), 179 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index a2b58f660e..384e80f209 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -68,9 +68,9 @@ RMGfxEngine::RMGfxEngine() { m_nCurLoc = 0; m_curAction = TA_GOTO; m_curActionObj = 0; - m_nWipeType = 0; + m_nWipeType = 0; m_hWipeEvent = 0; - m_nWipeStep = 0; + m_nWipeStep = 0; m_bMustEnterMenu = false; m_bWiping = false; m_bGUIOption = false; @@ -90,7 +90,7 @@ RMGfxEngine::~RMGfxEngine() { void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) { CORO_BEGIN_CONTEXT; - bool bRes; + bool bRes; CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); @@ -120,9 +120,9 @@ void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) { m_point.SetCustomPointer(NULL); EnableMouse(); _vm->GrabThumbnail(); - + // Esce la IDLE onde evitare la morte prematura in caricamento - m_bMustEnterMenu = true; + m_bMustEnterMenu = true; if (type == 1 || type == 2) { GLOBALS.bIdleExited = true; } else { @@ -144,7 +144,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { CORO_BEGIN_CODE(_ctx); g_system->lockMutex(csMainLoop); - + // Poll dei dispositivi di input m_input.Poll(); @@ -153,8 +153,8 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { m_bMustEnterMenu = false; GLOBALS.bIdleExited = false; } - - if (m_bOption) { + + if (m_bOption) { CORO_INVOKE_1(m_opt.DoFrame, &m_input); m_bOption = !m_opt.IsClosing(); if (!m_bOption) { @@ -177,33 +177,32 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { // ************** if (m_input.MouseLeftClicked()/* && m_itemName.IsItemSelected()*/) { // Left click attiva il combine, se siamo su un oggetto - if (m_inv.LeftClick(m_input.MousePos(),m_curActionObj)) { + if (m_inv.LeftClick(m_input.MousePos(), m_curActionObj)) { m_curAction = TA_COMBINE; m_point.SetAction(m_curAction); } - } - else + } else - // CLICK DESTRO - // ************ - if (m_input.MouseRightClicked()) { - if(m_itemName.IsItemSelected()) { - m_curActionObj=0; - m_inv.RightClick(m_input.MousePos()); + // CLICK DESTRO + // ************ + if (m_input.MouseRightClicked()) { + if (m_itemName.IsItemSelected()) { + m_curActionObj = 0; + m_inv.RightClick(m_input.MousePos()); + } else + m_inv.RightClick(m_input.MousePos()); } else - m_inv.RightClick(m_input.MousePos()); - } else - // RILASCIO DESTRO - // *************** - if (m_input.MouseRightReleased()) { - if (m_inv.RightRelease(m_input.MousePos(), m_curAction)) { - CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction); + // RILASCIO DESTRO + // *************** + if (m_input.MouseRightReleased()) { + if (m_inv.RightRelease(m_input.MousePos(), m_curAction)) { + CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction); - m_curAction = TA_GOTO; - m_point.SetAction(m_curAction); - } - } + m_curAction = TA_GOTO; + m_point.SetAction(m_curAction); + } + } } else { // Menu Opzioni // ************ @@ -236,7 +235,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { else if (m_itemName.GetSelectedItem() != NULL) CORO_INVOKE_4(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), TA_COMBINE, m_curActionObj); } - + if (m_curAction == TA_COMBINE) { m_inv.EndCombine(); m_point.SetSpecialPointer(RMPointer::PTR_NONE); @@ -267,13 +266,13 @@ SKIPCLICKSINISTRO: m_inter.Clicked(m_input.MousePos()); } } - + // RILASCIO DESTRO // *************** if (m_input.MouseRightReleased()) { if (m_bGUIInterface) { - if (m_inter.Released(m_input.MousePos(),m_curAction)) { + if (m_inter.Released(m_input.MousePos(), m_curAction)) { m_point.SetAction(m_curAction); CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction); @@ -287,7 +286,7 @@ SKIPCLICKSINISTRO: // Aggiorna il nome sotto il puntatore del mouse m_itemName.SetMouseCoord(m_input.MousePos()); if (!m_inter.Active() && !m_inv.MiniActive()) - CORO_INVOKE_4(m_itemName.DoFrame, m_bigBuf, m_loc, m_point, m_inv); + CORO_INVOKE_4(m_itemName.DoFrame, m_bigBuf, m_loc, m_point, m_inv); } // Inventario & interfaccia @@ -297,7 +296,7 @@ SKIPCLICKSINISTRO: // Anima Tony CORO_INVOKE_2(m_tony.DoFrame, &m_bigBuf, m_nCurLoc); - + // Aggiorna lo scrolling per tenere Tony dentro lo schermo if (m_tony.MustUpdateScrolling() && m_bLocationLoaded) { RMPoint showThis = m_tony.Position(); @@ -323,31 +322,31 @@ SKIPCLICKSINISTRO: // Wipe if (m_bWiping) { switch (m_nWipeType) { - case 1: - if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top >= FSTEP * 2)) { - CoroScheduler.setEvent(m_hWipeEvent); - m_nWipeType = 3; - break; - } - - m_rcWipeEllipse.top += FSTEP; - m_rcWipeEllipse.left += FSTEP; - m_rcWipeEllipse.right -= FSTEP; - m_rcWipeEllipse.bottom -= FSTEP; + case 1: + if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top >= FSTEP * 2)) { + CoroScheduler.setEvent(m_hWipeEvent); + m_nWipeType = 3; break; + } - case 2: - if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top < 480 - FSTEP)) { - CoroScheduler.setEvent(m_hWipeEvent); - m_nWipeType = 3; - break; - } + m_rcWipeEllipse.top += FSTEP; + m_rcWipeEllipse.left += FSTEP; + m_rcWipeEllipse.right -= FSTEP; + m_rcWipeEllipse.bottom -= FSTEP; + break; - m_rcWipeEllipse.top -= FSTEP; - m_rcWipeEllipse.left -= FSTEP; - m_rcWipeEllipse.right += FSTEP; - m_rcWipeEllipse.bottom += FSTEP; + case 2: + if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top < 480 - FSTEP)) { + CoroScheduler.setEvent(m_hWipeEvent); + m_nWipeType = 3; break; + } + + m_rcWipeEllipse.top -= FSTEP; + m_rcWipeEllipse.left -= FSTEP; + m_rcWipeEllipse.right += FSTEP; + m_rcWipeEllipse.bottom += FSTEP; + break; } } @@ -371,7 +370,7 @@ void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) { if (nPattern != -1) { if (GLOBALS.bPatIrqFreeze) MainFreeze(); - item->SetPattern(nPattern,true); + item->SetPattern(nPattern, true); if (GLOBALS.bPatIrqFreeze) MainUnfreeze(); } @@ -382,41 +381,41 @@ void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) { } /* - // WINBUG: This is a special case for the file open/save dialog, - // which sometimes pumps while it is coming up but before it has - // disabled the main window. - HWND hWndFocus = ::GetFocus(); - bool bEnableParent = false; - m_ofn.hwndOwner = PreModal(); - AfxUnhookWindowCreate(); - if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner)) { - bEnableParent = true; - ::EnableWindow(m_ofn.hwndOwner, false); - } - - _AFX_THREAD_STATE* pThreadState = AfxGetThreadState(); - ASSERT(pThreadState->m_pAlternateWndInit == NULL); - - if (m_ofn.Flags & OFN_EXPLORER) - pThreadState->m_pAlternateWndInit = this; - else - AfxHookWindowCreate(this); - - int nResult; - if (m_bOpenFileDialog) - nResult = ::GetOpenFileName(&m_ofn); - else - nResult = ::GetSaveFileName(&m_ofn); - - if (nResult) - ASSERT(pThreadState->m_pAlternateWndInit == NULL); - pThreadState->m_pAlternateWndInit = NULL; - - // WINBUG: Second part of special case for file open/save dialog. - if (bEnableParent) - ::EnableWindow(m_ofn.hwndOwner, true); - if (::IsWindow(hWndFocus)) - ::SetFocus(hWndFocus); + // WINBUG: This is a special case for the file open/save dialog, + // which sometimes pumps while it is coming up but before it has + // disabled the main window. + HWND hWndFocus = ::GetFocus(); + bool bEnableParent = false; + m_ofn.hwndOwner = PreModal(); + AfxUnhookWindowCreate(); + if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner)) { + bEnableParent = true; + ::EnableWindow(m_ofn.hwndOwner, false); + } + + _AFX_THREAD_STATE* pThreadState = AfxGetThreadState(); + ASSERT(pThreadState->m_pAlternateWndInit == NULL); + + if (m_ofn.Flags & OFN_EXPLORER) + pThreadState->m_pAlternateWndInit = this; + else + AfxHookWindowCreate(this); + + int nResult; + if (m_bOpenFileDialog) + nResult = ::GetOpenFileName(&m_ofn); + else + nResult = ::GetSaveFileName(&m_ofn); + + if (nResult) + ASSERT(pThreadState->m_pAlternateWndInit == NULL); + pThreadState->m_pAlternateWndInit = NULL; + + // WINBUG: Second part of special case for file open/save dialog. + if (bEnableParent) + ::EnableWindow(m_ofn.hwndOwner, true); + if (::IsWindow(hWndFocus)) + ::SetFocus(hWndFocus); */ @@ -427,46 +426,46 @@ void RMGfxEngine::SelectLocation(const RMPoint &ptTonyStart, const RMPoint &star // @@@ Con TonyStart=-1,-1 allora usa la posizione scritta nella locazione - // Sceglie la locazione - ZeroMemory(lpszFileName,512); - ZeroMemory(&ofn,sizeof(ofn)); - ofn.lStructSize=sizeof(ofn); - ofn.hwndOwner=NULL; - ofn.lpstrFilter="Locazione (*.LOC)\0*.LOC\0Locazione ottimizzata (*.LOX)\0*.LOX\0Tutti i files (*.*)\0*.*\0"; - ofn.lpstrCustomFilter=NULL; - ofn.nFilterIndex=1; - ofn.lpstrFile=lpszFileName; - ofn.nMaxFile=512; - ofn.lpstrInitialDir=NULL; - ofn.lpstrTitle="Load Location"; - ofn.Flags=OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST; - - if (!GetOpenFileName(&ofn)) + // Sceglie la locazione + ZeroMemory(lpszFileName, 512); + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = NULL; + ofn.lpstrFilter = "Locazione (*.LOC)\0*.LOC\0Locazione ottimizzata (*.LOX)\0*.LOX\0Tutti i files (*.*)\0*.*\0"; + ofn.lpstrCustomFilter = NULL; + ofn.nFilterIndex = 1; + ofn.lpstrFile = lpszFileName; + ofn.nMaxFile = 512; + ofn.lpstrInitialDir = NULL; + ofn.lpstrTitle = "Load Location"; + ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST; + + if (!GetOpenFileName(&ofn)) ASSERT(0); // Carica la locazione m_loc.Load(lpszFileName); m_bLocationLoaded = true; - m_nCurLoc=m_loc.TEMPGetNumLoc(); - - if (ptTonyStart.x==-1 && ptTonyStart.y==-1) - InitForNewLocation(m_loc.TEMPGetNumLoc(),m_loc.TEMPGetTonyStart(),RMPoint(-1,-1)); + m_nCurLoc = m_loc.TEMPGetNumLoc(); + + if (ptTonyStart.x == -1 && ptTonyStart.y == -1) + InitForNewLocation(m_loc.TEMPGetNumLoc(), m_loc.TEMPGetTonyStart(), RMPoint(-1, -1)); else - InitForNewLocation(m_loc.TEMPGetNumLoc(),ptTonyStart,start); + InitForNewLocation(m_loc.TEMPGetNumLoc(), ptTonyStart, start); #endif } void RMGfxEngine::InitForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { if (start.x == -1 || start.y == -1) { - start.x = ptTonyStart.x-RM_SX / 2; - start.y = ptTonyStart.y-RM_SY / 2; + start.x = ptTonyStart.x - RM_SX / 2; + start.y = ptTonyStart.y - RM_SY / 2; } m_loc.SetScrollPosition(start); - - if (ptTonyStart.x==0 && ptTonyStart.y == 0) { + + if (ptTonyStart.x == 0 && ptTonyStart.y == 0) { } else { - m_tony.SetPosition(ptTonyStart,nLoc); + m_tony.SetPosition(ptTonyStart, nLoc); m_tony.SetScrollPosition(start); } @@ -484,10 +483,10 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { bool bLoaded; int i; - m_nCurLoc=nLoc; + m_nCurLoc = nLoc; bLoaded = false; - for (i=0; i < 5; i++) { + for (i = 0; i < 5; i++) { // Retry sul loading della locazione RMRes res(m_nCurLoc); if (!res.IsValid()) @@ -501,13 +500,13 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { } #endif m_loc.Load(res); - InitForNewLocation(nLoc,ptTonyStart,start); + InitForNewLocation(nLoc, ptTonyStart, start); bLoaded = true; break; } - + if (!bLoaded) - SelectLocation(ptTonyStart,start); + SelectLocation(ptTonyStart, start); if (m_bOption) m_opt.ReInit(m_bigBuf); @@ -520,11 +519,11 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { CORO_BEGIN_CONTEXT; - uint32 h; + uint32 h; CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); - + // Scarica tutta la memoria della locazione CORO_INVOKE_2(mpalEndIdlePoll, m_nCurLoc, NULL); @@ -538,7 +537,7 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { MainFreeze(); m_bLocationLoaded = false; - + m_bigBuf.ClearOT(); m_loc.Unload(); @@ -549,19 +548,19 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { } void RMGfxEngine::Init(/*HINSTANCE hInst*/) { -/* - //RECUPERARE UNA LOCAZIONE: - - RMRes res(5); - ASSERT(res.IsValid()); - FILE *f; - f=fopen("c:\\code\\rm\\new\\pippo.loc","wb"); - fwrite(res,1,5356900,f); - fclose(f); -*/ + /* + //RECUPERARE UNA LOCAZIONE: + + RMRes res(5); + ASSERT(res.IsValid()); + FILE *f; + f=fopen("c:\\code\\rm\\new\\pippo.loc","wb"); + fwrite(res,1,5356900,f); + fclose(f); + */ // Schermata di loading - RMResRaw *raw; + RMResRaw *raw; RMGfxSourceBuffer16 *load = NULL; INIT_GFX16_FROMRAW(20038, load); m_bigBuf.AddPrim(new RMGfxPrimitive(load)); @@ -592,8 +591,8 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { // Inizializza la funzione di IRQ di Item per l'MPAL GLOBALS.GfxEngine = this; mpalInstallItemIrq(ItemIrq); - - // Inizializza DirectInput + + // Inizializza DirectInput m_input.Init(/*hInst*/); // Inizializza il puntatore del mouse @@ -607,25 +606,25 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { m_inv.Init(); m_inter.Init(); - // Carica la locazione e setta le priorità @@@@@ + // Carica la locazione e setta le priorità @@@@@ m_bLocationLoaded = false; -/* - m_nCurLoc=1; - RMRes res(m_nCurLoc); - m_loc.Load(res); - m_loc.SetPriority(1); - m_tony.SetPosition(RMPoint(201,316),1); - //m_tony.SetPosition(RMPoint(522,305),2); - //m_tony.SetPosition(RMPoint(158,398),4); - m_tony.SetPattern(m_tony.PAT_STANDDOWN); - m_curAction=TA_GOTO; -*/ + /* + m_nCurLoc=1; + RMRes res(m_nCurLoc); + m_loc.Load(res); + m_loc.SetPriority(1); + m_tony.SetPosition(RMPoint(201,316),1); + //m_tony.SetPosition(RMPoint(522,305),2); + //m_tony.SetPosition(RMPoint(158,398),4); + m_tony.SetPattern(m_tony.PAT_STANDDOWN); + m_curAction=TA_GOTO; + */ EnableInput(); // Inizio del gioco //m_tony.ExecuteAction(4,1,0); //PREGAME - - m_tony.ExecuteAction(20,1,0); + + m_tony.ExecuteAction(20, 1, 0); // theLog << "Seleziona la locazione\n"; //LoadLocation(1,RMPoint(201,316),RMPoint(-1,-1)); @@ -639,9 +638,9 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { //LoadLocation(25,RMPoint(221,415),RMPoint(-1,-1)); //LoadLocation(16,RMPoint(111,438),RMPoint(-1,-1)); //LoadLocation(60,RMPoint(18,302),RMPoint(-1,-1)); - + // CASTELLO - + //LoadLocation(40,RMPoint(233,441),RMPoint(-1,-1)); } @@ -716,14 +715,14 @@ void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bo mpalSaveState(state); thumbsize = 160 * 120 * 2; - + buf[0] = 'R'; buf[1] = 'M'; buf[2] = 'S'; buf[3] = TONY_SAVEGAME_VERSION; f = g_system->getSavefileManager()->openForSaving(fn); - if (f == NULL) + if (f == NULL) return; f->write(buf, 4); @@ -763,13 +762,13 @@ void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bo // New Ver5 bool bStat; - + // Saves the state of the shepherdess and show yourself bStat = m_tony.GetPastorella(); f->writeByte(bStat); bStat = m_inter.GetPalesati(); f->writeByte(bStat); - + // Save the chars CharsSaveAll(f); @@ -805,20 +804,20 @@ void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bo void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { // PROBLEMA: Bisognerebbe caricare la locazione in un thread a parte per fare la OnEnter ... CORO_BEGIN_CONTEXT; - Common::InSaveFile *f; - byte *state, *statecmp; - uint size, sizecmp; - char buf[4]; - RMPoint tp; - int loc; - int ver; - int i; + Common::InSaveFile *f; + byte *state, *statecmp; + uint size, sizecmp; + char buf[4]; + RMPoint tp; + int loc; + int ver; + int i; CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); _ctx->f = g_system->getSavefileManager()->openForLoading(fn); - if (_ctx->f == NULL) + if (_ctx->f == NULL) return; _ctx->f->read(_ctx->buf, 4); @@ -826,14 +825,14 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { delete _ctx->f; return; } - + _ctx->ver = _ctx->buf[3]; - + if (_ctx->ver == 0 || _ctx->ver > TONY_SAVEGAME_VERSION) { delete _ctx->f; return; } - + if (_ctx->ver >= 0x3) { // There is a thumbnail. If the version is between 5 and 7, it's compressed if ((_ctx->ver >= 0x5) && (_ctx->ver <= 0x7)) { @@ -854,7 +853,7 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { _ctx->f->seek(1, SEEK_CUR); } - if (_ctx->ver >= 0x4) { // Skip the savegame name, which serves no purpose + if (_ctx->ver >= 0x4) { // Skip the savegame name, which serves no purpose _ctx->i = _ctx->f->readByte(); _ctx->f->seek(_ctx->i, SEEK_CUR); } @@ -870,7 +869,7 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { _ctx->state = new byte[_ctx->size]; _ctx->statecmp = new byte[_ctx->sizecmp]; _ctx->f->read(_ctx->statecmp, _ctx->sizecmp); - lzo1x_decompress(_ctx->statecmp,_ctx->sizecmp,_ctx->state,&_ctx->size); + lzo1x_decompress(_ctx->statecmp, _ctx->sizecmp, _ctx->state, &_ctx->size); delete[] _ctx->statecmp; } else { // Read uncompressed MPAL data @@ -888,7 +887,7 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { m_inv.LoadState(_ctx->state); delete[] _ctx->state; - if (_ctx->ver >= 0x2) { // Versione 2: box please + if (_ctx->ver >= 0x2) { // Versione 2: box please _ctx->size = _ctx->f->readUint32LE(); _ctx->state = new byte[_ctx->size]; _ctx->f->read(_ctx->state, _ctx->size); @@ -897,13 +896,13 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { } if (_ctx->ver >= 5) { - // Versione 5: + // Versione 5: bool bStat = false; - + bStat = _ctx->f->readByte(); - m_tony.SetPastorella(bStat); + m_tony.SetPastorella(bStat); bStat = _ctx->f->readByte(); - m_inter.SetPalesati(bStat); + m_inter.SetPalesati(bStat); CharsLoadAll(_ctx->f); } @@ -939,10 +938,10 @@ void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { delete _ctx->f; CORO_INVOKE_2(UnloadLocation, false, NULL); - LoadLocation(_ctx->loc,_ctx->tp,RMPoint(-1, -1)); + LoadLocation(_ctx->loc, _ctx->tp, RMPoint(-1, -1)); m_tony.SetPattern(RMTony::PAT_STANDRIGHT); MainUnfreeze(); - + // On older versions, need to an enter action if (_ctx->ver < 5) mpalQueryDoAction(0, _ctx->loc, 0); @@ -970,8 +969,8 @@ void RMGfxEngine::PauseSound(bool bPause) { void RMGfxEngine::InitWipe(int type) { m_bWiping = true; - m_nWipeType=type; - m_nWipeStep=0; + m_nWipeType = type; + m_nWipeStep = 0; if (m_nWipeType == 1) m_rcWipeEllipse = Common::Rect(80, 0, 640 - 80, 480); -- cgit v1.2.3 From 59942d9a41cf7d43b95e9775aca66c241884b516 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 16 May 2012 00:05:48 +1000 Subject: TONY: Work on enabling GMM saving and loading --- engines/tony/gfxengine.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 384e80f209..7cfeaecb6f 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -698,7 +698,7 @@ void LoadMusic(Common::InSaveFile *f); #define TONY_SAVEGAME_VERSION 8 -void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bool bFastCompress) { +void RMGfxEngine::SaveState(const Common::String &fn, byte *curThumb, const Common::String &name) { Common::OutSaveFile *f; byte *state; uint thumbsize; @@ -733,9 +733,9 @@ void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bo i = mpalQueryGlobalVar("VERSIONEFACILE"); f->writeByte(i); - i = strlen(name); + i = strlen(name.c_str()); f->writeByte(i); - f->write(name, i); + f->write(name.c_str(), i); f->writeUint32LE(m_nCurLoc); f->writeUint32LE(tp.x); f->writeUint32LE(tp.y); @@ -801,7 +801,7 @@ void RMGfxEngine::SaveState(const char *fn, byte *curThumb, const char *name, bo delete f; } -void RMGfxEngine::LoadState(CORO_PARAM, const char *fn) { +void RMGfxEngine::LoadState(CORO_PARAM, const Common::String &fn) { // PROBLEMA: Bisognerebbe caricare la locazione in un thread a parte per fare la OnEnter ... CORO_BEGIN_CONTEXT; Common::InSaveFile *f; @@ -986,4 +986,8 @@ void RMGfxEngine::WaitWipeEnd(CORO_PARAM) { CoroScheduler.waitForSingleObject(coroParam, m_hWipeEvent, CORO_INFINITE); } +bool RMGfxEngine::CanLoadSave() { + return m_bInput && !m_tony.InAction(); +} + } // End of namespace Tony -- cgit v1.2.3 From 7a40750671915d517e8938fdca889f870b554c8c Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 17 May 2012 19:41:53 +1000 Subject: TONY: Add a check to prevent GMM saving in the demo --- engines/tony/gfxengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 7cfeaecb6f..5d81c47333 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -987,7 +987,7 @@ void RMGfxEngine::WaitWipeEnd(CORO_PARAM) { } bool RMGfxEngine::CanLoadSave() { - return m_bInput && !m_tony.InAction(); + return m_bInput && !m_tony.InAction() && !_vm->getIsDemo(); } } // End of namespace Tony -- cgit v1.2.3 From 8b9831a50250ccc6b605058a702bb5f617a83978 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 May 2012 15:28:48 +1000 Subject: TONY: Converting Italian comments to English and formatting --- engines/tony/gfxengine.cpp | 86 +++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 5d81c47333..e4f4cfb22d 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -37,7 +37,7 @@ namespace Tony { /****************************************************************************\ -* Metodi di RMGfxEngine +* RMGfxEngine Methods \****************************************************************************/ void ExitAllIdles(CORO_PARAM, const void *param) { @@ -48,7 +48,7 @@ void ExitAllIdles(CORO_PARAM, const void *param) { CORO_BEGIN_CODE(_ctx); - // Chiude le idle + // Closes idle GLOBALS.bSkipSfxNoLoop = true; CORO_INVOKE_2(mpalEndIdlePoll, nCurLoc, NULL); @@ -60,7 +60,7 @@ void ExitAllIdles(CORO_PARAM, const void *param) { } RMGfxEngine::RMGfxEngine() { - // Crea il big buffer dove verranno disegnati i frame + // Create big buffer where the frame will be rendered m_bigBuf.Create(RM_BBX, RM_BBY, 16); m_bigBuf.OffsetY(RM_SKIPY); @@ -83,7 +83,7 @@ RMGfxEngine::RMGfxEngine() { } RMGfxEngine::~RMGfxEngine() { - // Chiude il buffer + // Close the buffer m_bigBuf.Destroy(); g_system->deleteMutex(csMainLoop); } @@ -121,7 +121,7 @@ void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) { EnableMouse(); _vm->GrabThumbnail(); - // Esce la IDLE onde evitare la morte prematura in caricamento + // Exists the IDLE to avoid premature death in loading m_bMustEnterMenu = true; if (type == 1 || type == 2) { GLOBALS.bIdleExited = true; @@ -145,7 +145,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { g_system->lockMutex(csMainLoop); - // Poll dei dispositivi di input + // Poll of input devices m_input.Poll(); if (m_bMustEnterMenu && GLOBALS.bIdleExited) { @@ -166,25 +166,25 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { } if (bDrawLocation && m_bLocationLoaded) { - // Locazione e oggetti + // Location and objects m_loc.DoFrame(&m_bigBuf); - // Controlla gli input del mouse + // Check the mouse input if (m_bInput && !m_tony.InAction()) { - // Se siamo sull'inventario, è lui che controlla tutti gli input + // If we are on the inventory, it is it who controls all input if (m_inv.HaveFocus(m_input.MousePos()) && !m_inter.Active()) { - // CLICK SINISTRO - // ************** + // Left Click + // ********** if (m_input.MouseLeftClicked()/* && m_itemName.IsItemSelected()*/) { - // Left click attiva il combine, se siamo su un oggetto + // Left click activates the combine, if we are on an object if (m_inv.LeftClick(m_input.MousePos(), m_curActionObj)) { m_curAction = TA_COMBINE; m_point.SetAction(m_curAction); } } else - // CLICK DESTRO - // ************ + // Right Click + // *********** if (m_input.MouseRightClicked()) { if (m_itemName.IsItemSelected()) { m_curActionObj = 0; @@ -193,8 +193,8 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { m_inv.RightClick(m_input.MousePos()); } else - // RILASCIO DESTRO - // *************** + // Right Release + // ************* if (m_input.MouseRightReleased()) { if (m_inv.RightRelease(m_input.MousePos(), m_curAction)) { CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction); @@ -204,7 +204,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { } } } else { - // Menu Opzioni + // Options Menu // ************ if (m_bGUIOption) { if (!m_tony.InAction() && m_bInput) { @@ -224,10 +224,10 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { } } - // CLICK SINISTRO + // Left Click // ************** if (m_input.MouseLeftClicked() && !m_inter.Active()) { - // Se clicko dentro un oggetto, esegui l'azione + // If click inside an item, perform action //if (m_itemName.IsItemSelected()) { if (m_curAction != TA_COMBINE) @@ -246,10 +246,10 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { } SKIPCLICKSINISTRO: - // CLICK DESTRO + // Right Click // ************ if (m_curAction == TA_COMBINE) { - // Durante il combine, lo annulla. + // During a combine, it cancels it if (m_input.MouseRightClicked()) { m_inv.EndCombine(); m_curActionObj = 0; @@ -259,7 +259,7 @@ SKIPCLICKSINISTRO: } } else if (m_input.MouseRightClicked() && m_itemName.IsItemSelected() && m_point.GetSpecialPointer() == RMPointer::PTR_NONE) { if (m_bGUIInterface) { - // Prima di aprire l'interfaccia, rimette GOTO + // Before opening the interface, replaces GOTO m_curAction = TA_GOTO; m_curActionObj = 0; m_point.SetAction(m_curAction); @@ -268,8 +268,8 @@ SKIPCLICKSINISTRO: } - // RILASCIO DESTRO - // *************** + // Right Release + // ************* if (m_input.MouseRightReleased()) { if (m_bGUIInterface) { if (m_inter.Released(m_input.MousePos(), m_curAction)) { @@ -283,21 +283,21 @@ SKIPCLICKSINISTRO: } } - // Aggiorna il nome sotto il puntatore del mouse + // Update the name under the mouse pointer m_itemName.SetMouseCoord(m_input.MousePos()); if (!m_inter.Active() && !m_inv.MiniActive()) CORO_INVOKE_4(m_itemName.DoFrame, m_bigBuf, m_loc, m_point, m_inv); } - // Inventario & interfaccia + // Interface & Inventory m_inter.DoFrame(m_bigBuf, m_input.MousePos()); m_inv.DoFrame(m_bigBuf, m_point, m_input.MousePos(), (!m_tony.InAction() && !m_inter.Active() && m_bGUIInventory)); } - // Anima Tony + // Animate Tony CORO_INVOKE_2(m_tony.DoFrame, &m_bigBuf, m_nCurLoc); - // Aggiorna lo scrolling per tenere Tony dentro lo schermo + // Update screen scrolling to keep Tony in focus if (m_tony.MustUpdateScrolling() && m_bLocationLoaded) { RMPoint showThis = m_tony.Position(); showThis.y -= 60; @@ -313,7 +313,7 @@ SKIPCLICKSINISTRO: } // ********************** - // Disegna la lista di OT + // Draw the list in the OT // ********************** CORO_INVOKE_0(m_bigBuf.DrawOT); @@ -487,7 +487,7 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { bLoaded = false; for (i = 0; i < 5; i++) { - // Retry sul loading della locazione + // Retry the loading of the location RMRes res(m_nCurLoc); if (!res.IsValid()) continue; @@ -513,7 +513,7 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { m_bLocationLoaded = true; - // On Enter per la locazion + // On entering the location return CORO_INVALID_PID_VALUE; //mpalQueryDoAction(0,m_nCurLoc,0); } @@ -524,7 +524,7 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { CORO_BEGIN_CODE(_ctx); - // Scarica tutta la memoria della locazione + // Release the location CORO_INVOKE_2(mpalEndIdlePoll, m_nCurLoc, NULL); // On Exit? @@ -585,28 +585,28 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { m_bWiping = false; m_hWipeEvent = CoroScheduler.createEvent(false, false); - // Crea l'evento di freeze + // Create the freeze event csMainLoop = g_system->createMutex(); - // Inizializza la funzione di IRQ di Item per l'MPAL + // Initialise the IRQ function for items for MPAL GLOBALS.GfxEngine = this; mpalInstallItemIrq(ItemIrq); - // Inizializza DirectInput + // Initialise the input m_input.Init(/*hInst*/); - // Inizializza il puntatore del mouse + // Initialise the mouse pointer m_point.Init(); - // Inizializza Tony + // Initialise Tony m_tony.Init(); m_tony.LinkToBoxes(&_vm->_theBoxes); - // Inizializza l'inventario e l'interfaccia + // Initialise the inventory and the interface m_inv.Init(); m_inter.Init(); - // Carica la locazione e setta le priorità @@@@@ + // Download the location and set priorities @@@@@ m_bLocationLoaded = false; /* m_nCurLoc=1; @@ -621,7 +621,7 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { */ EnableInput(); - // Inizio del gioco + // Starting the game //m_tony.ExecuteAction(4,1,0); //PREGAME m_tony.ExecuteAction(20, 1, 0); @@ -707,7 +707,7 @@ void RMGfxEngine::SaveState(const Common::String &fn, byte *curThumb, const Comm char buf[4]; RMPoint tp = m_tony.Position(); - // Saving: mpal variables, current location, + tony inventory position + // Saving: MPAL variables, current location, and Tony inventory position // For now, we only save the MPAL state size = mpalGetSaveStateSize(); @@ -802,7 +802,7 @@ void RMGfxEngine::SaveState(const Common::String &fn, byte *curThumb, const Comm } void RMGfxEngine::LoadState(CORO_PARAM, const Common::String &fn) { - // PROBLEMA: Bisognerebbe caricare la locazione in un thread a parte per fare la OnEnter ... + // PROBLEM: You should change the location in a separate process to do the OnEnter CORO_BEGIN_CONTEXT; Common::InSaveFile *f; byte *state, *statecmp; @@ -896,7 +896,7 @@ void RMGfxEngine::LoadState(CORO_PARAM, const Common::String &fn) { } if (_ctx->ver >= 5) { - // Versione 5: + // Versione 5 bool bStat = false; bStat = _ctx->f->readByte(); -- cgit v1.2.3 From 7da213cd32b702ad8f4d0a10020eae10666a64ff Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 20 May 2012 16:34:38 +1000 Subject: TONY: Removal of code that was commented out in the original source --- engines/tony/gfxengine.cpp | 150 ++++----------------------------------------- 1 file changed, 13 insertions(+), 137 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index e4f4cfb22d..3fa33d78ff 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -227,14 +227,11 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { // Left Click // ************** if (m_input.MouseLeftClicked() && !m_inter.Active()) { - // If click inside an item, perform action - //if (m_itemName.IsItemSelected()) - { - if (m_curAction != TA_COMBINE) - CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_point.CurAction()); - else if (m_itemName.GetSelectedItem() != NULL) - CORO_INVOKE_4(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), TA_COMBINE, m_curActionObj); - } + + if (m_curAction != TA_COMBINE) + CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_point.CurAction()); + else if (m_itemName.GetSelectedItem() != NULL) + CORO_INVOKE_4(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), TA_COMBINE, m_curActionObj); if (m_curAction == TA_COMBINE) { m_inv.EndCombine(); @@ -380,80 +377,6 @@ void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) { } } -/* - // WINBUG: This is a special case for the file open/save dialog, - // which sometimes pumps while it is coming up but before it has - // disabled the main window. - HWND hWndFocus = ::GetFocus(); - bool bEnableParent = false; - m_ofn.hwndOwner = PreModal(); - AfxUnhookWindowCreate(); - if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner)) { - bEnableParent = true; - ::EnableWindow(m_ofn.hwndOwner, false); - } - - _AFX_THREAD_STATE* pThreadState = AfxGetThreadState(); - ASSERT(pThreadState->m_pAlternateWndInit == NULL); - - if (m_ofn.Flags & OFN_EXPLORER) - pThreadState->m_pAlternateWndInit = this; - else - AfxHookWindowCreate(this); - - int nResult; - if (m_bOpenFileDialog) - nResult = ::GetOpenFileName(&m_ofn); - else - nResult = ::GetSaveFileName(&m_ofn); - - if (nResult) - ASSERT(pThreadState->m_pAlternateWndInit == NULL); - pThreadState->m_pAlternateWndInit = NULL; - - // WINBUG: Second part of special case for file open/save dialog. - if (bEnableParent) - ::EnableWindow(m_ofn.hwndOwner, true); - if (::IsWindow(hWndFocus)) - ::SetFocus(hWndFocus); -*/ - - -void RMGfxEngine::SelectLocation(const RMPoint &ptTonyStart, const RMPoint &start) { -#if 0 - OPENFILENAME ofn; - char lpszFileName[512]; - - // @@@ Con TonyStart=-1,-1 allora usa la posizione scritta nella locazione - - // Sceglie la locazione - ZeroMemory(lpszFileName, 512); - ZeroMemory(&ofn, sizeof(ofn)); - ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = NULL; - ofn.lpstrFilter = "Locazione (*.LOC)\0*.LOC\0Locazione ottimizzata (*.LOX)\0*.LOX\0Tutti i files (*.*)\0*.*\0"; - ofn.lpstrCustomFilter = NULL; - ofn.nFilterIndex = 1; - ofn.lpstrFile = lpszFileName; - ofn.nMaxFile = 512; - ofn.lpstrInitialDir = NULL; - ofn.lpstrTitle = "Load Location"; - ofn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST; - - if (!GetOpenFileName(&ofn)) - ASSERT(0); - - // Carica la locazione - m_loc.Load(lpszFileName); - m_bLocationLoaded = true; - m_nCurLoc = m_loc.TEMPGetNumLoc(); - - if (ptTonyStart.x == -1 && ptTonyStart.y == -1) - InitForNewLocation(m_loc.TEMPGetNumLoc(), m_loc.TEMPGetTonyStart(), RMPoint(-1, -1)); - else - InitForNewLocation(m_loc.TEMPGetNumLoc(), ptTonyStart, start); -#endif -} void RMGfxEngine::InitForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { if (start.x == -1 || start.y == -1) { @@ -487,18 +410,11 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { bLoaded = false; for (i = 0; i < 5; i++) { - // Retry the loading of the location + // Try the loading of the location RMRes res(m_nCurLoc); if (!res.IsValid()) continue; -#if 0 - // codice per dumpare una locazione in caso serva una modifica - if (nLoc == 106) { - FILE *f = fopen("loc106.lox", "wb"); - fwrite(res.DataPointer(), res.Size(), 1, f); - fclose(f); - } -#endif + m_loc.Load(res); InitForNewLocation(nLoc, ptTonyStart, start); bLoaded = true; @@ -506,7 +422,7 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { } if (!bLoaded) - SelectLocation(ptTonyStart, start); + error("Location was not loaded"); if (m_bOption) m_opt.ReInit(m_bigBuf); @@ -547,19 +463,8 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { CORO_END_CODE; } -void RMGfxEngine::Init(/*HINSTANCE hInst*/) { - /* - //RECUPERARE UNA LOCAZIONE: - - RMRes res(5); - ASSERT(res.IsValid()); - FILE *f; - f=fopen("c:\\code\\rm\\new\\pippo.loc","wb"); - fwrite(res,1,5356900,f); - fclose(f); - */ - - // Schermata di loading +void RMGfxEngine::Init() { + // Screen loading RMResRaw *raw; RMGfxSourceBuffer16 *load = NULL; INIT_GFX16_FROMRAW(20038, load); @@ -573,7 +478,7 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { GLOBALS.bPatIrqFreeze = true; - // GUI attivabile + // Activate GUI m_bGUIOption = true; m_bGUIInterface = true; m_bGUIInventory = true; @@ -593,7 +498,7 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { mpalInstallItemIrq(ItemIrq); // Initialise the input - m_input.Init(/*hInst*/); + m_input.Init(); // Initialise the mouse pointer m_point.Init(); @@ -608,40 +513,11 @@ void RMGfxEngine::Init(/*HINSTANCE hInst*/) { // Download the location and set priorities @@@@@ m_bLocationLoaded = false; - /* - m_nCurLoc=1; - RMRes res(m_nCurLoc); - m_loc.Load(res); - m_loc.SetPriority(1); - m_tony.SetPosition(RMPoint(201,316),1); - //m_tony.SetPosition(RMPoint(522,305),2); - //m_tony.SetPosition(RMPoint(158,398),4); - m_tony.SetPattern(m_tony.PAT_STANDDOWN); - m_curAction=TA_GOTO; - */ + EnableInput(); // Starting the game - //m_tony.ExecuteAction(4,1,0); //PREGAME - m_tony.ExecuteAction(20, 1, 0); - -// theLog << "Seleziona la locazione\n"; - //LoadLocation(1,RMPoint(201,316),RMPoint(-1,-1)); - //SelectLocation(); - //LoadLocation(5,RMPoint(685,338),RMPoint(-1,-1)); - //LoadLocation(7,RMPoint(153,424),RMPoint(-1,-1)); - //LoadLocation(70,RMPoint(10,10),RMPoint(-1,-1)); - //LoadLocation(20,RMPoint(112,348),RMPoint(-1,-1)); - //LoadLocation(26,RMPoint(95,456),RMPoint(-1,-1)); - //LoadLocation(12,RMPoint(221,415),RMPoint(-1,-1)); - //LoadLocation(25,RMPoint(221,415),RMPoint(-1,-1)); - //LoadLocation(16,RMPoint(111,438),RMPoint(-1,-1)); - //LoadLocation(60,RMPoint(18,302),RMPoint(-1,-1)); - - // CASTELLO - - //LoadLocation(40,RMPoint(233,441),RMPoint(-1,-1)); } void RMGfxEngine::Close(void) { -- cgit v1.2.3 From a1f6f8ceb19d65619dfd8e2477bffad773ba49ba Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 4 Jun 2012 23:45:36 +0200 Subject: TONY: Rename variables and functions in tony.h --- engines/tony/gfxengine.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 3fa33d78ff..4642ee0ab7 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -109,7 +109,7 @@ void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) { CORO_INVOKE_3(m_opt.InitSaveMenuOnly, m_bigBuf, false, _ctx->bRes); if (_ctx->bRes) { - _vm->PauseSound(true); + _vm->pauseSound(true); DisableInput(); m_inv.EndCombine(); @@ -119,7 +119,7 @@ void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) { m_point.SetSpecialPointer(RMPointer::PTR_NONE); m_point.SetCustomPointer(NULL); EnableMouse(); - _vm->GrabThumbnail(); + _vm->grabThumbnail(); // Exists the IDLE to avoid premature death in loading m_bMustEnterMenu = true; @@ -161,7 +161,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { DisableMouse(); EnableInput(); mpalStartIdlePoll(m_nCurLoc); - _vm->PauseSound(false); + _vm->pauseSound(false); } } -- cgit v1.2.3 From 014330a538244b0e33bcf230cc5e84c28977f096 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 5 Jun 2012 00:02:15 +0200 Subject: TONY: Rename variables and functions in input.h --- engines/tony/gfxengine.cpp | 50 +++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 4642ee0ab7..2ff57bf804 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -146,7 +146,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { g_system->lockMutex(csMainLoop); // Poll of input devices - m_input.Poll(); + m_input.poll(); if (m_bMustEnterMenu && GLOBALS.bIdleExited) { m_bOption = true; @@ -172,12 +172,12 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { // Check the mouse input if (m_bInput && !m_tony.InAction()) { // If we are on the inventory, it is it who controls all input - if (m_inv.HaveFocus(m_input.MousePos()) && !m_inter.Active()) { + if (m_inv.HaveFocus(m_input.mousePos()) && !m_inter.Active()) { // Left Click // ********** - if (m_input.MouseLeftClicked()/* && m_itemName.IsItemSelected()*/) { + if (m_input.mouseLeftClicked()/* && m_itemName.IsItemSelected()*/) { // Left click activates the combine, if we are on an object - if (m_inv.LeftClick(m_input.MousePos(), m_curActionObj)) { + if (m_inv.LeftClick(m_input.mousePos(), m_curActionObj)) { m_curAction = TA_COMBINE; m_point.SetAction(m_curAction); } @@ -185,18 +185,18 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { // Right Click // *********** - if (m_input.MouseRightClicked()) { + if (m_input.mouseRightClicked()) { if (m_itemName.IsItemSelected()) { m_curActionObj = 0; - m_inv.RightClick(m_input.MousePos()); + m_inv.RightClick(m_input.mousePos()); } else - m_inv.RightClick(m_input.MousePos()); + m_inv.RightClick(m_input.mousePos()); } else // Right Release // ************* - if (m_input.MouseRightReleased()) { - if (m_inv.RightRelease(m_input.MousePos(), m_curAction)) { + if (m_input.mouseRightReleased()) { + if (m_inv.RightRelease(m_input.mousePos(), m_curAction)) { CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction); m_curAction = TA_GOTO; @@ -208,16 +208,16 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { // ************ if (m_bGUIOption) { if (!m_tony.InAction() && m_bInput) { - if ((m_input.MouseLeftClicked() && m_input.MousePos().x < 3 && m_input.MousePos().y < 3)) { + if ((m_input.mouseLeftClicked() && m_input.mousePos().x < 3 && m_input.mousePos().y < 3)) { CORO_INVOKE_1(OpenOptionScreen, 0); goto SKIPCLICKSINISTRO; - } else if (m_input.GetAsyncKeyState(Common::KEYCODE_ESCAPE)) + } else if (m_input.getAsyncKeyState(Common::KEYCODE_ESCAPE)) CORO_INVOKE_1(OpenOptionScreen, 0); else if (!_vm->getIsDemo()) { - if (m_input.GetAsyncKeyState(Common::KEYCODE_F3) || m_input.GetAsyncKeyState(Common::KEYCODE_F5)) + if (m_input.getAsyncKeyState(Common::KEYCODE_F3) || m_input.getAsyncKeyState(Common::KEYCODE_F5)) // Save game screen CORO_INVOKE_1(OpenOptionScreen, 3); - else if (m_input.GetAsyncKeyState(Common::KEYCODE_F2) || m_input.GetAsyncKeyState(Common::KEYCODE_F7)) + else if (m_input.getAsyncKeyState(Common::KEYCODE_F2) || m_input.getAsyncKeyState(Common::KEYCODE_F7)) // Load game screen CORO_INVOKE_1(OpenOptionScreen, 4); } @@ -226,7 +226,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { // Left Click // ************** - if (m_input.MouseLeftClicked() && !m_inter.Active()) { + if (m_input.mouseLeftClicked() && !m_inter.Active()) { if (m_curAction != TA_COMBINE) CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_point.CurAction()); @@ -247,29 +247,29 @@ SKIPCLICKSINISTRO: // ************ if (m_curAction == TA_COMBINE) { // During a combine, it cancels it - if (m_input.MouseRightClicked()) { + if (m_input.mouseRightClicked()) { m_inv.EndCombine(); m_curActionObj = 0; m_curAction = TA_GOTO; m_point.SetAction(m_curAction); m_point.SetSpecialPointer(RMPointer::PTR_NONE); } - } else if (m_input.MouseRightClicked() && m_itemName.IsItemSelected() && m_point.GetSpecialPointer() == RMPointer::PTR_NONE) { + } else if (m_input.mouseRightClicked() && m_itemName.IsItemSelected() && m_point.GetSpecialPointer() == RMPointer::PTR_NONE) { if (m_bGUIInterface) { // Before opening the interface, replaces GOTO m_curAction = TA_GOTO; m_curActionObj = 0; m_point.SetAction(m_curAction); - m_inter.Clicked(m_input.MousePos()); + m_inter.Clicked(m_input.mousePos()); } } // Right Release // ************* - if (m_input.MouseRightReleased()) { + if (m_input.mouseRightReleased()) { if (m_bGUIInterface) { - if (m_inter.Released(m_input.MousePos(), m_curAction)) { + if (m_inter.Released(m_input.mousePos(), m_curAction)) { m_point.SetAction(m_curAction); CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction); @@ -281,14 +281,14 @@ SKIPCLICKSINISTRO: } // Update the name under the mouse pointer - m_itemName.SetMouseCoord(m_input.MousePos()); + m_itemName.SetMouseCoord(m_input.mousePos()); if (!m_inter.Active() && !m_inv.MiniActive()) CORO_INVOKE_4(m_itemName.DoFrame, m_bigBuf, m_loc, m_point, m_inv); } // Interface & Inventory - m_inter.DoFrame(m_bigBuf, m_input.MousePos()); - m_inv.DoFrame(m_bigBuf, m_point, m_input.MousePos(), (!m_tony.InAction() && !m_inter.Active() && m_bGUIInventory)); + m_inter.DoFrame(m_bigBuf, m_input.mousePos()); + m_inv.DoFrame(m_bigBuf, m_point, m_input.mousePos(), (!m_tony.InAction() && !m_inter.Active() && m_bGUIInventory)); } // Animate Tony @@ -305,7 +305,7 @@ SKIPCLICKSINISTRO: m_tony.SetScrollPosition(m_loc.ScrollPosition()); if ((!m_tony.InAction() && m_bInput) || m_bAlwaysDrawMouse) { - m_point.SetCoord(m_input.MousePos()); + m_point.SetCoord(m_input.mousePos()); m_point.DoFrame(&m_bigBuf); } @@ -498,7 +498,7 @@ void RMGfxEngine::Init() { mpalInstallItemIrq(ItemIrq); // Initialise the input - m_input.Init(); + m_input.init(); // Initialise the mouse pointer m_point.Init(); @@ -527,7 +527,7 @@ void RMGfxEngine::Close(void) { m_inv.Close(); m_tony.Close(); m_point.Close(); - m_input.Close(); + m_input.close(); } void RMGfxEngine::SwitchFullscreen(bool bFull) { -- cgit v1.2.3 From a5cb751f7ab82a089207025810e3aaa0f0748dbd Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 5 Jun 2012 01:04:53 +0200 Subject: TONY: Rename variables and functions in gfxengine.h --- engines/tony/gfxengine.cpp | 500 ++++++++++++++++++++++----------------------- 1 file changed, 249 insertions(+), 251 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 2ff57bf804..75eb6de883 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -61,34 +61,34 @@ void ExitAllIdles(CORO_PARAM, const void *param) { RMGfxEngine::RMGfxEngine() { // Create big buffer where the frame will be rendered - m_bigBuf.Create(RM_BBX, RM_BBY, 16); - m_bigBuf.OffsetY(RM_SKIPY); - - csMainLoop = NULL; - m_nCurLoc = 0; - m_curAction = TA_GOTO; - m_curActionObj = 0; - m_nWipeType = 0; - m_hWipeEvent = 0; - m_nWipeStep = 0; - m_bMustEnterMenu = false; - m_bWiping = false; - m_bGUIOption = false; - m_bGUIInterface = false; - m_bGUIInventory = false; - m_bAlwaysDrawMouse = false; - m_bOption = false; - m_bLocationLoaded = false; - m_bInput = false; + _bigBuf.Create(RM_BBX, RM_BBY, 16); + _bigBuf.OffsetY(RM_SKIPY); + + _csMainLoop = NULL; + _nCurLoc = 0; + _curAction = TA_GOTO; + _curActionObj = 0; + _nWipeType = 0; + _hWipeEvent = 0; + _nWipeStep = 0; + _bMustEnterMenu = false; + _bWiping = false; + _bGUIOption = false; + _bGUIInterface = false; + _bGUIInventory = false; + _bAlwaysDrawMouse = false; + _bOption = false; + _bLocationLoaded = false; + _bInput = false; } RMGfxEngine::~RMGfxEngine() { // Close the buffer - m_bigBuf.Destroy(); - g_system->deleteMutex(csMainLoop); + _bigBuf.Destroy(); + g_system->deleteMutex(_csMainLoop); } -void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) { +void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) { CORO_BEGIN_CONTEXT; bool bRes; CORO_END_CONTEXT(_ctx); @@ -98,271 +98,271 @@ void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) { _ctx->bRes = false; if (type == 0) - CORO_INVOKE_2(m_opt.Init, m_bigBuf, _ctx->bRes); + CORO_INVOKE_2(_opt.Init, _bigBuf, _ctx->bRes); else if (type == 1) - CORO_INVOKE_3(m_opt.InitLoadMenuOnly, m_bigBuf, true, _ctx->bRes); + CORO_INVOKE_3(_opt.InitLoadMenuOnly, _bigBuf, true, _ctx->bRes); else if (type == 2) - CORO_INVOKE_2(m_opt.InitNoLoadSave, m_bigBuf, _ctx->bRes); + CORO_INVOKE_2(_opt.InitNoLoadSave, _bigBuf, _ctx->bRes); else if (type == 3) - CORO_INVOKE_3(m_opt.InitLoadMenuOnly, m_bigBuf, false, _ctx->bRes); + CORO_INVOKE_3(_opt.InitLoadMenuOnly, _bigBuf, false, _ctx->bRes); else if (type == 4) - CORO_INVOKE_3(m_opt.InitSaveMenuOnly, m_bigBuf, false, _ctx->bRes); + CORO_INVOKE_3(_opt.InitSaveMenuOnly, _bigBuf, false, _ctx->bRes); if (_ctx->bRes) { _vm->pauseSound(true); - DisableInput(); - m_inv.EndCombine(); - m_curActionObj = 0; - m_curAction = TA_GOTO; - m_point.SetAction(m_curAction); - m_point.SetSpecialPointer(RMPointer::PTR_NONE); - m_point.SetCustomPointer(NULL); - EnableMouse(); + disableInput(); + _inv.EndCombine(); + _curActionObj = 0; + _curAction = TA_GOTO; + _point.SetAction(_curAction); + _point.SetSpecialPointer(RMPointer::PTR_NONE); + _point.SetCustomPointer(NULL); + enableMouse(); _vm->grabThumbnail(); // Exists the IDLE to avoid premature death in loading - m_bMustEnterMenu = true; + _bMustEnterMenu = true; if (type == 1 || type == 2) { GLOBALS.bIdleExited = true; } else { - CORO_INVOKE_0(m_tony.StopNoAction); + CORO_INVOKE_0(_tony.StopNoAction); GLOBALS.bIdleExited = false; - CoroScheduler.createProcess(ExitAllIdles, &m_nCurLoc, sizeof(int)); + CoroScheduler.createProcess(ExitAllIdles, &_nCurLoc, sizeof(int)); } } CORO_END_CODE; } -void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { +void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); CORO_BEGIN_CODE(_ctx); - g_system->lockMutex(csMainLoop); + g_system->lockMutex(_csMainLoop); // Poll of input devices - m_input.poll(); + _input.poll(); - if (m_bMustEnterMenu && GLOBALS.bIdleExited) { - m_bOption = true; - m_bMustEnterMenu = false; + if (_bMustEnterMenu && GLOBALS.bIdleExited) { + _bOption = true; + _bMustEnterMenu = false; GLOBALS.bIdleExited = false; } - if (m_bOption) { - CORO_INVOKE_1(m_opt.DoFrame, &m_input); - m_bOption = !m_opt.IsClosing(); - if (!m_bOption) { - DisableMouse(); - EnableInput(); - mpalStartIdlePoll(m_nCurLoc); + if (_bOption) { + CORO_INVOKE_1(_opt.DoFrame, &_input); + _bOption = !_opt.IsClosing(); + if (!_bOption) { + disableMouse(); + enableInput(); + mpalStartIdlePoll(_nCurLoc); _vm->pauseSound(false); } } - if (bDrawLocation && m_bLocationLoaded) { + if (bDrawLocation && _bLocationLoaded) { // Location and objects - m_loc.DoFrame(&m_bigBuf); + _loc.DoFrame(&_bigBuf); // Check the mouse input - if (m_bInput && !m_tony.InAction()) { + if (_bInput && !_tony.InAction()) { // If we are on the inventory, it is it who controls all input - if (m_inv.HaveFocus(m_input.mousePos()) && !m_inter.Active()) { + if (_inv.HaveFocus(_input.mousePos()) && !_inter.Active()) { // Left Click // ********** - if (m_input.mouseLeftClicked()/* && m_itemName.IsItemSelected()*/) { + if (_input.mouseLeftClicked()/* && m_itemName.IsItemSelected()*/) { // Left click activates the combine, if we are on an object - if (m_inv.LeftClick(m_input.mousePos(), m_curActionObj)) { - m_curAction = TA_COMBINE; - m_point.SetAction(m_curAction); + if (_inv.LeftClick(_input.mousePos(), _curActionObj)) { + _curAction = TA_COMBINE; + _point.SetAction(_curAction); } } else // Right Click // *********** - if (m_input.mouseRightClicked()) { - if (m_itemName.IsItemSelected()) { - m_curActionObj = 0; - m_inv.RightClick(m_input.mousePos()); + if (_input.mouseRightClicked()) { + if (_itemName.IsItemSelected()) { + _curActionObj = 0; + _inv.RightClick(_input.mousePos()); } else - m_inv.RightClick(m_input.mousePos()); + _inv.RightClick(_input.mousePos()); } else // Right Release // ************* - if (m_input.mouseRightReleased()) { - if (m_inv.RightRelease(m_input.mousePos(), m_curAction)) { - CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction); + if (_input.mouseRightReleased()) { + if (_inv.RightRelease(_input.mousePos(), _curAction)) { + CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), _curAction); - m_curAction = TA_GOTO; - m_point.SetAction(m_curAction); + _curAction = TA_GOTO; + _point.SetAction(_curAction); } } } else { // Options Menu // ************ - if (m_bGUIOption) { - if (!m_tony.InAction() && m_bInput) { - if ((m_input.mouseLeftClicked() && m_input.mousePos().x < 3 && m_input.mousePos().y < 3)) { - CORO_INVOKE_1(OpenOptionScreen, 0); + if (_bGUIOption) { + if (!_tony.InAction() && _bInput) { + if ((_input.mouseLeftClicked() && _input.mousePos().x < 3 && _input.mousePos().y < 3)) { + CORO_INVOKE_1(openOptionScreen, 0); goto SKIPCLICKSINISTRO; - } else if (m_input.getAsyncKeyState(Common::KEYCODE_ESCAPE)) - CORO_INVOKE_1(OpenOptionScreen, 0); + } else if (_input.getAsyncKeyState(Common::KEYCODE_ESCAPE)) + CORO_INVOKE_1(openOptionScreen, 0); else if (!_vm->getIsDemo()) { - if (m_input.getAsyncKeyState(Common::KEYCODE_F3) || m_input.getAsyncKeyState(Common::KEYCODE_F5)) + if (_input.getAsyncKeyState(Common::KEYCODE_F3) || _input.getAsyncKeyState(Common::KEYCODE_F5)) // Save game screen - CORO_INVOKE_1(OpenOptionScreen, 3); - else if (m_input.getAsyncKeyState(Common::KEYCODE_F2) || m_input.getAsyncKeyState(Common::KEYCODE_F7)) + CORO_INVOKE_1(openOptionScreen, 3); + else if (_input.getAsyncKeyState(Common::KEYCODE_F2) || _input.getAsyncKeyState(Common::KEYCODE_F7)) // Load game screen - CORO_INVOKE_1(OpenOptionScreen, 4); + CORO_INVOKE_1(openOptionScreen, 4); } } } // Left Click // ************** - if (m_input.mouseLeftClicked() && !m_inter.Active()) { + if (_input.mouseLeftClicked() && !_inter.Active()) { - if (m_curAction != TA_COMBINE) - CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_point.CurAction()); - else if (m_itemName.GetSelectedItem() != NULL) - CORO_INVOKE_4(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), TA_COMBINE, m_curActionObj); + if (_curAction != TA_COMBINE) + CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), _point.CurAction()); + else if (_itemName.GetSelectedItem() != NULL) + CORO_INVOKE_4(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), TA_COMBINE, _curActionObj); - if (m_curAction == TA_COMBINE) { - m_inv.EndCombine(); - m_point.SetSpecialPointer(RMPointer::PTR_NONE); + if (_curAction == TA_COMBINE) { + _inv.EndCombine(); + _point.SetSpecialPointer(RMPointer::PTR_NONE); } - m_curAction = TA_GOTO; - m_point.SetAction(m_curAction); + _curAction = TA_GOTO; + _point.SetAction(_curAction); } SKIPCLICKSINISTRO: // Right Click // ************ - if (m_curAction == TA_COMBINE) { + if (_curAction == TA_COMBINE) { // During a combine, it cancels it - if (m_input.mouseRightClicked()) { - m_inv.EndCombine(); - m_curActionObj = 0; - m_curAction = TA_GOTO; - m_point.SetAction(m_curAction); - m_point.SetSpecialPointer(RMPointer::PTR_NONE); + if (_input.mouseRightClicked()) { + _inv.EndCombine(); + _curActionObj = 0; + _curAction = TA_GOTO; + _point.SetAction(_curAction); + _point.SetSpecialPointer(RMPointer::PTR_NONE); } - } else if (m_input.mouseRightClicked() && m_itemName.IsItemSelected() && m_point.GetSpecialPointer() == RMPointer::PTR_NONE) { - if (m_bGUIInterface) { + } else if (_input.mouseRightClicked() && _itemName.IsItemSelected() && _point.GetSpecialPointer() == RMPointer::PTR_NONE) { + if (_bGUIInterface) { // Before opening the interface, replaces GOTO - m_curAction = TA_GOTO; - m_curActionObj = 0; - m_point.SetAction(m_curAction); - m_inter.Clicked(m_input.mousePos()); + _curAction = TA_GOTO; + _curActionObj = 0; + _point.SetAction(_curAction); + _inter.Clicked(_input.mousePos()); } } // Right Release // ************* - if (m_input.mouseRightReleased()) { - if (m_bGUIInterface) { - if (m_inter.Released(m_input.mousePos(), m_curAction)) { - m_point.SetAction(m_curAction); - CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction); - - m_curAction = TA_GOTO; - m_point.SetAction(m_curAction); + if (_input.mouseRightReleased()) { + if (_bGUIInterface) { + if (_inter.Released(_input.mousePos(), _curAction)) { + _point.SetAction(_curAction); + CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), _curAction); + + _curAction = TA_GOTO; + _point.SetAction(_curAction); } } } } // Update the name under the mouse pointer - m_itemName.SetMouseCoord(m_input.mousePos()); - if (!m_inter.Active() && !m_inv.MiniActive()) - CORO_INVOKE_4(m_itemName.DoFrame, m_bigBuf, m_loc, m_point, m_inv); + _itemName.SetMouseCoord(_input.mousePos()); + if (!_inter.Active() && !_inv.MiniActive()) + CORO_INVOKE_4(_itemName.DoFrame, _bigBuf, _loc, _point, _inv); } // Interface & Inventory - m_inter.DoFrame(m_bigBuf, m_input.mousePos()); - m_inv.DoFrame(m_bigBuf, m_point, m_input.mousePos(), (!m_tony.InAction() && !m_inter.Active() && m_bGUIInventory)); + _inter.DoFrame(_bigBuf, _input.mousePos()); + _inv.DoFrame(_bigBuf, _point, _input.mousePos(), (!_tony.InAction() && !_inter.Active() && _bGUIInventory)); } // Animate Tony - CORO_INVOKE_2(m_tony.DoFrame, &m_bigBuf, m_nCurLoc); + CORO_INVOKE_2(_tony.DoFrame, &_bigBuf, _nCurLoc); // Update screen scrolling to keep Tony in focus - if (m_tony.MustUpdateScrolling() && m_bLocationLoaded) { - RMPoint showThis = m_tony.Position(); + if (_tony.MustUpdateScrolling() && _bLocationLoaded) { + RMPoint showThis = _tony.Position(); showThis.y -= 60; - m_loc.UpdateScrolling(showThis); + _loc.UpdateScrolling(showThis); } - if (m_bLocationLoaded) - m_tony.SetScrollPosition(m_loc.ScrollPosition()); + if (_bLocationLoaded) + _tony.SetScrollPosition(_loc.ScrollPosition()); - if ((!m_tony.InAction() && m_bInput) || m_bAlwaysDrawMouse) { - m_point.SetCoord(m_input.mousePos()); - m_point.DoFrame(&m_bigBuf); + if ((!_tony.InAction() && _bInput) || _bAlwaysDrawMouse) { + _point.SetCoord(_input.mousePos()); + _point.DoFrame(&_bigBuf); } // ********************** // Draw the list in the OT // ********************** - CORO_INVOKE_0(m_bigBuf.DrawOT); + CORO_INVOKE_0(_bigBuf.DrawOT); #define FSTEP (480/32) // Wipe - if (m_bWiping) { - switch (m_nWipeType) { + if (_bWiping) { + switch (_nWipeType) { case 1: - if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top >= FSTEP * 2)) { - CoroScheduler.setEvent(m_hWipeEvent); - m_nWipeType = 3; + if (!(_rcWipeEllipse.bottom - _rcWipeEllipse.top >= FSTEP * 2)) { + CoroScheduler.setEvent(_hWipeEvent); + _nWipeType = 3; break; } - m_rcWipeEllipse.top += FSTEP; - m_rcWipeEllipse.left += FSTEP; - m_rcWipeEllipse.right -= FSTEP; - m_rcWipeEllipse.bottom -= FSTEP; + _rcWipeEllipse.top += FSTEP; + _rcWipeEllipse.left += FSTEP; + _rcWipeEllipse.right -= FSTEP; + _rcWipeEllipse.bottom -= FSTEP; break; case 2: - if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top < 480 - FSTEP)) { - CoroScheduler.setEvent(m_hWipeEvent); - m_nWipeType = 3; + if (!(_rcWipeEllipse.bottom - _rcWipeEllipse.top < 480 - FSTEP)) { + CoroScheduler.setEvent(_hWipeEvent); + _nWipeType = 3; break; } - m_rcWipeEllipse.top -= FSTEP; - m_rcWipeEllipse.left -= FSTEP; - m_rcWipeEllipse.right += FSTEP; - m_rcWipeEllipse.bottom += FSTEP; + _rcWipeEllipse.top -= FSTEP; + _rcWipeEllipse.left -= FSTEP; + _rcWipeEllipse.right += FSTEP; + _rcWipeEllipse.bottom += FSTEP; break; } } - g_system->unlockMutex(csMainLoop); + g_system->unlockMutex(_csMainLoop); CORO_END_CODE; } -void RMGfxEngine::InitCustomDll(void) { - SetupGlobalVars(&m_tony, &m_point, &_vm->_theBoxes, &m_loc, &m_inv, &m_input); +void RMGfxEngine::initCustomDll(void) { + setupGlobalVars(&_tony, &_point, &_vm->_theBoxes, &_loc, &_inv, &_input); } -void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) { +void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) { RMItem *item; assert(GLOBALS.GfxEngine); - if (GLOBALS.GfxEngine->m_bLocationLoaded) { - item = GLOBALS.GfxEngine->m_loc.GetItemFromCode(dwItem); + if (GLOBALS.GfxEngine->_bLocationLoaded) { + item = GLOBALS.GfxEngine->_loc.GetItemFromCode(dwItem); if (item != NULL) { if (nPattern != -1) { if (GLOBALS.bPatIrqFreeze) @@ -378,45 +378,45 @@ void RMGfxEngine::ItemIrq(uint32 dwItem, int nPattern, int nStatus) { } -void RMGfxEngine::InitForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { +void RMGfxEngine::initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { if (start.x == -1 || start.y == -1) { start.x = ptTonyStart.x - RM_SX / 2; start.y = ptTonyStart.y - RM_SY / 2; } - m_loc.SetScrollPosition(start); + _loc.SetScrollPosition(start); if (ptTonyStart.x == 0 && ptTonyStart.y == 0) { } else { - m_tony.SetPosition(ptTonyStart, nLoc); - m_tony.SetScrollPosition(start); + _tony.SetPosition(ptTonyStart, nLoc); + _tony.SetScrollPosition(start); } - m_curAction = TA_GOTO; - m_point.SetCustomPointer(NULL); - m_point.SetSpecialPointer(RMPointer::PTR_NONE); - m_point.SetAction(m_curAction); - m_inter.Reset(); - m_inv.Reset(); + _curAction = TA_GOTO; + _point.SetCustomPointer(NULL); + _point.SetSpecialPointer(RMPointer::PTR_NONE); + _point.SetAction(_curAction); + _inter.Reset(); + _inv.Reset(); - mpalStartIdlePoll(m_nCurLoc); + mpalStartIdlePoll(_nCurLoc); } -uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { +uint32 RMGfxEngine::loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { bool bLoaded; int i; - m_nCurLoc = nLoc; + _nCurLoc = nLoc; bLoaded = false; for (i = 0; i < 5; i++) { // Try the loading of the location - RMRes res(m_nCurLoc); + RMRes res(_nCurLoc); if (!res.IsValid()) continue; - m_loc.Load(res); - InitForNewLocation(nLoc, ptTonyStart, start); + _loc.Load(res); + initForNewLocation(nLoc, ptTonyStart, start); bLoaded = true; break; } @@ -424,16 +424,16 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { if (!bLoaded) error("Location was not loaded"); - if (m_bOption) - m_opt.ReInit(m_bigBuf); + if (_bOption) + _opt.ReInit(_bigBuf); - m_bLocationLoaded = true; + _bLocationLoaded = true; // On entering the location return CORO_INVALID_PID_VALUE; //mpalQueryDoAction(0,m_nCurLoc,0); } -void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { +void RMGfxEngine::unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { CORO_BEGIN_CONTEXT; uint32 h; CORO_END_CONTEXT(_ctx); @@ -441,21 +441,21 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { CORO_BEGIN_CODE(_ctx); // Release the location - CORO_INVOKE_2(mpalEndIdlePoll, m_nCurLoc, NULL); + CORO_INVOKE_2(mpalEndIdlePoll, _nCurLoc, NULL); // On Exit? if (bDoOnExit) { - _ctx->h = mpalQueryDoAction(1, m_nCurLoc, 0); + _ctx->h = mpalQueryDoAction(1, _nCurLoc, 0); if (_ctx->h != CORO_INVALID_PID_VALUE) CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE); } MainFreeze(); - m_bLocationLoaded = false; + _bLocationLoaded = false; - m_bigBuf.ClearOT(); - m_loc.Unload(); + _bigBuf.ClearOT(); + _loc.Unload(); if (result != NULL) *result = CORO_INVALID_PID_VALUE; @@ -463,102 +463,100 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { CORO_END_CODE; } -void RMGfxEngine::Init() { +void RMGfxEngine::init() { // Screen loading RMResRaw *raw; RMGfxSourceBuffer16 *load = NULL; INIT_GFX16_FROMRAW(20038, load); - m_bigBuf.AddPrim(new RMGfxPrimitive(load)); - m_bigBuf.DrawOT(Common::nullContext); - m_bigBuf.ClearOT(); + _bigBuf.AddPrim(new RMGfxPrimitive(load)); + _bigBuf.DrawOT(Common::nullContext); + _bigBuf.ClearOT(); delete load; _vm->_window.GetNewFrame(*this, NULL); - - GLOBALS.bPatIrqFreeze = true; // Activate GUI - m_bGUIOption = true; - m_bGUIInterface = true; - m_bGUIInventory = true; + _bGUIOption = true; + _bGUIInterface = true; + _bGUIInventory = true; GLOBALS.bSkipSfxNoLoop = false; - m_bMustEnterMenu = false; + _bMustEnterMenu = false; GLOBALS.bIdleExited = false; - m_bOption = false; - m_bWiping = false; - m_hWipeEvent = CoroScheduler.createEvent(false, false); + _bOption = false; + _bWiping = false; + _hWipeEvent = CoroScheduler.createEvent(false, false); // Create the freeze event - csMainLoop = g_system->createMutex(); + _csMainLoop = g_system->createMutex(); // Initialise the IRQ function for items for MPAL GLOBALS.GfxEngine = this; - mpalInstallItemIrq(ItemIrq); + mpalInstallItemIrq(itemIrq); // Initialise the input - m_input.init(); + _input.init(); // Initialise the mouse pointer - m_point.Init(); + _point.Init(); // Initialise Tony - m_tony.Init(); - m_tony.LinkToBoxes(&_vm->_theBoxes); + _tony.Init(); + _tony.LinkToBoxes(&_vm->_theBoxes); // Initialise the inventory and the interface - m_inv.Init(); - m_inter.Init(); + _inv.Init(); + _inter.Init(); // Download the location and set priorities @@@@@ - m_bLocationLoaded = false; + _bLocationLoaded = false; - EnableInput(); + enableInput(); // Starting the game - m_tony.ExecuteAction(20, 1, 0); + _tony.ExecuteAction(20, 1, 0); } -void RMGfxEngine::Close(void) { - m_bigBuf.ClearOT(); +void RMGfxEngine::close(void) { + _bigBuf.ClearOT(); - m_inter.Close(); - m_inv.Close(); - m_tony.Close(); - m_point.Close(); - m_input.close(); + _inter.Close(); + _inv.Close(); + _tony.Close(); + _point.Close(); + _input.close(); } -void RMGfxEngine::SwitchFullscreen(bool bFull) { +void RMGfxEngine::switchFullscreen(bool bFull) { } void RMGfxEngine::GDIControl(bool bCon) { } -void RMGfxEngine::EnableInput(void) { - m_bInput = true; +void RMGfxEngine::enableInput(void) { + _bInput = true; } -void RMGfxEngine::DisableInput(void) { - m_bInput = false; - m_inter.Reset(); +void RMGfxEngine::disableInput(void) { + _bInput = false; + _inter.Reset(); } -void RMGfxEngine::EnableMouse(void) { - m_bAlwaysDrawMouse = true; +void RMGfxEngine::enableMouse(void) { + _bAlwaysDrawMouse = true; } -void RMGfxEngine::DisableMouse(void) { - m_bAlwaysDrawMouse = false; +void RMGfxEngine::disableMouse(void) { + _bAlwaysDrawMouse = false; } -void RMGfxEngine::Freeze(void) { - g_system->lockMutex(csMainLoop); +void RMGfxEngine::freeze(void) { + g_system->lockMutex(_csMainLoop); } -void RMGfxEngine::Unfreeze(void) { - g_system->unlockMutex(csMainLoop); +void RMGfxEngine::unfreeze(void) { + g_system->unlockMutex(_csMainLoop); } void CharsSaveAll(Common::OutSaveFile *f); @@ -574,14 +572,14 @@ void LoadMusic(Common::InSaveFile *f); #define TONY_SAVEGAME_VERSION 8 -void RMGfxEngine::SaveState(const Common::String &fn, byte *curThumb, const Common::String &name) { +void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Common::String &name) { Common::OutSaveFile *f; byte *state; uint thumbsize; uint size; int i; char buf[4]; - RMPoint tp = m_tony.Position(); + RMPoint tp = _tony.Position(); // Saving: MPAL variables, current location, and Tony inventory position @@ -612,7 +610,7 @@ void RMGfxEngine::SaveState(const Common::String &fn, byte *curThumb, const Comm i = strlen(name.c_str()); f->writeByte(i); f->write(name.c_str(), i); - f->writeUint32LE(m_nCurLoc); + f->writeUint32LE(_nCurLoc); f->writeUint32LE(tp.x); f->writeUint32LE(tp.y); @@ -621,9 +619,9 @@ void RMGfxEngine::SaveState(const Common::String &fn, byte *curThumb, const Comm delete[] state; // Inventory - size = m_inv.GetSaveStateSize(); + size = _inv.GetSaveStateSize(); state = new byte[size]; - m_inv.SaveState(state); + _inv.SaveState(state); f->writeUint32LE(size); f->write(state, size); delete[] state; @@ -640,9 +638,9 @@ void RMGfxEngine::SaveState(const Common::String &fn, byte *curThumb, const Comm bool bStat; // Saves the state of the shepherdess and show yourself - bStat = m_tony.GetPastorella(); + bStat = _tony.GetPastorella(); f->writeByte(bStat); - bStat = m_inter.GetPalesati(); + bStat = _inter.GetPalesati(); f->writeByte(bStat); // Save the chars @@ -677,7 +675,7 @@ void RMGfxEngine::SaveState(const Common::String &fn, byte *curThumb, const Comm delete f; } -void RMGfxEngine::LoadState(CORO_PARAM, const Common::String &fn) { +void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { // PROBLEM: You should change the location in a separate process to do the OnEnter CORO_BEGIN_CONTEXT; Common::InSaveFile *f; @@ -760,7 +758,7 @@ void RMGfxEngine::LoadState(CORO_PARAM, const Common::String &fn) { _ctx->size = _ctx->f->readUint32LE(); _ctx->state = new byte[_ctx->size]; _ctx->f->read(_ctx->state, _ctx->size); - m_inv.LoadState(_ctx->state); + _inv.LoadState(_ctx->state); delete[] _ctx->state; if (_ctx->ver >= 0x2) { // Versione 2: box please @@ -776,9 +774,9 @@ void RMGfxEngine::LoadState(CORO_PARAM, const Common::String &fn) { bool bStat = false; bStat = _ctx->f->readByte(); - m_tony.SetPastorella(bStat); + _tony.SetPastorella(bStat); bStat = _ctx->f->readByte(); - m_inter.SetPalesati(bStat); + _inter.SetPalesati(bStat); CharsLoadAll(_ctx->f); } @@ -813,9 +811,9 @@ void RMGfxEngine::LoadState(CORO_PARAM, const Common::String &fn) { delete _ctx->f; - CORO_INVOKE_2(UnloadLocation, false, NULL); - LoadLocation(_ctx->loc, _ctx->tp, RMPoint(-1, -1)); - m_tony.SetPattern(RMTony::PAT_STANDRIGHT); + CORO_INVOKE_2(unloadLocation, false, NULL); + loadLocation(_ctx->loc, _ctx->tp, RMPoint(-1, -1)); + _tony.SetPattern(RMTony::PAT_STANDRIGHT); MainUnfreeze(); // On older versions, need to an enter action @@ -831,39 +829,39 @@ void RMGfxEngine::LoadState(CORO_PARAM, const Common::String &fn) { CORO_INVOKE_0(RestoreMusic); - m_bGUIInterface = true; - m_bGUIInventory = true; - m_bGUIOption = true; + _bGUIInterface = true; + _bGUIInventory = true; + _bGUIOption = true; CORO_END_CODE; } -void RMGfxEngine::PauseSound(bool bPause) { - if (m_bLocationLoaded) - m_loc.PauseSound(bPause); +void RMGfxEngine::pauseSound(bool bPause) { + if (_bLocationLoaded) + _loc.PauseSound(bPause); } -void RMGfxEngine::InitWipe(int type) { - m_bWiping = true; - m_nWipeType = type; - m_nWipeStep = 0; +void RMGfxEngine::initWipe(int type) { + _bWiping = true; + _nWipeType = type; + _nWipeStep = 0; - if (m_nWipeType == 1) - m_rcWipeEllipse = Common::Rect(80, 0, 640 - 80, 480); - else if (m_nWipeType == 2) - m_rcWipeEllipse = Common::Rect(320 - FSTEP, 240 - FSTEP, 320 + FSTEP, 240 + FSTEP); + if (_nWipeType == 1) + _rcWipeEllipse = Common::Rect(80, 0, 640 - 80, 480); + else if (_nWipeType == 2) + _rcWipeEllipse = Common::Rect(320 - FSTEP, 240 - FSTEP, 320 + FSTEP, 240 + FSTEP); } -void RMGfxEngine::CloseWipe(void) { - m_bWiping = false; +void RMGfxEngine::closeWipe(void) { + _bWiping = false; } -void RMGfxEngine::WaitWipeEnd(CORO_PARAM) { - CoroScheduler.waitForSingleObject(coroParam, m_hWipeEvent, CORO_INFINITE); +void RMGfxEngine::waitWipeEnd(CORO_PARAM) { + CoroScheduler.waitForSingleObject(coroParam, _hWipeEvent, CORO_INFINITE); } -bool RMGfxEngine::CanLoadSave() { - return m_bInput && !m_tony.InAction() && !_vm->getIsDemo(); +bool RMGfxEngine::canLoadSave() { + return _bInput && !_tony.InAction() && !_vm->getIsDemo(); } } // End of namespace Tony -- cgit v1.2.3 From 93cba6d88049d73b965143130a1f7751e3dc79db Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 5 Jun 2012 01:15:25 +0200 Subject: TONY: Rename variables and functions in adv.h --- engines/tony/gfxengine.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 75eb6de883..dd448fdc93 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -366,10 +366,10 @@ void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) { if (item != NULL) { if (nPattern != -1) { if (GLOBALS.bPatIrqFreeze) - MainFreeze(); + mainFreeze(); item->SetPattern(nPattern, true); if (GLOBALS.bPatIrqFreeze) - MainUnfreeze(); + mainUnfreeze(); } if (nStatus != -1) item->SetStatus(nStatus); @@ -450,7 +450,7 @@ void RMGfxEngine::unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE); } - MainFreeze(); + mainFreeze(); _bLocationLoaded = false; @@ -814,7 +814,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { CORO_INVOKE_2(unloadLocation, false, NULL); loadLocation(_ctx->loc, _ctx->tp, RMPoint(-1, -1)); _tony.SetPattern(RMTony::PAT_STANDRIGHT); - MainUnfreeze(); + mainUnfreeze(); // On older versions, need to an enter action if (_ctx->ver < 5) -- cgit v1.2.3 From 23c95d7014ee9875bb1b55c696d0245d7f114ba8 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 5 Jun 2012 08:39:55 +0200 Subject: TONY: Some more renaming --- engines/tony/gfxengine.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index dd448fdc93..2d1c0663a6 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -61,8 +61,8 @@ void ExitAllIdles(CORO_PARAM, const void *param) { RMGfxEngine::RMGfxEngine() { // Create big buffer where the frame will be rendered - _bigBuf.Create(RM_BBX, RM_BBY, 16); - _bigBuf.OffsetY(RM_SKIPY); + _bigBuf.create(RM_BBX, RM_BBY, 16); + _bigBuf.offsetY(RM_SKIPY); _csMainLoop = NULL; _nCurLoc = 0; @@ -84,7 +84,7 @@ RMGfxEngine::RMGfxEngine() { RMGfxEngine::~RMGfxEngine() { // Close the buffer - _bigBuf.Destroy(); + _bigBuf.destroy(); g_system->deleteMutex(_csMainLoop); } @@ -312,7 +312,7 @@ SKIPCLICKSINISTRO: // ********************** // Draw the list in the OT // ********************** - CORO_INVOKE_0(_bigBuf.DrawOT); + CORO_INVOKE_0(_bigBuf.drawOT); #define FSTEP (480/32) @@ -454,7 +454,7 @@ void RMGfxEngine::unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { _bLocationLoaded = false; - _bigBuf.ClearOT(); + _bigBuf.clearOT(); _loc.Unload(); if (result != NULL) @@ -468,9 +468,9 @@ void RMGfxEngine::init() { RMResRaw *raw; RMGfxSourceBuffer16 *load = NULL; INIT_GFX16_FROMRAW(20038, load); - _bigBuf.AddPrim(new RMGfxPrimitive(load)); - _bigBuf.DrawOT(Common::nullContext); - _bigBuf.ClearOT(); + _bigBuf.addPrim(new RMGfxPrimitive(load)); + _bigBuf.drawOT(Common::nullContext); + _bigBuf.clearOT(); delete load; _vm->_window.GetNewFrame(*this, NULL); @@ -502,7 +502,7 @@ void RMGfxEngine::init() { _point.Init(); // Initialise Tony - _tony.Init(); + _tony.init(); _tony.LinkToBoxes(&_vm->_theBoxes); // Initialise the inventory and the interface @@ -519,7 +519,7 @@ void RMGfxEngine::init() { } void RMGfxEngine::close(void) { - _bigBuf.ClearOT(); + _bigBuf.clearOT(); _inter.Close(); _inv.Close(); -- cgit v1.2.3 From 334dc91e279d01b264ae7454f39faa557a250428 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 6 Jun 2012 01:37:06 +0200 Subject: TONY: Rename variables and functions in game.h --- engines/tony/gfxengine.cpp | 60 +++++++++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 2d1c0663a6..ca7e645825 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -98,15 +98,15 @@ void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) { _ctx->bRes = false; if (type == 0) - CORO_INVOKE_2(_opt.Init, _bigBuf, _ctx->bRes); + CORO_INVOKE_2(_opt.init, _bigBuf, _ctx->bRes); else if (type == 1) - CORO_INVOKE_3(_opt.InitLoadMenuOnly, _bigBuf, true, _ctx->bRes); + CORO_INVOKE_3(_opt.initLoadMenuOnly, _bigBuf, true, _ctx->bRes); else if (type == 2) - CORO_INVOKE_2(_opt.InitNoLoadSave, _bigBuf, _ctx->bRes); + CORO_INVOKE_2(_opt.initNoLoadSave, _bigBuf, _ctx->bRes); else if (type == 3) - CORO_INVOKE_3(_opt.InitLoadMenuOnly, _bigBuf, false, _ctx->bRes); + CORO_INVOKE_3(_opt.initLoadMenuOnly, _bigBuf, false, _ctx->bRes); else if (type == 4) - CORO_INVOKE_3(_opt.InitSaveMenuOnly, _bigBuf, false, _ctx->bRes); + CORO_INVOKE_3(_opt.initSaveMenuOnly, _bigBuf, false, _ctx->bRes); if (_ctx->bRes) { _vm->pauseSound(true); @@ -115,9 +115,9 @@ void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) { _inv.EndCombine(); _curActionObj = 0; _curAction = TA_GOTO; - _point.SetAction(_curAction); - _point.SetSpecialPointer(RMPointer::PTR_NONE); - _point.SetCustomPointer(NULL); + _point.setAction(_curAction); + _point.setSpecialPointer(RMPointer::PTR_NONE); + _point.setCustomPointer(NULL); enableMouse(); _vm->grabThumbnail(); @@ -155,8 +155,8 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { } if (_bOption) { - CORO_INVOKE_1(_opt.DoFrame, &_input); - _bOption = !_opt.IsClosing(); + CORO_INVOKE_1(_opt.doFrame, &_input); + _bOption = !_opt.isClosing(); if (!_bOption) { disableMouse(); enableInput(); @@ -167,7 +167,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { if (bDrawLocation && _bLocationLoaded) { // Location and objects - _loc.DoFrame(&_bigBuf); + _loc.doFrame(&_bigBuf); // Check the mouse input if (_bInput && !_tony.InAction()) { @@ -179,7 +179,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { // Left click activates the combine, if we are on an object if (_inv.LeftClick(_input.mousePos(), _curActionObj)) { _curAction = TA_COMBINE; - _point.SetAction(_curAction); + _point.setAction(_curAction); } } else @@ -200,7 +200,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), _curAction); _curAction = TA_GOTO; - _point.SetAction(_curAction); + _point.setAction(_curAction); } } } else { @@ -229,17 +229,17 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { if (_input.mouseLeftClicked() && !_inter.Active()) { if (_curAction != TA_COMBINE) - CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), _point.CurAction()); + CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), _point.curAction()); else if (_itemName.GetSelectedItem() != NULL) CORO_INVOKE_4(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), TA_COMBINE, _curActionObj); if (_curAction == TA_COMBINE) { _inv.EndCombine(); - _point.SetSpecialPointer(RMPointer::PTR_NONE); + _point.setSpecialPointer(RMPointer::PTR_NONE); } _curAction = TA_GOTO; - _point.SetAction(_curAction); + _point.setAction(_curAction); } SKIPCLICKSINISTRO: @@ -251,15 +251,15 @@ SKIPCLICKSINISTRO: _inv.EndCombine(); _curActionObj = 0; _curAction = TA_GOTO; - _point.SetAction(_curAction); - _point.SetSpecialPointer(RMPointer::PTR_NONE); + _point.setAction(_curAction); + _point.setSpecialPointer(RMPointer::PTR_NONE); } - } else if (_input.mouseRightClicked() && _itemName.IsItemSelected() && _point.GetSpecialPointer() == RMPointer::PTR_NONE) { + } else if (_input.mouseRightClicked() && _itemName.IsItemSelected() && _point.getSpecialPointer() == RMPointer::PTR_NONE) { if (_bGUIInterface) { // Before opening the interface, replaces GOTO _curAction = TA_GOTO; _curActionObj = 0; - _point.SetAction(_curAction); + _point.setAction(_curAction); _inter.Clicked(_input.mousePos()); } } @@ -270,11 +270,11 @@ SKIPCLICKSINISTRO: if (_input.mouseRightReleased()) { if (_bGUIInterface) { if (_inter.Released(_input.mousePos(), _curAction)) { - _point.SetAction(_curAction); + _point.setAction(_curAction); CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), _curAction); _curAction = TA_GOTO; - _point.SetAction(_curAction); + _point.setAction(_curAction); } } } @@ -305,8 +305,8 @@ SKIPCLICKSINISTRO: _tony.SetScrollPosition(_loc.ScrollPosition()); if ((!_tony.InAction() && _bInput) || _bAlwaysDrawMouse) { - _point.SetCoord(_input.mousePos()); - _point.DoFrame(&_bigBuf); + _point.setCoord(_input.mousePos()); + _point.doFrame(&_bigBuf); } // ********************** @@ -393,9 +393,9 @@ void RMGfxEngine::initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint star } _curAction = TA_GOTO; - _point.SetCustomPointer(NULL); - _point.SetSpecialPointer(RMPointer::PTR_NONE); - _point.SetAction(_curAction); + _point.setCustomPointer(NULL); + _point.setSpecialPointer(RMPointer::PTR_NONE); + _point.setAction(_curAction); _inter.Reset(); _inv.Reset(); @@ -425,7 +425,7 @@ uint32 RMGfxEngine::loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { error("Location was not loaded"); if (_bOption) - _opt.ReInit(_bigBuf); + _opt.reInit(_bigBuf); _bLocationLoaded = true; @@ -499,7 +499,7 @@ void RMGfxEngine::init() { _input.init(); // Initialise the mouse pointer - _point.Init(); + _point.init(); // Initialise Tony _tony.init(); @@ -524,7 +524,7 @@ void RMGfxEngine::close(void) { _inter.Close(); _inv.Close(); _tony.Close(); - _point.Close(); + _point.close(); _input.close(); } -- cgit v1.2.3 From f1ac5d5acdbc0349850377619d8056be22871b42 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 6 Jun 2012 08:04:33 +0200 Subject: TONY: More renaming --- engines/tony/gfxengine.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index ca7e645825..08976e6092 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -186,7 +186,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { // Right Click // *********** if (_input.mouseRightClicked()) { - if (_itemName.IsItemSelected()) { + if (_itemName.isItemSelected()) { _curActionObj = 0; _inv.RightClick(_input.mousePos()); } else @@ -197,7 +197,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { // ************* if (_input.mouseRightReleased()) { if (_inv.RightRelease(_input.mousePos(), _curAction)) { - CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), _curAction); + CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _curAction); _curAction = TA_GOTO; _point.setAction(_curAction); @@ -229,9 +229,9 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { if (_input.mouseLeftClicked() && !_inter.Active()) { if (_curAction != TA_COMBINE) - CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), _point.curAction()); - else if (_itemName.GetSelectedItem() != NULL) - CORO_INVOKE_4(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), TA_COMBINE, _curActionObj); + CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _point.curAction()); + else if (_itemName.getSelectedItem() != NULL) + CORO_INVOKE_4(_tony.MoveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), TA_COMBINE, _curActionObj); if (_curAction == TA_COMBINE) { _inv.EndCombine(); @@ -254,7 +254,7 @@ SKIPCLICKSINISTRO: _point.setAction(_curAction); _point.setSpecialPointer(RMPointer::PTR_NONE); } - } else if (_input.mouseRightClicked() && _itemName.IsItemSelected() && _point.getSpecialPointer() == RMPointer::PTR_NONE) { + } else if (_input.mouseRightClicked() && _itemName.isItemSelected() && _point.getSpecialPointer() == RMPointer::PTR_NONE) { if (_bGUIInterface) { // Before opening the interface, replaces GOTO _curAction = TA_GOTO; @@ -271,7 +271,7 @@ SKIPCLICKSINISTRO: if (_bGUIInterface) { if (_inter.Released(_input.mousePos(), _curAction)) { _point.setAction(_curAction); - CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), _curAction); + CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _curAction); _curAction = TA_GOTO; _point.setAction(_curAction); @@ -281,14 +281,14 @@ SKIPCLICKSINISTRO: } // Update the name under the mouse pointer - _itemName.SetMouseCoord(_input.mousePos()); + _itemName.setMouseCoord(_input.mousePos()); if (!_inter.Active() && !_inv.MiniActive()) - CORO_INVOKE_4(_itemName.DoFrame, _bigBuf, _loc, _point, _inv); + CORO_INVOKE_4(_itemName.doFrame, _bigBuf, _loc, _point, _inv); } // Interface & Inventory _inter.DoFrame(_bigBuf, _input.mousePos()); - _inv.DoFrame(_bigBuf, _point, _input.mousePos(), (!_tony.InAction() && !_inter.Active() && _bGUIInventory)); + _inv.doFrame(_bigBuf, _point, _input.mousePos(), (!_tony.InAction() && !_inter.Active() && _bGUIInventory)); } // Animate Tony @@ -397,7 +397,7 @@ void RMGfxEngine::initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint star _point.setSpecialPointer(RMPointer::PTR_NONE); _point.setAction(_curAction); _inter.Reset(); - _inv.Reset(); + _inv.reset(); mpalStartIdlePoll(_nCurLoc); } @@ -472,7 +472,7 @@ void RMGfxEngine::init() { _bigBuf.drawOT(Common::nullContext); _bigBuf.clearOT(); delete load; - _vm->_window.GetNewFrame(*this, NULL); + _vm->_window.getNewFrame(*this, NULL); GLOBALS.bPatIrqFreeze = true; @@ -506,7 +506,7 @@ void RMGfxEngine::init() { _tony.LinkToBoxes(&_vm->_theBoxes); // Initialise the inventory and the interface - _inv.Init(); + _inv.init(); _inter.Init(); // Download the location and set priorities @@@@@ @@ -522,7 +522,7 @@ void RMGfxEngine::close(void) { _bigBuf.clearOT(); _inter.Close(); - _inv.Close(); + _inv.close(); _tony.Close(); _point.close(); _input.close(); -- cgit v1.2.3 From 53e38106b73e6ad9e6f725857483bfd35e961326 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 6 Jun 2012 08:31:06 +0200 Subject: TONY: Rename variables and functions in inventory.h That fixes the regression in the credits --- engines/tony/gfxengine.cpp | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 08976e6092..a80552b1d1 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -112,7 +112,7 @@ void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) { _vm->pauseSound(true); disableInput(); - _inv.EndCombine(); + _inv.endCombine(); _curActionObj = 0; _curAction = TA_GOTO; _point.setAction(_curAction); @@ -172,12 +172,12 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { // Check the mouse input if (_bInput && !_tony.InAction()) { // If we are on the inventory, it is it who controls all input - if (_inv.HaveFocus(_input.mousePos()) && !_inter.Active()) { + if (_inv.haveFocus(_input.mousePos()) && !_inter.active()) { // Left Click // ********** if (_input.mouseLeftClicked()/* && m_itemName.IsItemSelected()*/) { // Left click activates the combine, if we are on an object - if (_inv.LeftClick(_input.mousePos(), _curActionObj)) { + if (_inv.leftClick(_input.mousePos(), _curActionObj)) { _curAction = TA_COMBINE; _point.setAction(_curAction); } @@ -188,15 +188,15 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { if (_input.mouseRightClicked()) { if (_itemName.isItemSelected()) { _curActionObj = 0; - _inv.RightClick(_input.mousePos()); + _inv.rightClick(_input.mousePos()); } else - _inv.RightClick(_input.mousePos()); + _inv.rightClick(_input.mousePos()); } else // Right Release // ************* if (_input.mouseRightReleased()) { - if (_inv.RightRelease(_input.mousePos(), _curAction)) { + if (_inv.rightRelease(_input.mousePos(), _curAction)) { CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _curAction); _curAction = TA_GOTO; @@ -226,7 +226,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { // Left Click // ************** - if (_input.mouseLeftClicked() && !_inter.Active()) { + if (_input.mouseLeftClicked() && !_inter.active()) { if (_curAction != TA_COMBINE) CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _point.curAction()); @@ -234,7 +234,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { CORO_INVOKE_4(_tony.MoveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), TA_COMBINE, _curActionObj); if (_curAction == TA_COMBINE) { - _inv.EndCombine(); + _inv.endCombine(); _point.setSpecialPointer(RMPointer::PTR_NONE); } @@ -248,7 +248,7 @@ SKIPCLICKSINISTRO: if (_curAction == TA_COMBINE) { // During a combine, it cancels it if (_input.mouseRightClicked()) { - _inv.EndCombine(); + _inv.endCombine(); _curActionObj = 0; _curAction = TA_GOTO; _point.setAction(_curAction); @@ -260,7 +260,7 @@ SKIPCLICKSINISTRO: _curAction = TA_GOTO; _curActionObj = 0; _point.setAction(_curAction); - _inter.Clicked(_input.mousePos()); + _inter.clicked(_input.mousePos()); } } @@ -269,7 +269,7 @@ SKIPCLICKSINISTRO: // ************* if (_input.mouseRightReleased()) { if (_bGUIInterface) { - if (_inter.Released(_input.mousePos(), _curAction)) { + if (_inter.released(_input.mousePos(), _curAction)) { _point.setAction(_curAction); CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _curAction); @@ -282,13 +282,13 @@ SKIPCLICKSINISTRO: // Update the name under the mouse pointer _itemName.setMouseCoord(_input.mousePos()); - if (!_inter.Active() && !_inv.MiniActive()) + if (!_inter.active() && !_inv.miniActive()) CORO_INVOKE_4(_itemName.doFrame, _bigBuf, _loc, _point, _inv); } // Interface & Inventory - _inter.DoFrame(_bigBuf, _input.mousePos()); - _inv.doFrame(_bigBuf, _point, _input.mousePos(), (!_tony.InAction() && !_inter.Active() && _bGUIInventory)); + _inter.doFrame(_bigBuf, _input.mousePos()); + _inv.doFrame(_bigBuf, _point, _input.mousePos(), (!_tony.InAction() && !_inter.active() && _bGUIInventory)); } // Animate Tony @@ -396,7 +396,7 @@ void RMGfxEngine::initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint star _point.setCustomPointer(NULL); _point.setSpecialPointer(RMPointer::PTR_NONE); _point.setAction(_curAction); - _inter.Reset(); + _inter.reset(); _inv.reset(); mpalStartIdlePoll(_nCurLoc); @@ -507,7 +507,7 @@ void RMGfxEngine::init() { // Initialise the inventory and the interface _inv.init(); - _inter.Init(); + _inter.init(); // Download the location and set priorities @@@@@ _bLocationLoaded = false; @@ -521,7 +521,7 @@ void RMGfxEngine::init() { void RMGfxEngine::close(void) { _bigBuf.clearOT(); - _inter.Close(); + _inter.close(); _inv.close(); _tony.Close(); _point.close(); @@ -540,7 +540,7 @@ void RMGfxEngine::enableInput(void) { void RMGfxEngine::disableInput(void) { _bInput = false; - _inter.Reset(); + _inter.reset(); } void RMGfxEngine::enableMouse(void) { @@ -619,9 +619,9 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm delete[] state; // Inventory - size = _inv.GetSaveStateSize(); + size = _inv.getSaveStateSize(); state = new byte[size]; - _inv.SaveState(state); + _inv.saveState(state); f->writeUint32LE(size); f->write(state, size); delete[] state; @@ -640,7 +640,7 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm // Saves the state of the shepherdess and show yourself bStat = _tony.GetPastorella(); f->writeByte(bStat); - bStat = _inter.GetPalesati(); + bStat = _inter.getPalesati(); f->writeByte(bStat); // Save the chars @@ -758,7 +758,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { _ctx->size = _ctx->f->readUint32LE(); _ctx->state = new byte[_ctx->size]; _ctx->f->read(_ctx->state, _ctx->size); - _inv.LoadState(_ctx->state); + _inv.loadState(_ctx->state); delete[] _ctx->state; if (_ctx->ver >= 0x2) { // Versione 2: box please @@ -776,7 +776,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { bStat = _ctx->f->readByte(); _tony.SetPastorella(bStat); bStat = _ctx->f->readByte(); - _inter.SetPalesati(bStat); + _inter.setPalesati(bStat); CharsLoadAll(_ctx->f); } -- cgit v1.2.3 From 53bd99ce870ac5bd7f65d1e45641e13070f652d0 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 7 Jun 2012 07:58:01 +0200 Subject: TONY: Rename variables and functions in loc.h and tonychar.h --- engines/tony/gfxengine.cpp | 68 +++++++++++++++++++++++----------------------- 1 file changed, 34 insertions(+), 34 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index a80552b1d1..56ce8a47e1 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -126,7 +126,7 @@ void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) { if (type == 1 || type == 2) { GLOBALS.bIdleExited = true; } else { - CORO_INVOKE_0(_tony.StopNoAction); + CORO_INVOKE_0(_tony.stopNoAction); GLOBALS.bIdleExited = false; @@ -170,7 +170,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { _loc.doFrame(&_bigBuf); // Check the mouse input - if (_bInput && !_tony.InAction()) { + if (_bInput && !_tony.inAction()) { // If we are on the inventory, it is it who controls all input if (_inv.haveFocus(_input.mousePos()) && !_inter.active()) { // Left Click @@ -197,7 +197,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { // ************* if (_input.mouseRightReleased()) { if (_inv.rightRelease(_input.mousePos(), _curAction)) { - CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _curAction); + CORO_INVOKE_3(_tony.moveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _curAction); _curAction = TA_GOTO; _point.setAction(_curAction); @@ -207,7 +207,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { // Options Menu // ************ if (_bGUIOption) { - if (!_tony.InAction() && _bInput) { + if (!_tony.inAction() && _bInput) { if ((_input.mouseLeftClicked() && _input.mousePos().x < 3 && _input.mousePos().y < 3)) { CORO_INVOKE_1(openOptionScreen, 0); goto SKIPCLICKSINISTRO; @@ -229,9 +229,9 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { if (_input.mouseLeftClicked() && !_inter.active()) { if (_curAction != TA_COMBINE) - CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _point.curAction()); + CORO_INVOKE_3(_tony.moveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _point.curAction()); else if (_itemName.getSelectedItem() != NULL) - CORO_INVOKE_4(_tony.MoveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), TA_COMBINE, _curActionObj); + CORO_INVOKE_4(_tony.moveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), TA_COMBINE, _curActionObj); if (_curAction == TA_COMBINE) { _inv.endCombine(); @@ -271,7 +271,7 @@ SKIPCLICKSINISTRO: if (_bGUIInterface) { if (_inter.released(_input.mousePos(), _curAction)) { _point.setAction(_curAction); - CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _curAction); + CORO_INVOKE_3(_tony.moveAndDoAction, _itemName.getHotspot(), _itemName.getSelectedItem(), _curAction); _curAction = TA_GOTO; _point.setAction(_curAction); @@ -288,23 +288,23 @@ SKIPCLICKSINISTRO: // Interface & Inventory _inter.doFrame(_bigBuf, _input.mousePos()); - _inv.doFrame(_bigBuf, _point, _input.mousePos(), (!_tony.InAction() && !_inter.active() && _bGUIInventory)); + _inv.doFrame(_bigBuf, _point, _input.mousePos(), (!_tony.inAction() && !_inter.active() && _bGUIInventory)); } // Animate Tony - CORO_INVOKE_2(_tony.DoFrame, &_bigBuf, _nCurLoc); + CORO_INVOKE_2(_tony.doFrame, &_bigBuf, _nCurLoc); // Update screen scrolling to keep Tony in focus - if (_tony.MustUpdateScrolling() && _bLocationLoaded) { - RMPoint showThis = _tony.Position(); + if (_tony.mustUpdateScrolling() && _bLocationLoaded) { + RMPoint showThis = _tony.position(); showThis.y -= 60; - _loc.UpdateScrolling(showThis); + _loc.updateScrolling(showThis); } if (_bLocationLoaded) - _tony.SetScrollPosition(_loc.ScrollPosition()); + _tony.setScrollPosition(_loc.scrollPosition()); - if ((!_tony.InAction() && _bInput) || _bAlwaysDrawMouse) { + if ((!_tony.inAction() && _bInput) || _bAlwaysDrawMouse) { _point.setCoord(_input.mousePos()); _point.doFrame(&_bigBuf); } @@ -362,17 +362,17 @@ void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) { assert(GLOBALS.GfxEngine); if (GLOBALS.GfxEngine->_bLocationLoaded) { - item = GLOBALS.GfxEngine->_loc.GetItemFromCode(dwItem); + item = GLOBALS.GfxEngine->_loc.getItemFromCode(dwItem); if (item != NULL) { if (nPattern != -1) { if (GLOBALS.bPatIrqFreeze) mainFreeze(); - item->SetPattern(nPattern, true); + item->setPattern(nPattern, true); if (GLOBALS.bPatIrqFreeze) mainUnfreeze(); } if (nStatus != -1) - item->SetStatus(nStatus); + item->setStatus(nStatus); } } } @@ -384,12 +384,12 @@ void RMGfxEngine::initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint star start.y = ptTonyStart.y - RM_SY / 2; } - _loc.SetScrollPosition(start); + _loc.setScrollPosition(start); if (ptTonyStart.x == 0 && ptTonyStart.y == 0) { } else { - _tony.SetPosition(ptTonyStart, nLoc); - _tony.SetScrollPosition(start); + _tony.setPosition(ptTonyStart, nLoc); + _tony.setScrollPosition(start); } _curAction = TA_GOTO; @@ -415,7 +415,7 @@ uint32 RMGfxEngine::loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { if (!res.IsValid()) continue; - _loc.Load(res); + _loc.load(res); initForNewLocation(nLoc, ptTonyStart, start); bLoaded = true; break; @@ -455,7 +455,7 @@ void RMGfxEngine::unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { _bLocationLoaded = false; _bigBuf.clearOT(); - _loc.Unload(); + _loc.unload(); if (result != NULL) *result = CORO_INVALID_PID_VALUE; @@ -503,7 +503,7 @@ void RMGfxEngine::init() { // Initialise Tony _tony.init(); - _tony.LinkToBoxes(&_vm->_theBoxes); + _tony.linkToBoxes(&_vm->_theBoxes); // Initialise the inventory and the interface _inv.init(); @@ -515,7 +515,7 @@ void RMGfxEngine::init() { enableInput(); // Starting the game - _tony.ExecuteAction(20, 1, 0); + _tony.executeAction(20, 1, 0); } void RMGfxEngine::close(void) { @@ -523,7 +523,7 @@ void RMGfxEngine::close(void) { _inter.close(); _inv.close(); - _tony.Close(); + _tony.close(); _point.close(); _input.close(); } @@ -579,7 +579,7 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm uint size; int i; char buf[4]; - RMPoint tp = _tony.Position(); + RMPoint tp = _tony.position(); // Saving: MPAL variables, current location, and Tony inventory position @@ -627,9 +627,9 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm delete[] state; // boxes - size = _vm->_theBoxes.GetSaveStateSize(); + size = _vm->_theBoxes.getSaveStateSize(); state = new byte[size]; - _vm->_theBoxes.SaveState(state); + _vm->_theBoxes.saveState(state); f->writeUint32LE(size); f->write(state, size); delete[] state; @@ -638,7 +638,7 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm bool bStat; // Saves the state of the shepherdess and show yourself - bStat = _tony.GetPastorella(); + bStat = _tony.getPastorella(); f->writeByte(bStat); bStat = _inter.getPalesati(); f->writeByte(bStat); @@ -765,7 +765,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { _ctx->size = _ctx->f->readUint32LE(); _ctx->state = new byte[_ctx->size]; _ctx->f->read(_ctx->state, _ctx->size); - _vm->_theBoxes.LoadState(_ctx->state); + _vm->_theBoxes.loadState(_ctx->state); delete[] _ctx->state; } @@ -774,7 +774,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { bool bStat = false; bStat = _ctx->f->readByte(); - _tony.SetPastorella(bStat); + _tony.setPastorella(bStat); bStat = _ctx->f->readByte(); _inter.setPalesati(bStat); @@ -813,7 +813,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { CORO_INVOKE_2(unloadLocation, false, NULL); loadLocation(_ctx->loc, _ctx->tp, RMPoint(-1, -1)); - _tony.SetPattern(RMTony::PAT_STANDRIGHT); + _tony.setPattern(RMTony::PAT_STANDRIGHT); mainUnfreeze(); // On older versions, need to an enter action @@ -838,7 +838,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { void RMGfxEngine::pauseSound(bool bPause) { if (_bLocationLoaded) - _loc.PauseSound(bPause); + _loc.pauseSound(bPause); } void RMGfxEngine::initWipe(int type) { @@ -861,7 +861,7 @@ void RMGfxEngine::waitWipeEnd(CORO_PARAM) { } bool RMGfxEngine::canLoadSave() { - return _bInput && !_tony.InAction() && !_vm->getIsDemo(); + return _bInput && !_tony.inAction() && !_vm->getIsDemo(); } } // End of namespace Tony -- cgit v1.2.3 From f12ab3e521b01ed2b40e7d517753dd14bc6e6f0f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 7 Jun 2012 08:42:35 +0200 Subject: TONY: Rename variables and functions in utils.h --- engines/tony/gfxengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 56ce8a47e1..b102323dce 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -412,7 +412,7 @@ uint32 RMGfxEngine::loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { for (i = 0; i < 5; i++) { // Try the loading of the location RMRes res(_nCurLoc); - if (!res.IsValid()) + if (!res.isValid()) continue; _loc.load(res); -- cgit v1.2.3 From a7a619e1b41b771726b6fb611ddb640e38a78185 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Thu, 7 Jun 2012 21:19:57 +1000 Subject: TONY: Fix to correctly show the loading screen at the start of the game --- engines/tony/gfxengine.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index b102323dce..e61e6a8b84 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -472,7 +472,12 @@ void RMGfxEngine::init() { _bigBuf.drawOT(Common::nullContext); _bigBuf.clearOT(); delete load; + + // Display 'Loading' screen + // TODO: The loading screen isn't currently optimal, since the game doesn't respond to events + // whilst the mpalInit code is being executed. _vm->_window.getNewFrame(*this, NULL); + _vm->_window.repaint(); GLOBALS.bPatIrqFreeze = true; -- cgit v1.2.3 From c52aca5ac407c498eb0a287697199a97f7c18bae Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 9 Jun 2012 00:52:38 +0200 Subject: TONY: Rename more globals --- engines/tony/gfxengine.cpp | 92 +++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 46 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index e61e6a8b84..801b4d35fb 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -49,12 +49,12 @@ void ExitAllIdles(CORO_PARAM, const void *param) { CORO_BEGIN_CODE(_ctx); // Closes idle - GLOBALS.bSkipSfxNoLoop = true; + GLOBALS._bSkipSfxNoLoop = true; CORO_INVOKE_2(mpalEndIdlePoll, nCurLoc, NULL); - GLOBALS.bIdleExited = true; - GLOBALS.bSkipSfxNoLoop = false; + GLOBALS._bIdleExited = true; + GLOBALS._bSkipSfxNoLoop = false; CORO_END_CODE; } @@ -124,11 +124,11 @@ void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) { // Exists the IDLE to avoid premature death in loading _bMustEnterMenu = true; if (type == 1 || type == 2) { - GLOBALS.bIdleExited = true; + GLOBALS._bIdleExited = true; } else { CORO_INVOKE_0(_tony.stopNoAction); - GLOBALS.bIdleExited = false; + GLOBALS._bIdleExited = false; CoroScheduler.createProcess(ExitAllIdles, &_nCurLoc, sizeof(int)); } @@ -148,10 +148,10 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { // Poll of input devices _input.poll(); - if (_bMustEnterMenu && GLOBALS.bIdleExited) { + if (_bMustEnterMenu && GLOBALS._bIdleExited) { _bOption = true; _bMustEnterMenu = false; - GLOBALS.bIdleExited = false; + GLOBALS._bIdleExited = false; } if (_bOption) { @@ -365,10 +365,10 @@ void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) { item = GLOBALS.GfxEngine->_loc.getItemFromCode(dwItem); if (item != NULL) { if (nPattern != -1) { - if (GLOBALS.bPatIrqFreeze) + if (GLOBALS._bPatIrqFreeze) mainFreeze(); item->setPattern(nPattern, true); - if (GLOBALS.bPatIrqFreeze) + if (GLOBALS._bPatIrqFreeze) mainUnfreeze(); } if (nStatus != -1) @@ -479,16 +479,16 @@ void RMGfxEngine::init() { _vm->_window.getNewFrame(*this, NULL); _vm->_window.repaint(); - GLOBALS.bPatIrqFreeze = true; + GLOBALS._bPatIrqFreeze = true; // Activate GUI _bGUIOption = true; _bGUIInterface = true; _bGUIInventory = true; - GLOBALS.bSkipSfxNoLoop = false; + GLOBALS._bSkipSfxNoLoop = false; _bMustEnterMenu = false; - GLOBALS.bIdleExited = false; + GLOBALS._bIdleExited = false; _bOption = false; _bWiping = false; _hWipeEvent = CoroScheduler.createEvent(false, false); @@ -652,23 +652,23 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm CharsSaveAll(f); // Save the options - f->writeByte(GLOBALS.bCfgInvLocked); - f->writeByte(GLOBALS.bCfgInvNoScroll); - f->writeByte(GLOBALS.bCfgTimerizedText); - f->writeByte(GLOBALS.bCfgInvUp); - f->writeByte(GLOBALS.bCfgAnni30); - f->writeByte(GLOBALS.bCfgAntiAlias); - f->writeByte(GLOBALS.bCfgSottotitoli); - f->writeByte(GLOBALS.bCfgTransparence); - f->writeByte(GLOBALS.bCfgInterTips); - f->writeByte(GLOBALS.bCfgDubbing); - f->writeByte(GLOBALS.bCfgMusic); - f->writeByte(GLOBALS.bCfgSFX); - f->writeByte(GLOBALS.nCfgTonySpeed); - f->writeByte(GLOBALS.nCfgTextSpeed); - f->writeByte(GLOBALS.nCfgDubbingVolume); - f->writeByte(GLOBALS.nCfgMusicVolume); - f->writeByte(GLOBALS.nCfgSFXVolume); + f->writeByte(GLOBALS._bCfgInvLocked); + f->writeByte(GLOBALS._bCfgInvNoScroll); + f->writeByte(GLOBALS._bCfgTimerizedText); + f->writeByte(GLOBALS._bCfgInvUp); + f->writeByte(GLOBALS._bCfgAnni30); + f->writeByte(GLOBALS._bCfgAntiAlias); + f->writeByte(GLOBALS._bCfgSottotitoli); + f->writeByte(GLOBALS._bCfgTransparence); + f->writeByte(GLOBALS._bCfgInterTips); + f->writeByte(GLOBALS._bCfgDubbing); + f->writeByte(GLOBALS._bCfgMusic); + f->writeByte(GLOBALS._bCfgSFX); + f->writeByte(GLOBALS._nCfgTonySpeed); + f->writeByte(GLOBALS._nCfgTextSpeed); + f->writeByte(GLOBALS._nCfgDubbingVolume); + f->writeByte(GLOBALS._nCfgMusicVolume); + f->writeByte(GLOBALS._nCfgSFXVolume); // Save the hotspots SaveChangedHotspot(f); @@ -788,23 +788,23 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { if (_ctx->ver >= 6) { // Load options - GLOBALS.bCfgInvLocked = _ctx->f->readByte(); - GLOBALS.bCfgInvNoScroll = _ctx->f->readByte(); - GLOBALS.bCfgTimerizedText = _ctx->f->readByte(); - GLOBALS.bCfgInvUp = _ctx->f->readByte(); - GLOBALS.bCfgAnni30 = _ctx->f->readByte(); - GLOBALS.bCfgAntiAlias = _ctx->f->readByte(); - GLOBALS.bCfgSottotitoli = _ctx->f->readByte(); - GLOBALS.bCfgTransparence = _ctx->f->readByte(); - GLOBALS.bCfgInterTips = _ctx->f->readByte(); - GLOBALS.bCfgDubbing = _ctx->f->readByte(); - GLOBALS.bCfgMusic = _ctx->f->readByte(); - GLOBALS.bCfgSFX = _ctx->f->readByte(); - GLOBALS.nCfgTonySpeed = _ctx->f->readByte(); - GLOBALS.nCfgTextSpeed = _ctx->f->readByte(); - GLOBALS.nCfgDubbingVolume = _ctx->f->readByte(); - GLOBALS.nCfgMusicVolume = _ctx->f->readByte(); - GLOBALS.nCfgSFXVolume = _ctx->f->readByte(); + GLOBALS._bCfgInvLocked = _ctx->f->readByte(); + GLOBALS._bCfgInvNoScroll = _ctx->f->readByte(); + GLOBALS._bCfgTimerizedText = _ctx->f->readByte(); + GLOBALS._bCfgInvUp = _ctx->f->readByte(); + GLOBALS._bCfgAnni30 = _ctx->f->readByte(); + GLOBALS._bCfgAntiAlias = _ctx->f->readByte(); + GLOBALS._bCfgSottotitoli = _ctx->f->readByte(); + GLOBALS._bCfgTransparence = _ctx->f->readByte(); + GLOBALS._bCfgInterTips = _ctx->f->readByte(); + GLOBALS._bCfgDubbing = _ctx->f->readByte(); + GLOBALS._bCfgMusic = _ctx->f->readByte(); + GLOBALS._bCfgSFX = _ctx->f->readByte(); + GLOBALS._nCfgTonySpeed = _ctx->f->readByte(); + GLOBALS._nCfgTextSpeed = _ctx->f->readByte(); + GLOBALS._nCfgDubbingVolume = _ctx->f->readByte(); + GLOBALS._nCfgMusicVolume = _ctx->f->readByte(); + GLOBALS._nCfgSFXVolume = _ctx->f->readByte(); // Load hotspots LoadChangedHotspot(_ctx->f); -- cgit v1.2.3 From da39f4d758f0952e207665244023d2f3f91c6c6e Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 9 Jun 2012 17:52:42 +1000 Subject: TONY: Fix the dialogs displayed for the different function keys --- engines/tony/gfxengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 801b4d35fb..4bfdc1333f 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -216,10 +216,10 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { else if (!_vm->getIsDemo()) { if (_input.getAsyncKeyState(Common::KEYCODE_F3) || _input.getAsyncKeyState(Common::KEYCODE_F5)) // Save game screen - CORO_INVOKE_1(openOptionScreen, 3); + CORO_INVOKE_1(openOptionScreen, 4); else if (_input.getAsyncKeyState(Common::KEYCODE_F2) || _input.getAsyncKeyState(Common::KEYCODE_F7)) // Load game screen - CORO_INVOKE_1(openOptionScreen, 4); + CORO_INVOKE_1(openOptionScreen, 3); } } } -- cgit v1.2.3 From 2b02a45ce16960644e1d5e297066f8040cd48cbc Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 10 Jun 2012 22:02:31 +0200 Subject: TONY: Rename variables in globals.h --- engines/tony/gfxengine.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 4bfdc1333f..e8f32edac7 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -359,10 +359,10 @@ void RMGfxEngine::initCustomDll(void) { void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) { RMItem *item; - assert(GLOBALS.GfxEngine); + assert(GLOBALS._gfxEngine); - if (GLOBALS.GfxEngine->_bLocationLoaded) { - item = GLOBALS.GfxEngine->_loc.getItemFromCode(dwItem); + if (GLOBALS._gfxEngine->_bLocationLoaded) { + item = GLOBALS._gfxEngine->_loc.getItemFromCode(dwItem); if (item != NULL) { if (nPattern != -1) { if (GLOBALS._bPatIrqFreeze) @@ -497,7 +497,7 @@ void RMGfxEngine::init() { _csMainLoop = g_system->createMutex(); // Initialise the IRQ function for items for MPAL - GLOBALS.GfxEngine = this; + GLOBALS._gfxEngine = this; mpalInstallItemIrq(itemIrq); // Initialise the input -- cgit v1.2.3 From 02c8ccebcb20aa904dba3151d65a7b4fa67998fe Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 11 Jun 2012 20:24:25 +0200 Subject: TONY: Rename variables in utils.h --- engines/tony/gfxengine.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index e8f32edac7..8daf49c4a5 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -208,7 +208,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { // ************ if (_bGUIOption) { if (!_tony.inAction() && _bInput) { - if ((_input.mouseLeftClicked() && _input.mousePos().x < 3 && _input.mousePos().y < 3)) { + if ((_input.mouseLeftClicked() && _input.mousePos()._x < 3 && _input.mousePos()._y < 3)) { CORO_INVOKE_1(openOptionScreen, 0); goto SKIPCLICKSINISTRO; } else if (_input.getAsyncKeyState(Common::KEYCODE_ESCAPE)) @@ -297,7 +297,7 @@ SKIPCLICKSINISTRO: // Update screen scrolling to keep Tony in focus if (_tony.mustUpdateScrolling() && _bLocationLoaded) { RMPoint showThis = _tony.position(); - showThis.y -= 60; + showThis._y -= 60; _loc.updateScrolling(showThis); } @@ -379,14 +379,14 @@ void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) { void RMGfxEngine::initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { - if (start.x == -1 || start.y == -1) { - start.x = ptTonyStart.x - RM_SX / 2; - start.y = ptTonyStart.y - RM_SY / 2; + if (start._x == -1 || start._y == -1) { + start._x = ptTonyStart._x - RM_SX / 2; + start._y = ptTonyStart._y - RM_SY / 2; } _loc.setScrollPosition(start); - if (ptTonyStart.x == 0 && ptTonyStart.y == 0) { + if (ptTonyStart._x == 0 && ptTonyStart._y == 0) { } else { _tony.setPosition(ptTonyStart, nLoc); _tony.setScrollPosition(start); @@ -616,8 +616,8 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm f->writeByte(i); f->write(name.c_str(), i); f->writeUint32LE(_nCurLoc); - f->writeUint32LE(tp.x); - f->writeUint32LE(tp.y); + f->writeUint32LE(tp._x); + f->writeUint32LE(tp._y); f->writeUint32LE(size); f->write(state, size); @@ -738,8 +738,8 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { } _ctx->loc = _ctx->f->readUint32LE(); - _ctx->tp.x = _ctx->f->readUint32LE(); - _ctx->tp.y = _ctx->f->readUint32LE(); + _ctx->tp._x = _ctx->f->readUint32LE(); + _ctx->tp._y = _ctx->f->readUint32LE(); _ctx->size = _ctx->f->readUint32LE(); if ((_ctx->ver >= 0x5) && (_ctx->ver <= 7)) { -- cgit v1.2.3 From 985602a72d52acdb99599eaddbed7f7b9fce01ce Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 12 Jun 2012 00:07:50 +0200 Subject: TONY: Rename some Italian into English --- engines/tony/gfxengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 8daf49c4a5..4c09e16678 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -645,7 +645,7 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm // Saves the state of the shepherdess and show yourself bStat = _tony.getPastorella(); f->writeByte(bStat); - bStat = _inter.getPalesati(); + bStat = _inter.getPerorate(); f->writeByte(bStat); // Save the chars @@ -781,7 +781,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { bStat = _ctx->f->readByte(); _tony.setPastorella(bStat); bStat = _ctx->f->readByte(); - _inter.setPalesati(bStat); + _inter.setPerorate(bStat); CharsLoadAll(_ctx->f); } -- cgit v1.2.3 From 5bafab9ad629595a1d270b60b2a91bd04dc1b7b9 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 13 Jun 2012 08:00:37 +0200 Subject: TONY: Translate some more Italian --- engines/tony/gfxengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 4c09e16678..b167d0a546 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -643,7 +643,7 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm bool bStat; // Saves the state of the shepherdess and show yourself - bStat = _tony.getPastorella(); + bStat = _tony.getShepherdess(); f->writeByte(bStat); bStat = _inter.getPerorate(); f->writeByte(bStat); @@ -779,7 +779,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { bool bStat = false; bStat = _ctx->f->readByte(); - _tony.setPastorella(bStat); + _tony.setShepherdess(bStat); bStat = _ctx->f->readByte(); _inter.setPerorate(bStat); -- cgit v1.2.3 From 746dcf33da340702157dc7aca0f01265648189be Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Wed, 13 Jun 2012 21:06:57 +1000 Subject: TONY: Refactor RMPointer class to use the ScummVM CursorMan --- engines/tony/gfxengine.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index b167d0a546..deae0cb641 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -305,8 +305,9 @@ SKIPCLICKSINISTRO: _tony.setScrollPosition(_loc.scrollPosition()); if ((!_tony.inAction() && _bInput) || _bAlwaysDrawMouse) { - _point.setCoord(_input.mousePos()); - _point.doFrame(&_bigBuf); + _point.showCursor(); + } else { + _point.hideCursor(); } // ********************** -- cgit v1.2.3 From cdbc4aa28b5c47392369879b209f9635ff431195 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 16 Jun 2012 10:57:35 +1000 Subject: TONY: Initial commit of in progress dirty rect handling --- engines/tony/gfxengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index deae0cb641..3ea83a8867 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -63,6 +63,7 @@ RMGfxEngine::RMGfxEngine() { // Create big buffer where the frame will be rendered _bigBuf.create(RM_BBX, RM_BBY, 16); _bigBuf.offsetY(RM_SKIPY); + _bigBuf.setTrackDirtyRects(true); _csMainLoop = NULL; _nCurLoc = 0; @@ -475,8 +476,7 @@ void RMGfxEngine::init() { delete load; // Display 'Loading' screen - // TODO: The loading screen isn't currently optimal, since the game doesn't respond to events - // whilst the mpalInit code is being executed. + _bigBuf.addDirtyRect(Common::Rect(0, 0, RM_SX, RM_SY)); _vm->_window.getNewFrame(*this, NULL); _vm->_window.repaint(); -- cgit v1.2.3 From 9405f9eb4aed1d4c248e57ab4972b0132b2253f5 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 17 Jun 2012 17:04:10 +1000 Subject: TONY: Added code to load and save the ScummVM sound settings --- engines/tony/gfxengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index deae0cb641..9dab3eeb52 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -659,7 +659,7 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm f->writeByte(GLOBALS._bCfgInvUp); f->writeByte(GLOBALS._bCfgAnni30); f->writeByte(GLOBALS._bCfgAntiAlias); - f->writeByte(GLOBALS._bCfgSottotitoli); + f->writeByte(GLOBALS._bShowSubtitles); f->writeByte(GLOBALS._bCfgTransparence); f->writeByte(GLOBALS._bCfgInterTips); f->writeByte(GLOBALS._bCfgDubbing); @@ -795,7 +795,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { GLOBALS._bCfgInvUp = _ctx->f->readByte(); GLOBALS._bCfgAnni30 = _ctx->f->readByte(); GLOBALS._bCfgAntiAlias = _ctx->f->readByte(); - GLOBALS._bCfgSottotitoli = _ctx->f->readByte(); + GLOBALS._bShowSubtitles = _ctx->f->readByte(); GLOBALS._bCfgTransparence = _ctx->f->readByte(); GLOBALS._bCfgInterTips = _ctx->f->readByte(); GLOBALS._bCfgDubbing = _ctx->f->readByte(); -- cgit v1.2.3 From b36b66630086044c54f745acfb64f91d90713045 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 17 Jun 2012 18:36:23 +0200 Subject: TONY: American-ification of English used --- engines/tony/gfxengine.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 9dab3eeb52..bb48be11c4 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -497,21 +497,21 @@ void RMGfxEngine::init() { // Create the freeze event _csMainLoop = g_system->createMutex(); - // Initialise the IRQ function for items for MPAL + // Initialize the IRQ function for items for MPAL GLOBALS._gfxEngine = this; mpalInstallItemIrq(itemIrq); - // Initialise the input + // Initialize the input _input.init(); - // Initialise the mouse pointer + // Initialize the mouse pointer _point.init(); - // Initialise Tony + // Initialize Tony _tony.init(); _tony.linkToBoxes(&_vm->_theBoxes); - // Initialise the inventory and the interface + // Initialize the inventory and the interface _inv.init(); _inter.init(); -- cgit v1.2.3 From a46b06a587cc0b5e5767b55ba0d56264a8078f0c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sun, 17 Jun 2012 19:39:58 +0200 Subject: TONY: Move functions comment to doxygen format --- engines/tony/gfxengine.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index bb48be11c4..08eff0a991 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -353,7 +353,6 @@ SKIPCLICKSINISTRO: CORO_END_CODE; } - void RMGfxEngine::initCustomDll(void) { setupGlobalVars(&_tony, &_point, &_vm->_theBoxes, &_loc, &_inv, &_input); } @@ -378,7 +377,6 @@ void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) { } } - void RMGfxEngine::initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { if (start._x == -1 || start._y == -1) { start._x = ptTonyStart._x - RM_SX / 2; -- cgit v1.2.3 From e8a6f61f8815fcf36e7a43383695c74b8925993f Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 18 Jun 2012 08:24:33 +0200 Subject: TONY: Remove useless void in function declaration --- engines/tony/gfxengine.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 08eff0a991..0785ec534c 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -353,7 +353,7 @@ SKIPCLICKSINISTRO: CORO_END_CODE; } -void RMGfxEngine::initCustomDll(void) { +void RMGfxEngine::initCustomDll() { setupGlobalVars(&_tony, &_point, &_vm->_theBoxes, &_loc, &_inv, &_input); } @@ -522,7 +522,7 @@ void RMGfxEngine::init() { _tony.executeAction(20, 1, 0); } -void RMGfxEngine::close(void) { +void RMGfxEngine::close() { _bigBuf.clearOT(); _inter.close(); @@ -538,37 +538,37 @@ void RMGfxEngine::switchFullscreen(bool bFull) { void RMGfxEngine::GDIControl(bool bCon) { } -void RMGfxEngine::enableInput(void) { +void RMGfxEngine::enableInput() { _bInput = true; } -void RMGfxEngine::disableInput(void) { +void RMGfxEngine::disableInput() { _bInput = false; _inter.reset(); } -void RMGfxEngine::enableMouse(void) { +void RMGfxEngine::enableMouse() { _bAlwaysDrawMouse = true; } -void RMGfxEngine::disableMouse(void) { +void RMGfxEngine::disableMouse() { _bAlwaysDrawMouse = false; } -void RMGfxEngine::freeze(void) { +void RMGfxEngine::freeze() { g_system->lockMutex(_csMainLoop); } -void RMGfxEngine::unfreeze(void) { +void RMGfxEngine::unfreeze() { g_system->unlockMutex(_csMainLoop); } void CharsSaveAll(Common::OutSaveFile *f); void CharsLoadAll(Common::InSaveFile *f); -void MCharResetCodes(void); +void MCharResetCodes(); void SaveChangedHotspot(Common::OutSaveFile *f); void LoadChangedHotspot(Common::InSaveFile *f); -void ReapplyChangedHotspot(void); +void ReapplyChangedHotspot(); void RestoreMusic(CORO_PARAM); void SaveMusic(Common::OutSaveFile *f); @@ -856,7 +856,7 @@ void RMGfxEngine::initWipe(int type) { _rcWipeEllipse = Common::Rect(320 - FSTEP, 240 - FSTEP, 320 + FSTEP, 240 + FSTEP); } -void RMGfxEngine::closeWipe(void) { +void RMGfxEngine::closeWipe() { _bWiping = false; } -- cgit v1.2.3 From 61d460a854ff4883411846703543bb2f797fcd6b Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 19 Jun 2012 20:50:48 +1000 Subject: TONY: Implement more of the music related code from the original --- engines/tony/gfxengine.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 0785ec534c..cc53a1d8e2 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -473,8 +473,6 @@ void RMGfxEngine::init() { delete load; // Display 'Loading' screen - // TODO: The loading screen isn't currently optimal, since the game doesn't respond to events - // whilst the mpalInit code is being executed. _vm->_window.getNewFrame(*this, NULL); _vm->_window.repaint(); -- cgit v1.2.3 From c3407390013b1e1826bdb31979a50f5e8a957f04 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Wed, 22 Aug 2012 14:00:46 +0200 Subject: TONY: Replace _vm with g_vm. --- engines/tony/gfxengine.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 726ee07e28..183e68c8c6 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -110,7 +110,7 @@ void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) { CORO_INVOKE_3(_opt.initSaveMenuOnly, _bigBuf, false, _ctx->bRes); if (_ctx->bRes) { - _vm->pauseSound(true); + g_vm->pauseSound(true); disableInput(); _inv.endCombine(); @@ -120,7 +120,7 @@ void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) { _point.setSpecialPointer(RMPointer::PTR_NONE); _point.setCustomPointer(NULL); enableMouse(); - _vm->grabThumbnail(); + g_vm->grabThumbnail(); // Exists the IDLE to avoid premature death in loading _bMustEnterMenu = true; @@ -162,7 +162,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { disableMouse(); enableInput(); mpalStartIdlePoll(_nCurLoc); - _vm->pauseSound(false); + g_vm->pauseSound(false); } } @@ -214,7 +214,7 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { goto SKIPCLICKSINISTRO; } else if (_input.getAsyncKeyState(Common::KEYCODE_ESCAPE)) CORO_INVOKE_1(openOptionScreen, 0); - else if (!_vm->getIsDemo()) { + else if (!g_vm->getIsDemo()) { if (_input.getAsyncKeyState(Common::KEYCODE_F3) || _input.getAsyncKeyState(Common::KEYCODE_F5)) // Save game screen CORO_INVOKE_1(openOptionScreen, 4); @@ -355,7 +355,7 @@ SKIPCLICKSINISTRO: } void RMGfxEngine::initCustomDll() { - setupGlobalVars(&_tony, &_point, &_vm->_theBoxes, &_loc, &_inv, &_input); + setupGlobalVars(&_tony, &_point, &g_vm->_theBoxes, &_loc, &_inv, &_input); } void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) { @@ -475,8 +475,8 @@ void RMGfxEngine::init() { // Display 'Loading' screen _bigBuf.addDirtyRect(Common::Rect(0, 0, RM_SX, RM_SY)); - _vm->_window.getNewFrame(*this, NULL); - _vm->_window.repaint(); + g_vm->_window.getNewFrame(*this, NULL); + g_vm->_window.repaint(); GLOBALS._bPatIrqFreeze = true; @@ -507,7 +507,7 @@ void RMGfxEngine::init() { // Initialize Tony _tony.init(); - _tony.linkToBoxes(&_vm->_theBoxes); + _tony.linkToBoxes(&g_vm->_theBoxes); // Initialize the inventory and the interface _inv.init(); @@ -631,9 +631,9 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm delete[] state; // boxes - size = _vm->_theBoxes.getSaveStateSize(); + size = g_vm->_theBoxes.getSaveStateSize(); state = new byte[size]; - _vm->_theBoxes.saveState(state); + g_vm->_theBoxes.saveState(state); f->writeUint32LE(size); f->write(state, size); delete[] state; @@ -769,7 +769,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { _ctx->size = _ctx->f->readUint32LE(); _ctx->state = new byte[_ctx->size]; _ctx->f->read(_ctx->state, _ctx->size); - _vm->_theBoxes.loadState(_ctx->state); + g_vm->_theBoxes.loadState(_ctx->state); delete[] _ctx->state; } @@ -865,7 +865,7 @@ void RMGfxEngine::waitWipeEnd(CORO_PARAM) { } bool RMGfxEngine::canLoadSave() { - return _bInput && !_tony.inAction() && !_vm->getIsDemo(); + return _bInput && !_tony.inAction() && !g_vm->getIsDemo(); } } // End of namespace Tony -- cgit v1.2.3 From af134e02448c7e4d5d17711c0cb7f53ddc0674f6 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Fri, 24 Aug 2012 19:43:22 +0200 Subject: TONY: Animate mouse cursors. This restores the forgotten doFrame code for RMPointer, which fixes the bird mouse cursor. Thanks to eriktorbjorn for noticing it. --- engines/tony/gfxengine.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 183e68c8c6..5431a0ca7d 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -310,6 +310,7 @@ SKIPCLICKSINISTRO: } else { _point.hideCursor(); } + _point.doFrame(); // ********************** // Draw the list in the OT -- cgit v1.2.3 From 7b4dd0a682bf79cc86024d77d16411a6e2681f47 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Mon, 27 Aug 2012 12:39:58 +0200 Subject: TONY: Remove various bits of unused code. --- engines/tony/gfxengine.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 5431a0ca7d..25aaa625f4 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -500,9 +500,6 @@ void RMGfxEngine::init() { GLOBALS._gfxEngine = this; mpalInstallItemIrq(itemIrq); - // Initialize the input - _input.init(); - // Initialize the mouse pointer _point.init(); @@ -530,13 +527,6 @@ void RMGfxEngine::close() { _inv.close(); _tony.close(); _point.close(); - _input.close(); -} - -void RMGfxEngine::switchFullscreen(bool bFull) { -} - -void RMGfxEngine::GDIControl(bool bCon) { } void RMGfxEngine::enableInput() { -- cgit v1.2.3 From 35fd91793b34b72624a89f2a76f45bc8e59020d2 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Tue, 28 Aug 2012 14:26:00 +0200 Subject: TONY: Get rid of RMDataStream. --- engines/tony/gfxengine.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 25aaa625f4..e8a5df29e9 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -416,7 +416,10 @@ uint32 RMGfxEngine::loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { if (!res.isValid()) continue; - _loc.load(res); + Common::SeekableReadStream *ds = res.getReadStream(); + _loc.load(*ds); + delete ds; + initForNewLocation(nLoc, ptTonyStart, start); bLoaded = true; break; -- cgit v1.2.3 From 3c986af9ce531f4d9cab889b196991be14cb88f6 Mon Sep 17 00:00:00 2001 From: Alyssa Milburn Date: Tue, 28 Aug 2012 22:10:10 +0200 Subject: TONY: Remove unnecessary mainloop mutex. Also, all the related freeze functions/members. --- engines/tony/gfxengine.cpp | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index e8a5df29e9..da8218fa99 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -65,7 +65,6 @@ RMGfxEngine::RMGfxEngine() { _bigBuf.offsetY(RM_SKIPY); _bigBuf.setTrackDirtyRects(true); - _csMainLoop = NULL; _nCurLoc = 0; _curAction = TA_GOTO; _curActionObj = 0; @@ -86,7 +85,6 @@ RMGfxEngine::RMGfxEngine() { RMGfxEngine::~RMGfxEngine() { // Close the buffer _bigBuf.destroy(); - g_system->deleteMutex(_csMainLoop); } void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) { @@ -144,8 +142,6 @@ void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) { CORO_BEGIN_CODE(_ctx); - g_system->lockMutex(_csMainLoop); - // Poll of input devices _input.poll(); @@ -350,8 +346,6 @@ SKIPCLICKSINISTRO: } } - g_system->unlockMutex(_csMainLoop); - CORO_END_CODE; } @@ -367,11 +361,7 @@ void RMGfxEngine::itemIrq(uint32 dwItem, int nPattern, int nStatus) { item = GLOBALS._gfxEngine->_loc.getItemFromCode(dwItem); if (item != NULL) { if (nPattern != -1) { - if (GLOBALS._bPatIrqFreeze) - mainFreeze(); item->setPattern(nPattern, true); - if (GLOBALS._bPatIrqFreeze) - mainUnfreeze(); } if (nStatus != -1) item->setStatus(nStatus); @@ -454,8 +444,6 @@ void RMGfxEngine::unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE); } - mainFreeze(); - _bLocationLoaded = false; _bigBuf.clearOT(); @@ -482,8 +470,6 @@ void RMGfxEngine::init() { g_vm->_window.getNewFrame(*this, NULL); g_vm->_window.repaint(); - GLOBALS._bPatIrqFreeze = true; - // Activate GUI _bGUIOption = true; _bGUIInterface = true; @@ -496,9 +482,6 @@ void RMGfxEngine::init() { _bWiping = false; _hWipeEvent = CoroScheduler.createEvent(false, false); - // Create the freeze event - _csMainLoop = g_system->createMutex(); - // Initialize the IRQ function for items for MPAL GLOBALS._gfxEngine = this; mpalInstallItemIrq(itemIrq); @@ -549,14 +532,6 @@ void RMGfxEngine::disableMouse() { _bAlwaysDrawMouse = false; } -void RMGfxEngine::freeze() { - g_system->lockMutex(_csMainLoop); -} - -void RMGfxEngine::unfreeze() { - g_system->unlockMutex(_csMainLoop); -} - void CharsSaveAll(Common::OutSaveFile *f); void CharsLoadAll(Common::InSaveFile *f); void MCharResetCodes(); @@ -812,7 +787,6 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { CORO_INVOKE_2(unloadLocation, false, NULL); loadLocation(_ctx->loc, _ctx->tp, RMPoint(-1, -1)); _tony.setPattern(RMTony::PAT_STANDRIGHT); - mainUnfreeze(); // On older versions, need to an enter action if (_ctx->ver < 5) -- cgit v1.2.3 From f2df769aab10e719cc4fba6cb71e1500eb3acae4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 1 Sep 2012 00:25:35 +0200 Subject: TONY: More renaming --- engines/tony/gfxengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index da8218fa99..6f976ef37c 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -424,7 +424,7 @@ uint32 RMGfxEngine::loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { _bLocationLoaded = true; // On entering the location - return CORO_INVALID_PID_VALUE; //mpalQueryDoAction(0,m_nCurLoc,0); + return CORO_INVALID_PID_VALUE; //mpalQueryDoAction(0, m_nCurLoc, 0); } void RMGfxEngine::unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { -- cgit v1.2.3 From 8c753c96a097c3b6e67b061470606278a0d8f102 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 1 Sep 2012 01:05:22 +0200 Subject: TONY: Move some functions from .h to .cpp files --- engines/tony/gfxengine.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 6f976ef37c..5c038e154d 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -836,4 +836,27 @@ bool RMGfxEngine::canLoadSave() { return _bInput && !_tony.inAction() && !g_vm->getIsDemo(); } +RMGfxEngine::operator RMGfxTargetBuffer &() { + return _bigBuf; +} + +RMInput &RMGfxEngine::getInput() { + return _input; +} + +RMPointer &RMGfxEngine::getPointer() { + return _point; +} + +/** + * Link to graphic task + */ +void RMGfxEngine::linkGraphicTask(RMGfxTask *task) { + _bigBuf.addPrim(new RMGfxPrimitive(task)); +} + +void RMGfxEngine::setPerorate(bool bpal) { + _inter.setPerorate(bpal); +} + } // End of namespace Tony -- cgit v1.2.3 From 80b51481b9dc3e70e2e55f16c853d6a1e6711522 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Fri, 7 Sep 2012 08:11:33 +0200 Subject: TONY: Some more cleanup --- engines/tony/gfxengine.cpp | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index 5c038e154d..abc9e03617 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -40,7 +40,7 @@ namespace Tony { * RMGfxEngine Methods \****************************************************************************/ -void ExitAllIdles(CORO_PARAM, const void *param) { +void exitAllIdles(CORO_PARAM, const void *param) { CORO_BEGIN_CONTEXT; CORO_END_CONTEXT(_ctx); @@ -129,7 +129,7 @@ void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) { GLOBALS._bIdleExited = false; - CoroScheduler.createProcess(ExitAllIdles, &_nCurLoc, sizeof(int)); + CoroScheduler.createProcess(exitAllIdles, &_nCurLoc, sizeof(int)); } } @@ -532,17 +532,6 @@ void RMGfxEngine::disableMouse() { _bAlwaysDrawMouse = false; } -void CharsSaveAll(Common::OutSaveFile *f); -void CharsLoadAll(Common::InSaveFile *f); -void MCharResetCodes(); -void SaveChangedHotspot(Common::OutSaveFile *f); -void LoadChangedHotspot(Common::InSaveFile *f); -void ReapplyChangedHotspot(); - -void RestoreMusic(CORO_PARAM); -void SaveMusic(Common::OutSaveFile *f); -void LoadMusic(Common::InSaveFile *f); - #define TONY_SAVEGAME_VERSION 8 void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Common::String &name) { @@ -617,7 +606,7 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm f->writeByte(bStat); // Save the chars - CharsSaveAll(f); + charsSaveAll(f); // Save the options f->writeByte(GLOBALS._bCfgInvLocked); @@ -639,10 +628,10 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm f->writeByte(GLOBALS._nCfgSFXVolume); // Save the hotspots - SaveChangedHotspot(f); + saveChangedHotspot(f); // Save the music - SaveMusic(f); + saveMusic(f); f->finalize(); delete f; @@ -751,7 +740,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { bStat = _ctx->f->readByte(); _inter.setPerorate(bStat); - CharsLoadAll(_ctx->f); + charsLoadAll(_ctx->f); } if (_ctx->ver >= 6) { @@ -775,11 +764,11 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { GLOBALS._nCfgSFXVolume = _ctx->f->readByte(); // Load hotspots - LoadChangedHotspot(_ctx->f); + loadChangedHotspot(_ctx->f); } if (_ctx->ver >= 7) { - LoadMusic(_ctx->f); + loadMusic(_ctx->f); } delete _ctx->f; @@ -793,13 +782,13 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { mpalQueryDoAction(0, _ctx->loc, 0); else { // In the new ones, we just reset the mcode - MCharResetCodes(); + mCharResetCodes(); } if (_ctx->ver >= 6) - ReapplyChangedHotspot(); + reapplyChangedHotspot(); - CORO_INVOKE_0(RestoreMusic); + CORO_INVOKE_0(restoreMusic); _bGUIInterface = true; _bGUIInventory = true; -- cgit v1.2.3 From 17d6d732ea000400eb1353e1f93b121be524852d Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 8 Sep 2012 01:02:03 +0200 Subject: TONY: More renaming, reduce some variable scopes --- engines/tony/gfxengine.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'engines/tony/gfxengine.cpp') diff --git a/engines/tony/gfxengine.cpp b/engines/tony/gfxengine.cpp index abc9e03617..59fb024622 100644 --- a/engines/tony/gfxengine.cpp +++ b/engines/tony/gfxengine.cpp @@ -394,13 +394,10 @@ void RMGfxEngine::initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint star } uint32 RMGfxEngine::loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) { - bool bLoaded; - int i; - _nCurLoc = nLoc; - bLoaded = false; - for (i = 0; i < 5; i++) { + bool bLoaded = false; + for (int i = 0; i < 5; i++) { // Try the loading of the location RMRes res(_nCurLoc); if (!res.isValid()) @@ -537,20 +534,17 @@ void RMGfxEngine::disableMouse() { void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Common::String &name) { Common::OutSaveFile *f; byte *state; - uint thumbsize; - uint size; - int i; char buf[4]; RMPoint tp = _tony.position(); // Saving: MPAL variables, current location, and Tony inventory position // For now, we only save the MPAL state - size = mpalGetSaveStateSize(); + uint size = mpalGetSaveStateSize(); state = new byte[size]; mpalSaveState(state); - thumbsize = 160 * 120 * 2; + uint thumbsize = 160 * 120 * 2; buf[0] = 'R'; buf[1] = 'M'; @@ -566,7 +560,7 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm f->write(curThumb, thumbsize); // Difficulty level - i = mpalQueryGlobalVar("VERSIONEFACILE"); + int i = mpalQueryGlobalVar("VERSIONEFACILE"); f->writeByte(i); i = strlen(name.c_str()); @@ -597,10 +591,8 @@ void RMGfxEngine::saveState(const Common::String &fn, byte *curThumb, const Comm delete[] state; // New Ver5 - bool bStat; - // Saves the state of the shepherdess and show yourself - bStat = _tony.getShepherdess(); + bool bStat = _tony.getShepherdess(); f->writeByte(bStat); bStat = _inter.getPerorate(); f->writeByte(bStat); @@ -723,7 +715,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { _inv.loadState(_ctx->state); delete[] _ctx->state; - if (_ctx->ver >= 0x2) { // Versione 2: box please + if (_ctx->ver >= 0x2) { // Version 2: box please _ctx->size = _ctx->f->readUint32LE(); _ctx->state = new byte[_ctx->size]; _ctx->f->read(_ctx->state, _ctx->size); @@ -732,7 +724,7 @@ void RMGfxEngine::loadState(CORO_PARAM, const Common::String &fn) { } if (_ctx->ver >= 5) { - // Versione 5 + // Version 5 bool bStat = false; bStat = _ctx->f->readByte(); -- cgit v1.2.3