TONY: Rename variables and functions in gfxengine.h

This commit is contained in:
Strangerke 2012-06-05 01:04:53 +02:00
parent 014330a538
commit a5cb751f7a
8 changed files with 345 additions and 347 deletions

View file

@ -2363,7 +2363,7 @@ DECLARE_CUSTOM_FUNCTION(DoCredits)(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint3
CORO_INVOKE_0(GLOBALS.WaitFrame); CORO_INVOKE_0(GLOBALS.WaitFrame);
if (GLOBALS.Input->mouseLeftClicked() || GLOBALS.Input->mouseRightClicked()) if (GLOBALS.Input->mouseLeftClicked() || GLOBALS.Input->mouseRightClicked())
break; break;
if (_vm->getEngine()->GetInput().getAsyncKeyState(Common::KEYCODE_TAB)) if (_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_TAB))
break; break;
} }
@ -2531,7 +2531,7 @@ ASSIGN(201, MustSkipIdleEnd);
END_CUSTOM_FUNCTION_MAP() END_CUSTOM_FUNCTION_MAP()
void SetupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation *loc, RMInventory *inv, RMInput *input) { void setupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation *loc, RMInventory *inv, RMInput *input) {
GLOBALS.Tony = tony; GLOBALS.Tony = tony;
GLOBALS.Pointer = ptr; GLOBALS.Pointer = ptr;
GLOBALS.Boxes = box; GLOBALS.Boxes = box;

View file

@ -72,7 +72,7 @@ class RMInventory;
class RMInput; class RMInput;
void INIT_CUSTOM_FUNCTION(LPCUSTOMFUNCTION *lpMap, Common::String *lpStrMap); void INIT_CUSTOM_FUNCTION(LPCUSTOMFUNCTION *lpMap, Common::String *lpStrMap);
void SetupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation *loc, RMInventory *inv, RMInput *input); void setupGlobalVars(RMTony *tony, RMPointer *ptr, RMGameBoxes *box, RMLocation *loc, RMInventory *inv, RMInput *input);
#endif #endif

View file

@ -2086,7 +2086,7 @@ void RMTextDialog::RemoveThis(CORO_PARAM, bool &result) {
} }
if (!m_bNoTab) { if (!m_bNoTab) {
if (_vm->getEngine()->GetInput().getAsyncKeyState(Common::KEYCODE_TAB)) if (_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_TAB))
return; return;
} }

View file

@ -47,23 +47,23 @@ using namespace MPAL;
/****************************************/ /****************************************/
uint32 MainLoadLocation(int nLoc, RMPoint pt, RMPoint start) { uint32 MainLoadLocation(int nLoc, RMPoint pt, RMPoint start) {
return _vm->getEngine()->LoadLocation(nLoc, pt, start); return _vm->getEngine()->loadLocation(nLoc, pt, start);
} }
void MainUnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) { void MainUnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) {
_vm->getEngine()->UnloadLocation(coroParam, bDoOnExit, result); _vm->getEngine()->unloadLocation(coroParam, bDoOnExit, result);
} }
void MainLinkGraphicTask(RMGfxTask *task) { void MainLinkGraphicTask(RMGfxTask *task) {
_vm->getEngine()->LinkGraphicTask(task); _vm->getEngine()->linkGraphicTask(task);
} }
void MainFreeze(void) { void MainFreeze(void) {
_vm->getEngine()->Freeze(); _vm->getEngine()->freeze();
} }
void MainUnfreeze(void) { void MainUnfreeze(void) {
_vm->getEngine()->Unfreeze(); _vm->getEngine()->unfreeze();
} }
void MainWaitFrame(CORO_PARAM) { void MainWaitFrame(CORO_PARAM) {
@ -71,11 +71,11 @@ void MainWaitFrame(CORO_PARAM) {
} }
void MainShowMouse(void) { void MainShowMouse(void) {
_vm->getEngine()->EnableMouse(); _vm->getEngine()->enableMouse();
} }
void MainHideMouse(void) { void MainHideMouse(void) {
_vm->getEngine()->DisableMouse(); _vm->getEngine()->disableMouse();
} }
void MainPlayMusic(int nChannel, const char *filename, int nFX, bool bLoop, int nSync) { void MainPlayMusic(int nChannel, const char *filename, int nFX, bool bLoop, int nSync) {
@ -83,39 +83,39 @@ void MainPlayMusic(int nChannel, const char *filename, int nFX, bool bLoop, int
} }
void MainDisableInput(void) { void MainDisableInput(void) {
_vm->getEngine()->DisableInput(); _vm->getEngine()->disableInput();
} }
void MainEnableInput(void) { void MainEnableInput(void) {
_vm->getEngine()->EnableInput(); _vm->getEngine()->enableInput();
} }
void MainInitWipe(int type) { void MainInitWipe(int type) {
_vm->getEngine()->InitWipe(type); _vm->getEngine()->initWipe(type);
} }
void MainCloseWipe(void) { void MainCloseWipe(void) {
_vm->getEngine()->CloseWipe(); _vm->getEngine()->closeWipe();
} }
void MainWaitWipeEnd(CORO_PARAM) { void MainWaitWipeEnd(CORO_PARAM) {
_vm->getEngine()->WaitWipeEnd(coroParam); _vm->getEngine()->waitWipeEnd(coroParam);
} }
void MainEnableGUI(void) { void MainEnableGUI(void) {
_vm->getEngine()->m_bGUIInterface = true; _vm->getEngine()->_bGUIInterface = true;
_vm->getEngine()->m_bGUIInventory = true; _vm->getEngine()->_bGUIInventory = true;
_vm->getEngine()->m_bGUIOption = true; _vm->getEngine()->_bGUIOption = true;
} }
void MainDisableGUI(void) { void MainDisableGUI(void) {
_vm->getEngine()->m_bGUIInterface = false; _vm->getEngine()->_bGUIInterface = false;
_vm->getEngine()->m_bGUIInventory = false; _vm->getEngine()->_bGUIInventory = false;
_vm->getEngine()->m_bGUIOption = false; _vm->getEngine()->_bGUIOption = false;
} }
void MainSetPalesati(bool bPalesati) { void MainSetPalesati(bool bPalesati) {
_vm->getEngine()->SetPalesati(bPalesati); _vm->getEngine()->setPalesati(bPalesati);
} }
/****************************************************************************\ /****************************************************************************\
@ -1097,9 +1097,9 @@ void RMOptionScreen::DoFrame(CORO_PARAM, RMInput *input) {
} }
} }
#define KEYPRESS(c) (_vm->getEngine()->GetInput().getAsyncKeyState(c)) #define KEYPRESS(c) (_vm->getEngine()->getInput().getAsyncKeyState(c))
#define PROCESS_CHAR(cod,c) if (KEYPRESS(cod)) { \ #define PROCESS_CHAR(cod,c) if (KEYPRESS(cod)) { \
m_EditName[strlen(m_EditName) +1 ] = '\0'; m_EditName[strlen(m_EditName)] = c; _ctx->bRefresh = true; } m_EditName[strlen(m_EditName) + 1] = '\0'; m_EditName[strlen(m_EditName)] = c; _ctx->bRefresh = true; }
/**************** State Buttons **************/ /**************** State Buttons **************/
if (m_bEditSaveName) { if (m_bEditSaveName) {

View file

@ -61,34 +61,34 @@ void ExitAllIdles(CORO_PARAM, const void *param) {
RMGfxEngine::RMGfxEngine() { RMGfxEngine::RMGfxEngine() {
// Create big buffer where the frame will be rendered // Create big buffer where the frame will be rendered
m_bigBuf.Create(RM_BBX, RM_BBY, 16); _bigBuf.Create(RM_BBX, RM_BBY, 16);
m_bigBuf.OffsetY(RM_SKIPY); _bigBuf.OffsetY(RM_SKIPY);
csMainLoop = NULL; _csMainLoop = NULL;
m_nCurLoc = 0; _nCurLoc = 0;
m_curAction = TA_GOTO; _curAction = TA_GOTO;
m_curActionObj = 0; _curActionObj = 0;
m_nWipeType = 0; _nWipeType = 0;
m_hWipeEvent = 0; _hWipeEvent = 0;
m_nWipeStep = 0; _nWipeStep = 0;
m_bMustEnterMenu = false; _bMustEnterMenu = false;
m_bWiping = false; _bWiping = false;
m_bGUIOption = false; _bGUIOption = false;
m_bGUIInterface = false; _bGUIInterface = false;
m_bGUIInventory = false; _bGUIInventory = false;
m_bAlwaysDrawMouse = false; _bAlwaysDrawMouse = false;
m_bOption = false; _bOption = false;
m_bLocationLoaded = false; _bLocationLoaded = false;
m_bInput = false; _bInput = false;
} }
RMGfxEngine::~RMGfxEngine() { RMGfxEngine::~RMGfxEngine() {
// Close the buffer // Close the buffer
m_bigBuf.Destroy(); _bigBuf.Destroy();
g_system->deleteMutex(csMainLoop); g_system->deleteMutex(_csMainLoop);
} }
void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) { void RMGfxEngine::openOptionScreen(CORO_PARAM, int type) {
CORO_BEGIN_CONTEXT; CORO_BEGIN_CONTEXT;
bool bRes; bool bRes;
CORO_END_CONTEXT(_ctx); CORO_END_CONTEXT(_ctx);
@ -98,271 +98,271 @@ void RMGfxEngine::OpenOptionScreen(CORO_PARAM, int type) {
_ctx->bRes = false; _ctx->bRes = false;
if (type == 0) 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) 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) 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) 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) 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) { if (_ctx->bRes) {
_vm->pauseSound(true); _vm->pauseSound(true);
DisableInput(); disableInput();
m_inv.EndCombine(); _inv.EndCombine();
m_curActionObj = 0; _curActionObj = 0;
m_curAction = TA_GOTO; _curAction = TA_GOTO;
m_point.SetAction(m_curAction); _point.SetAction(_curAction);
m_point.SetSpecialPointer(RMPointer::PTR_NONE); _point.SetSpecialPointer(RMPointer::PTR_NONE);
m_point.SetCustomPointer(NULL); _point.SetCustomPointer(NULL);
EnableMouse(); enableMouse();
_vm->grabThumbnail(); _vm->grabThumbnail();
// Exists the IDLE to avoid premature death in loading // Exists the IDLE to avoid premature death in loading
m_bMustEnterMenu = true; _bMustEnterMenu = true;
if (type == 1 || type == 2) { if (type == 1 || type == 2) {
GLOBALS.bIdleExited = true; GLOBALS.bIdleExited = true;
} else { } else {
CORO_INVOKE_0(m_tony.StopNoAction); CORO_INVOKE_0(_tony.StopNoAction);
GLOBALS.bIdleExited = false; GLOBALS.bIdleExited = false;
CoroScheduler.createProcess(ExitAllIdles, &m_nCurLoc, sizeof(int)); CoroScheduler.createProcess(ExitAllIdles, &_nCurLoc, sizeof(int));
} }
} }
CORO_END_CODE; CORO_END_CODE;
} }
void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) { void RMGfxEngine::doFrame(CORO_PARAM, bool bDrawLocation) {
CORO_BEGIN_CONTEXT; CORO_BEGIN_CONTEXT;
CORO_END_CONTEXT(_ctx); CORO_END_CONTEXT(_ctx);
CORO_BEGIN_CODE(_ctx); CORO_BEGIN_CODE(_ctx);
g_system->lockMutex(csMainLoop); g_system->lockMutex(_csMainLoop);
// Poll of input devices // Poll of input devices
m_input.poll(); _input.poll();
if (m_bMustEnterMenu && GLOBALS.bIdleExited) { if (_bMustEnterMenu && GLOBALS.bIdleExited) {
m_bOption = true; _bOption = true;
m_bMustEnterMenu = false; _bMustEnterMenu = false;
GLOBALS.bIdleExited = false; GLOBALS.bIdleExited = false;
} }
if (m_bOption) { if (_bOption) {
CORO_INVOKE_1(m_opt.DoFrame, &m_input); CORO_INVOKE_1(_opt.DoFrame, &_input);
m_bOption = !m_opt.IsClosing(); _bOption = !_opt.IsClosing();
if (!m_bOption) { if (!_bOption) {
DisableMouse(); disableMouse();
EnableInput(); enableInput();
mpalStartIdlePoll(m_nCurLoc); mpalStartIdlePoll(_nCurLoc);
_vm->pauseSound(false); _vm->pauseSound(false);
} }
} }
if (bDrawLocation && m_bLocationLoaded) { if (bDrawLocation && _bLocationLoaded) {
// Location and objects // Location and objects
m_loc.DoFrame(&m_bigBuf); _loc.DoFrame(&_bigBuf);
// Check the mouse input // 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 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 // 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 // Left click activates the combine, if we are on an object
if (m_inv.LeftClick(m_input.mousePos(), m_curActionObj)) { if (_inv.LeftClick(_input.mousePos(), _curActionObj)) {
m_curAction = TA_COMBINE; _curAction = TA_COMBINE;
m_point.SetAction(m_curAction); _point.SetAction(_curAction);
} }
} else } else
// Right Click // Right Click
// *********** // ***********
if (m_input.mouseRightClicked()) { if (_input.mouseRightClicked()) {
if (m_itemName.IsItemSelected()) { if (_itemName.IsItemSelected()) {
m_curActionObj = 0; _curActionObj = 0;
m_inv.RightClick(m_input.mousePos()); _inv.RightClick(_input.mousePos());
} else } else
m_inv.RightClick(m_input.mousePos()); _inv.RightClick(_input.mousePos());
} else } else
// Right Release // Right Release
// ************* // *************
if (m_input.mouseRightReleased()) { if (_input.mouseRightReleased()) {
if (m_inv.RightRelease(m_input.mousePos(), m_curAction)) { if (_inv.RightRelease(_input.mousePos(), _curAction)) {
CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction); CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), _curAction);
m_curAction = TA_GOTO; _curAction = TA_GOTO;
m_point.SetAction(m_curAction); _point.SetAction(_curAction);
} }
} }
} else { } else {
// Options Menu // Options Menu
// ************ // ************
if (m_bGUIOption) { if (_bGUIOption) {
if (!m_tony.InAction() && m_bInput) { if (!_tony.InAction() && _bInput) {
if ((m_input.mouseLeftClicked() && m_input.mousePos().x < 3 && m_input.mousePos().y < 3)) { if ((_input.mouseLeftClicked() && _input.mousePos().x < 3 && _input.mousePos().y < 3)) {
CORO_INVOKE_1(OpenOptionScreen, 0); CORO_INVOKE_1(openOptionScreen, 0);
goto SKIPCLICKSINISTRO; goto SKIPCLICKSINISTRO;
} else if (m_input.getAsyncKeyState(Common::KEYCODE_ESCAPE)) } else if (_input.getAsyncKeyState(Common::KEYCODE_ESCAPE))
CORO_INVOKE_1(OpenOptionScreen, 0); CORO_INVOKE_1(openOptionScreen, 0);
else if (!_vm->getIsDemo()) { 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 // Save game screen
CORO_INVOKE_1(OpenOptionScreen, 3); CORO_INVOKE_1(openOptionScreen, 3);
else if (m_input.getAsyncKeyState(Common::KEYCODE_F2) || m_input.getAsyncKeyState(Common::KEYCODE_F7)) else if (_input.getAsyncKeyState(Common::KEYCODE_F2) || _input.getAsyncKeyState(Common::KEYCODE_F7))
// Load game screen // Load game screen
CORO_INVOKE_1(OpenOptionScreen, 4); CORO_INVOKE_1(openOptionScreen, 4);
} }
} }
} }
// Left Click // Left Click
// ************** // **************
if (m_input.mouseLeftClicked() && !m_inter.Active()) { if (_input.mouseLeftClicked() && !_inter.Active()) {
if (m_curAction != TA_COMBINE) if (_curAction != TA_COMBINE)
CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_point.CurAction()); CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), _point.CurAction());
else if (m_itemName.GetSelectedItem() != NULL) else if (_itemName.GetSelectedItem() != NULL)
CORO_INVOKE_4(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), TA_COMBINE, m_curActionObj); CORO_INVOKE_4(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), TA_COMBINE, _curActionObj);
if (m_curAction == TA_COMBINE) { if (_curAction == TA_COMBINE) {
m_inv.EndCombine(); _inv.EndCombine();
m_point.SetSpecialPointer(RMPointer::PTR_NONE); _point.SetSpecialPointer(RMPointer::PTR_NONE);
} }
m_curAction = TA_GOTO; _curAction = TA_GOTO;
m_point.SetAction(m_curAction); _point.SetAction(_curAction);
} }
SKIPCLICKSINISTRO: SKIPCLICKSINISTRO:
// Right Click // Right Click
// ************ // ************
if (m_curAction == TA_COMBINE) { if (_curAction == TA_COMBINE) {
// During a combine, it cancels it // During a combine, it cancels it
if (m_input.mouseRightClicked()) { if (_input.mouseRightClicked()) {
m_inv.EndCombine(); _inv.EndCombine();
m_curActionObj = 0; _curActionObj = 0;
m_curAction = TA_GOTO; _curAction = TA_GOTO;
m_point.SetAction(m_curAction); _point.SetAction(_curAction);
m_point.SetSpecialPointer(RMPointer::PTR_NONE); _point.SetSpecialPointer(RMPointer::PTR_NONE);
} }
} else if (m_input.mouseRightClicked() && m_itemName.IsItemSelected() && m_point.GetSpecialPointer() == RMPointer::PTR_NONE) { } else if (_input.mouseRightClicked() && _itemName.IsItemSelected() && _point.GetSpecialPointer() == RMPointer::PTR_NONE) {
if (m_bGUIInterface) { if (_bGUIInterface) {
// Before opening the interface, replaces GOTO // Before opening the interface, replaces GOTO
m_curAction = TA_GOTO; _curAction = TA_GOTO;
m_curActionObj = 0; _curActionObj = 0;
m_point.SetAction(m_curAction); _point.SetAction(_curAction);
m_inter.Clicked(m_input.mousePos()); _inter.Clicked(_input.mousePos());
} }
} }
// Right Release // Right Release
// ************* // *************
if (m_input.mouseRightReleased()) { if (_input.mouseRightReleased()) {
if (m_bGUIInterface) { if (_bGUIInterface) {
if (m_inter.Released(m_input.mousePos(), m_curAction)) { if (_inter.Released(_input.mousePos(), _curAction)) {
m_point.SetAction(m_curAction); _point.SetAction(_curAction);
CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction); CORO_INVOKE_3(_tony.MoveAndDoAction, _itemName.GetHotspot(), _itemName.GetSelectedItem(), _curAction);
m_curAction = TA_GOTO; _curAction = TA_GOTO;
m_point.SetAction(m_curAction); _point.SetAction(_curAction);
} }
} }
} }
} }
// Update the name under the mouse pointer // Update the name under the mouse pointer
m_itemName.SetMouseCoord(m_input.mousePos()); _itemName.SetMouseCoord(_input.mousePos());
if (!m_inter.Active() && !m_inv.MiniActive()) if (!_inter.Active() && !_inv.MiniActive())
CORO_INVOKE_4(m_itemName.DoFrame, m_bigBuf, m_loc, m_point, m_inv); CORO_INVOKE_4(_itemName.DoFrame, _bigBuf, _loc, _point, _inv);
} }
// Interface & Inventory // Interface & Inventory
m_inter.DoFrame(m_bigBuf, m_input.mousePos()); _inter.DoFrame(_bigBuf, _input.mousePos());
m_inv.DoFrame(m_bigBuf, m_point, m_input.mousePos(), (!m_tony.InAction() && !m_inter.Active() && m_bGUIInventory)); _inv.DoFrame(_bigBuf, _point, _input.mousePos(), (!_tony.InAction() && !_inter.Active() && _bGUIInventory));
} }
// Animate Tony // 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 // Update screen scrolling to keep Tony in focus
if (m_tony.MustUpdateScrolling() && m_bLocationLoaded) { if (_tony.MustUpdateScrolling() && _bLocationLoaded) {
RMPoint showThis = m_tony.Position(); RMPoint showThis = _tony.Position();
showThis.y -= 60; showThis.y -= 60;
m_loc.UpdateScrolling(showThis); _loc.UpdateScrolling(showThis);
} }
if (m_bLocationLoaded) if (_bLocationLoaded)
m_tony.SetScrollPosition(m_loc.ScrollPosition()); _tony.SetScrollPosition(_loc.ScrollPosition());
if ((!m_tony.InAction() && m_bInput) || m_bAlwaysDrawMouse) { if ((!_tony.InAction() && _bInput) || _bAlwaysDrawMouse) {
m_point.SetCoord(m_input.mousePos()); _point.SetCoord(_input.mousePos());
m_point.DoFrame(&m_bigBuf); _point.DoFrame(&_bigBuf);
} }
// ********************** // **********************
// Draw the list in the OT // Draw the list in the OT
// ********************** // **********************
CORO_INVOKE_0(m_bigBuf.DrawOT); CORO_INVOKE_0(_bigBuf.DrawOT);
#define FSTEP (480/32) #define FSTEP (480/32)
// Wipe // Wipe
if (m_bWiping) { if (_bWiping) {
switch (m_nWipeType) { switch (_nWipeType) {
case 1: case 1:
if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top >= FSTEP * 2)) { if (!(_rcWipeEllipse.bottom - _rcWipeEllipse.top >= FSTEP * 2)) {
CoroScheduler.setEvent(m_hWipeEvent); CoroScheduler.setEvent(_hWipeEvent);
m_nWipeType = 3; _nWipeType = 3;
break; break;
} }
m_rcWipeEllipse.top += FSTEP; _rcWipeEllipse.top += FSTEP;
m_rcWipeEllipse.left += FSTEP; _rcWipeEllipse.left += FSTEP;
m_rcWipeEllipse.right -= FSTEP; _rcWipeEllipse.right -= FSTEP;
m_rcWipeEllipse.bottom -= FSTEP; _rcWipeEllipse.bottom -= FSTEP;
break; break;
case 2: case 2:
if (!(m_rcWipeEllipse.bottom - m_rcWipeEllipse.top < 480 - FSTEP)) { if (!(_rcWipeEllipse.bottom - _rcWipeEllipse.top < 480 - FSTEP)) {
CoroScheduler.setEvent(m_hWipeEvent); CoroScheduler.setEvent(_hWipeEvent);
m_nWipeType = 3; _nWipeType = 3;
break; break;
} }
m_rcWipeEllipse.top -= FSTEP; _rcWipeEllipse.top -= FSTEP;
m_rcWipeEllipse.left -= FSTEP; _rcWipeEllipse.left -= FSTEP;
m_rcWipeEllipse.right += FSTEP; _rcWipeEllipse.right += FSTEP;
m_rcWipeEllipse.bottom += FSTEP; _rcWipeEllipse.bottom += FSTEP;
break; break;
} }
} }
g_system->unlockMutex(csMainLoop); g_system->unlockMutex(_csMainLoop);
CORO_END_CODE; CORO_END_CODE;
} }
void RMGfxEngine::InitCustomDll(void) { void RMGfxEngine::initCustomDll(void) {
SetupGlobalVars(&m_tony, &m_point, &_vm->_theBoxes, &m_loc, &m_inv, &m_input); 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; RMItem *item;
assert(GLOBALS.GfxEngine); assert(GLOBALS.GfxEngine);
if (GLOBALS.GfxEngine->m_bLocationLoaded) { if (GLOBALS.GfxEngine->_bLocationLoaded) {
item = GLOBALS.GfxEngine->m_loc.GetItemFromCode(dwItem); item = GLOBALS.GfxEngine->_loc.GetItemFromCode(dwItem);
if (item != NULL) { if (item != NULL) {
if (nPattern != -1) { if (nPattern != -1) {
if (GLOBALS.bPatIrqFreeze) 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) { if (start.x == -1 || start.y == -1) {
start.x = ptTonyStart.x - RM_SX / 2; start.x = ptTonyStart.x - RM_SX / 2;
start.y = ptTonyStart.y - RM_SY / 2; start.y = ptTonyStart.y - RM_SY / 2;
} }
m_loc.SetScrollPosition(start); _loc.SetScrollPosition(start);
if (ptTonyStart.x == 0 && ptTonyStart.y == 0) { if (ptTonyStart.x == 0 && ptTonyStart.y == 0) {
} else { } else {
m_tony.SetPosition(ptTonyStart, nLoc); _tony.SetPosition(ptTonyStart, nLoc);
m_tony.SetScrollPosition(start); _tony.SetScrollPosition(start);
} }
m_curAction = TA_GOTO; _curAction = TA_GOTO;
m_point.SetCustomPointer(NULL); _point.SetCustomPointer(NULL);
m_point.SetSpecialPointer(RMPointer::PTR_NONE); _point.SetSpecialPointer(RMPointer::PTR_NONE);
m_point.SetAction(m_curAction); _point.SetAction(_curAction);
m_inter.Reset(); _inter.Reset();
m_inv.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; bool bLoaded;
int i; int i;
m_nCurLoc = nLoc; _nCurLoc = nLoc;
bLoaded = false; bLoaded = false;
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
// Try the loading of the location // Try the loading of the location
RMRes res(m_nCurLoc); RMRes res(_nCurLoc);
if (!res.IsValid()) if (!res.IsValid())
continue; continue;
m_loc.Load(res); _loc.Load(res);
InitForNewLocation(nLoc, ptTonyStart, start); initForNewLocation(nLoc, ptTonyStart, start);
bLoaded = true; bLoaded = true;
break; break;
} }
@ -424,16 +424,16 @@ uint32 RMGfxEngine::LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start) {
if (!bLoaded) if (!bLoaded)
error("Location was not loaded"); error("Location was not loaded");
if (m_bOption) if (_bOption)
m_opt.ReInit(m_bigBuf); _opt.ReInit(_bigBuf);
m_bLocationLoaded = true; _bLocationLoaded = true;
// On entering the location // 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) { void RMGfxEngine::unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) {
CORO_BEGIN_CONTEXT; CORO_BEGIN_CONTEXT;
uint32 h; uint32 h;
CORO_END_CONTEXT(_ctx); CORO_END_CONTEXT(_ctx);
@ -441,21 +441,21 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) {
CORO_BEGIN_CODE(_ctx); CORO_BEGIN_CODE(_ctx);
// Release the location // Release the location
CORO_INVOKE_2(mpalEndIdlePoll, m_nCurLoc, NULL); CORO_INVOKE_2(mpalEndIdlePoll, _nCurLoc, NULL);
// On Exit? // On Exit?
if (bDoOnExit) { if (bDoOnExit) {
_ctx->h = mpalQueryDoAction(1, m_nCurLoc, 0); _ctx->h = mpalQueryDoAction(1, _nCurLoc, 0);
if (_ctx->h != CORO_INVALID_PID_VALUE) if (_ctx->h != CORO_INVALID_PID_VALUE)
CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE); CORO_INVOKE_2(CoroScheduler.waitForSingleObject, _ctx->h, CORO_INFINITE);
} }
MainFreeze(); MainFreeze();
m_bLocationLoaded = false; _bLocationLoaded = false;
m_bigBuf.ClearOT(); _bigBuf.ClearOT();
m_loc.Unload(); _loc.Unload();
if (result != NULL) if (result != NULL)
*result = CORO_INVALID_PID_VALUE; *result = CORO_INVALID_PID_VALUE;
@ -463,102 +463,100 @@ void RMGfxEngine::UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result) {
CORO_END_CODE; CORO_END_CODE;
} }
void RMGfxEngine::Init() { void RMGfxEngine::init() {
// Screen loading // Screen loading
RMResRaw *raw; RMResRaw *raw;
RMGfxSourceBuffer16 *load = NULL; RMGfxSourceBuffer16 *load = NULL;
INIT_GFX16_FROMRAW(20038, load); INIT_GFX16_FROMRAW(20038, load);
m_bigBuf.AddPrim(new RMGfxPrimitive(load)); _bigBuf.AddPrim(new RMGfxPrimitive(load));
m_bigBuf.DrawOT(Common::nullContext); _bigBuf.DrawOT(Common::nullContext);
m_bigBuf.ClearOT(); _bigBuf.ClearOT();
delete load; delete load;
_vm->_window.GetNewFrame(*this, NULL); _vm->_window.GetNewFrame(*this, NULL);
GLOBALS.bPatIrqFreeze = true; GLOBALS.bPatIrqFreeze = true;
// Activate GUI // Activate GUI
m_bGUIOption = true; _bGUIOption = true;
m_bGUIInterface = true; _bGUIInterface = true;
m_bGUIInventory = true; _bGUIInventory = true;
GLOBALS.bSkipSfxNoLoop = false; GLOBALS.bSkipSfxNoLoop = false;
m_bMustEnterMenu = false; _bMustEnterMenu = false;
GLOBALS.bIdleExited = false; GLOBALS.bIdleExited = false;
m_bOption = false; _bOption = false;
m_bWiping = false; _bWiping = false;
m_hWipeEvent = CoroScheduler.createEvent(false, false); _hWipeEvent = CoroScheduler.createEvent(false, false);
// Create the freeze event // Create the freeze event
csMainLoop = g_system->createMutex(); _csMainLoop = g_system->createMutex();
// Initialise the IRQ function for items for MPAL // Initialise the IRQ function for items for MPAL
GLOBALS.GfxEngine = this; GLOBALS.GfxEngine = this;
mpalInstallItemIrq(ItemIrq); mpalInstallItemIrq(itemIrq);
// Initialise the input // Initialise the input
m_input.init(); _input.init();
// Initialise the mouse pointer // Initialise the mouse pointer
m_point.Init(); _point.Init();
// Initialise Tony // Initialise Tony
m_tony.Init(); _tony.Init();
m_tony.LinkToBoxes(&_vm->_theBoxes); _tony.LinkToBoxes(&_vm->_theBoxes);
// Initialise the inventory and the interface // Initialise the inventory and the interface
m_inv.Init(); _inv.Init();
m_inter.Init(); _inter.Init();
// Download the location and set priorities @@@@@ // Download the location and set priorities @@@@@
m_bLocationLoaded = false; _bLocationLoaded = false;
EnableInput(); enableInput();
// Starting the game // Starting the game
m_tony.ExecuteAction(20, 1, 0); _tony.ExecuteAction(20, 1, 0);
} }
void RMGfxEngine::Close(void) { void RMGfxEngine::close(void) {
m_bigBuf.ClearOT(); _bigBuf.ClearOT();
m_inter.Close(); _inter.Close();
m_inv.Close(); _inv.Close();
m_tony.Close(); _tony.Close();
m_point.Close(); _point.Close();
m_input.close(); _input.close();
} }
void RMGfxEngine::SwitchFullscreen(bool bFull) { void RMGfxEngine::switchFullscreen(bool bFull) {
} }
void RMGfxEngine::GDIControl(bool bCon) { void RMGfxEngine::GDIControl(bool bCon) {
} }
void RMGfxEngine::EnableInput(void) { void RMGfxEngine::enableInput(void) {
m_bInput = true; _bInput = true;
} }
void RMGfxEngine::DisableInput(void) { void RMGfxEngine::disableInput(void) {
m_bInput = false; _bInput = false;
m_inter.Reset(); _inter.Reset();
} }
void RMGfxEngine::EnableMouse(void) { void RMGfxEngine::enableMouse(void) {
m_bAlwaysDrawMouse = true; _bAlwaysDrawMouse = true;
} }
void RMGfxEngine::DisableMouse(void) { void RMGfxEngine::disableMouse(void) {
m_bAlwaysDrawMouse = false; _bAlwaysDrawMouse = false;
} }
void RMGfxEngine::Freeze(void) { void RMGfxEngine::freeze(void) {
g_system->lockMutex(csMainLoop); g_system->lockMutex(_csMainLoop);
} }
void RMGfxEngine::Unfreeze(void) { void RMGfxEngine::unfreeze(void) {
g_system->unlockMutex(csMainLoop); g_system->unlockMutex(_csMainLoop);
} }
void CharsSaveAll(Common::OutSaveFile *f); void CharsSaveAll(Common::OutSaveFile *f);
@ -574,14 +572,14 @@ void LoadMusic(Common::InSaveFile *f);
#define TONY_SAVEGAME_VERSION 8 #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; Common::OutSaveFile *f;
byte *state; byte *state;
uint thumbsize; uint thumbsize;
uint size; uint size;
int i; int i;
char buf[4]; char buf[4];
RMPoint tp = m_tony.Position(); RMPoint tp = _tony.Position();
// Saving: MPAL variables, current location, and Tony inventory 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()); i = strlen(name.c_str());
f->writeByte(i); f->writeByte(i);
f->write(name.c_str(), i); f->write(name.c_str(), i);
f->writeUint32LE(m_nCurLoc); f->writeUint32LE(_nCurLoc);
f->writeUint32LE(tp.x); f->writeUint32LE(tp.x);
f->writeUint32LE(tp.y); f->writeUint32LE(tp.y);
@ -621,9 +619,9 @@ void RMGfxEngine::SaveState(const Common::String &fn, byte *curThumb, const Comm
delete[] state; delete[] state;
// Inventory // Inventory
size = m_inv.GetSaveStateSize(); size = _inv.GetSaveStateSize();
state = new byte[size]; state = new byte[size];
m_inv.SaveState(state); _inv.SaveState(state);
f->writeUint32LE(size); f->writeUint32LE(size);
f->write(state, size); f->write(state, size);
delete[] state; delete[] state;
@ -640,9 +638,9 @@ void RMGfxEngine::SaveState(const Common::String &fn, byte *curThumb, const Comm
bool bStat; bool bStat;
// Saves the state of the shepherdess and show yourself // Saves the state of the shepherdess and show yourself
bStat = m_tony.GetPastorella(); bStat = _tony.GetPastorella();
f->writeByte(bStat); f->writeByte(bStat);
bStat = m_inter.GetPalesati(); bStat = _inter.GetPalesati();
f->writeByte(bStat); f->writeByte(bStat);
// Save the chars // Save the chars
@ -677,7 +675,7 @@ void RMGfxEngine::SaveState(const Common::String &fn, byte *curThumb, const Comm
delete f; 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 // PROBLEM: You should change the location in a separate process to do the OnEnter
CORO_BEGIN_CONTEXT; CORO_BEGIN_CONTEXT;
Common::InSaveFile *f; Common::InSaveFile *f;
@ -760,7 +758,7 @@ void RMGfxEngine::LoadState(CORO_PARAM, const Common::String &fn) {
_ctx->size = _ctx->f->readUint32LE(); _ctx->size = _ctx->f->readUint32LE();
_ctx->state = new byte[_ctx->size]; _ctx->state = new byte[_ctx->size];
_ctx->f->read(_ctx->state, _ctx->size); _ctx->f->read(_ctx->state, _ctx->size);
m_inv.LoadState(_ctx->state); _inv.LoadState(_ctx->state);
delete[] _ctx->state; delete[] _ctx->state;
if (_ctx->ver >= 0x2) { // Versione 2: box please if (_ctx->ver >= 0x2) { // Versione 2: box please
@ -776,9 +774,9 @@ void RMGfxEngine::LoadState(CORO_PARAM, const Common::String &fn) {
bool bStat = false; bool bStat = false;
bStat = _ctx->f->readByte(); bStat = _ctx->f->readByte();
m_tony.SetPastorella(bStat); _tony.SetPastorella(bStat);
bStat = _ctx->f->readByte(); bStat = _ctx->f->readByte();
m_inter.SetPalesati(bStat); _inter.SetPalesati(bStat);
CharsLoadAll(_ctx->f); CharsLoadAll(_ctx->f);
} }
@ -813,9 +811,9 @@ void RMGfxEngine::LoadState(CORO_PARAM, const Common::String &fn) {
delete _ctx->f; delete _ctx->f;
CORO_INVOKE_2(UnloadLocation, false, NULL); 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); _tony.SetPattern(RMTony::PAT_STANDRIGHT);
MainUnfreeze(); MainUnfreeze();
// On older versions, need to an enter action // 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); CORO_INVOKE_0(RestoreMusic);
m_bGUIInterface = true; _bGUIInterface = true;
m_bGUIInventory = true; _bGUIInventory = true;
m_bGUIOption = true; _bGUIOption = true;
CORO_END_CODE; CORO_END_CODE;
} }
void RMGfxEngine::PauseSound(bool bPause) { void RMGfxEngine::pauseSound(bool bPause) {
if (m_bLocationLoaded) if (_bLocationLoaded)
m_loc.PauseSound(bPause); _loc.PauseSound(bPause);
} }
void RMGfxEngine::InitWipe(int type) { void RMGfxEngine::initWipe(int type) {
m_bWiping = true; _bWiping = true;
m_nWipeType = type; _nWipeType = type;
m_nWipeStep = 0; _nWipeStep = 0;
if (m_nWipeType == 1) if (_nWipeType == 1)
m_rcWipeEllipse = Common::Rect(80, 0, 640 - 80, 480); _rcWipeEllipse = Common::Rect(80, 0, 640 - 80, 480);
else if (m_nWipeType == 2) else if (_nWipeType == 2)
m_rcWipeEllipse = Common::Rect(320 - FSTEP, 240 - FSTEP, 320 + FSTEP, 240 + FSTEP); _rcWipeEllipse = Common::Rect(320 - FSTEP, 240 - FSTEP, 320 + FSTEP, 240 + FSTEP);
} }
void RMGfxEngine::CloseWipe(void) { void RMGfxEngine::closeWipe(void) {
m_bWiping = false; _bWiping = false;
} }
void RMGfxEngine::WaitWipeEnd(CORO_PARAM) { void RMGfxEngine::waitWipeEnd(CORO_PARAM) {
CoroScheduler.waitForSingleObject(coroParam, m_hWipeEvent, CORO_INFINITE); CoroScheduler.waitForSingleObject(coroParam, _hWipeEvent, CORO_INFINITE);
} }
bool RMGfxEngine::CanLoadSave() { bool RMGfxEngine::canLoadSave() {
return m_bInput && !m_tony.InAction() && !_vm->getIsDemo(); return _bInput && !_tony.InAction() && !_vm->getIsDemo();
} }
} // End of namespace Tony } // End of namespace Tony

View file

@ -44,110 +44,110 @@ namespace Tony {
class RMGfxEngine { class RMGfxEngine {
private: private:
RMGfxTargetBuffer m_bigBuf; RMGfxTargetBuffer _bigBuf;
RMInput m_input; RMInput _input;
RMPointer m_point; RMPointer _point;
RMLocation m_loc; RMLocation _loc;
RMOptionScreen m_opt; RMOptionScreen _opt;
RMTony m_tony; RMTony _tony;
RMInventory m_inv; RMInventory _inv;
RMInterface m_inter; RMInterface _inter;
RMTextItemName m_itemName; RMTextItemName _itemName;
bool m_bOption; bool _bOption;
bool m_bLocationLoaded; bool _bLocationLoaded;
bool m_bInput; bool _bInput;
bool m_bAlwaysDrawMouse; bool _bAlwaysDrawMouse;
int m_nCurLoc; int _nCurLoc;
RMTonyAction m_curAction; RMTonyAction _curAction;
int m_curActionObj; int _curActionObj;
OSystem::MutexRef csMainLoop; OSystem::MutexRef _csMainLoop;
int m_nWipeType; int _nWipeType;
uint32 m_hWipeEvent; uint32 _hWipeEvent;
int m_nWipeStep; int _nWipeStep;
bool m_bMustEnterMenu; bool _bMustEnterMenu;
protected: protected:
static void ItemIrq(uint32 dwItem, int nPattern, int nStatus); static void itemIrq(uint32 dwItem, int nPattern, int nStatus);
void InitForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start); void initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
public: public:
bool m_bWiping; bool _bWiping;
Common::Rect m_rcWipeEllipse; Common::Rect _rcWipeEllipse;
bool m_bGUIOption; bool _bGUIOption;
bool m_bGUIInterface; bool _bGUIInterface;
bool m_bGUIInventory; bool _bGUIInventory;
public: public:
RMGfxEngine(); RMGfxEngine();
virtual ~RMGfxEngine(); virtual ~RMGfxEngine();
// Draw the next frame // Draw the next frame
void DoFrame(CORO_PARAM, bool bDrawLocation); void doFrame(CORO_PARAM, bool bDrawLocation);
// Initialises the graphics engine // Initialises the graphics engine
void Init(); void init();
// Closes the graphics engine // Closes the graphics engine
void Close(void); void close(void);
// Warns when changing // Warns when changing
void SwitchFullscreen(bool bFull); void switchFullscreen(bool bFull);
// Warn that we are guided by the GDI // Warn that we are guided by the GDI
void GDIControl(bool bCon); void GDIControl(bool bCon);
// Warns when entering or exits the options menu // Warns when entering or exits the options menu
void OpenOptionScreen(CORO_PARAM, int type); void openOptionScreen(CORO_PARAM, int type);
// Enables or disables mouse input // Enables or disables mouse input
void EnableInput(void); void enableInput(void);
void DisableInput(void); void disableInput(void);
// Enables and disables mouse draw // Enables and disables mouse draw
void EnableMouse(void); void enableMouse(void);
void DisableMouse(void); void disableMouse(void);
operator byte *() { operator byte *() {
return (byte *)m_bigBuf; return (byte *)_bigBuf;
} }
RMInput &GetInput() { RMInput &getInput() {
return m_input; return _input;
} }
// Link to the custom function list // Link to the custom function list
void InitCustomDll(void); void initCustomDll(void);
// Link to graphic task // Link to graphic task
void LinkGraphicTask(RMGfxTask *task) { void linkGraphicTask(RMGfxTask *task) {
m_bigBuf.AddPrim(new RMGfxPrimitive(task)); _bigBuf.AddPrim(new RMGfxPrimitive(task));
}; };
// Manage a location // Manage a location
uint32 LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start); uint32 loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
void UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result); void unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result);
// Freeze and unfreeze // Freeze and unfreeze
void Freeze(void); void freeze(void);
void Unfreeze(void); void unfreeze(void);
// State management // State management
void SaveState(const Common::String &fn, byte *curThumb, const Common::String &name); void saveState(const Common::String &fn, byte *curThumb, const Common::String &name);
void LoadState(CORO_PARAM, const Common::String &fn); void loadState(CORO_PARAM, const Common::String &fn);
// Pauses sound // Pauses sound
void PauseSound(bool bPause); void pauseSound(bool bPause);
// Wipe // Wipe
void InitWipe(int type); void initWipe(int type);
void CloseWipe(void); void closeWipe(void);
void WaitWipeEnd(CORO_PARAM); void waitWipeEnd(CORO_PARAM);
void SetPalesati(bool bpal) { void setPalesati(bool bpal) {
m_inter.SetPalesati(bpal); _inter.SetPalesati(bpal);
} }
bool CanLoadSave(); bool canLoadSave();
}; };
} // End of namespace Tony } // End of namespace Tony

View file

@ -530,7 +530,7 @@ void RMInventory::DoFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
g_system->unlockMutex(m_csModifyInterface); g_system->unlockMutex(m_csModifyInterface);
} }
if (_vm->getEngine()->GetInput().getAsyncKeyState(Common::KEYCODE_i)) { if (_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_i)) {
GLOBALS.bCfgInvLocked = !GLOBALS.bCfgInvLocked; GLOBALS.bCfgInvLocked = !GLOBALS.bCfgInvLocked;
} }

View file

@ -140,8 +140,8 @@ Common::ErrorCode TonyEngine::init() {
_theBoxes.Init(); _theBoxes.Init();
// Link to the custom graphics engine // Link to the custom graphics engine
_theEngine.InitCustomDll(); _theEngine.initCustomDll();
_theEngine.Init(); _theEngine.init();
// Allocate space for thumbnails when saving the game // Allocate space for thumbnails when saving the game
_curThumbnail = new uint16[160 * 120]; _curThumbnail = new uint16[160 * 120];
@ -406,7 +406,7 @@ void TonyEngine::autoSave(CORO_PARAM) {
CORO_INVOKE_0(MainWaitFrame); CORO_INVOKE_0(MainWaitFrame);
MainFreeze(); MainFreeze();
_ctx->buf = getSaveStateFileName(0); _ctx->buf = getSaveStateFileName(0);
_theEngine.SaveState(_ctx->buf, (byte *)_curThumbnail, "Autosave"); _theEngine.saveState(_ctx->buf, (byte *)_curThumbnail, "Autosave");
MainUnfreeze(); MainUnfreeze();
CORO_END_CODE; CORO_END_CODE;
@ -415,7 +415,7 @@ void TonyEngine::autoSave(CORO_PARAM) {
void TonyEngine::saveState(int n, const char *name) { void TonyEngine::saveState(int n, const char *name) {
Common::String buf = getSaveStateFileName(n); Common::String buf = getSaveStateFileName(n);
_theEngine.SaveState(buf.c_str(), (byte *)_curThumbnail, name); _theEngine.saveState(buf.c_str(), (byte *)_curThumbnail, name);
} }
@ -427,7 +427,7 @@ void TonyEngine::loadState(CORO_PARAM, int n) {
CORO_BEGIN_CODE(_ctx); CORO_BEGIN_CODE(_ctx);
_ctx->buf = getSaveStateFileName(n); _ctx->buf = getSaveStateFileName(n);
CORO_INVOKE_1(_theEngine.LoadState, _ctx->buf.c_str()); CORO_INVOKE_1(_theEngine.loadState, _ctx->buf.c_str());
CORO_END_CODE; CORO_END_CODE;
} }
@ -484,11 +484,11 @@ void TonyEngine::optionScreen(void) {
} }
void TonyEngine::openInitLoadMenu(CORO_PARAM) { void TonyEngine::openInitLoadMenu(CORO_PARAM) {
_theEngine.OpenOptionScreen(coroParam, 1); _theEngine.openOptionScreen(coroParam, 1);
} }
void TonyEngine::openInitOptions(CORO_PARAM) { void TonyEngine::openInitOptions(CORO_PARAM) {
_theEngine.OpenOptionScreen(coroParam, 2); _theEngine.openOptionScreen(coroParam, 2);
} }
void TonyEngine::abortGame(void) { void TonyEngine::abortGame(void) {
@ -517,7 +517,7 @@ void TonyEngine::playProcess(CORO_PARAM, const void *param) {
// If a savegame needs to be loaded, then do so // If a savegame needs to be loaded, then do so
if (_vm->_loadSlotNumber != -1 && GLOBALS.GfxEngine != NULL) { if (_vm->_loadSlotNumber != -1 && GLOBALS.GfxEngine != NULL) {
_ctx->fn = getSaveStateFileName(_vm->_loadSlotNumber); _ctx->fn = getSaveStateFileName(_vm->_loadSlotNumber);
CORO_INVOKE_1(GLOBALS.GfxEngine->LoadState, _ctx->fn); CORO_INVOKE_1(GLOBALS.GfxEngine->loadState, _ctx->fn);
_vm->_loadSlotNumber = -1; _vm->_loadSlotNumber = -1;
} }
@ -525,17 +525,17 @@ void TonyEngine::playProcess(CORO_PARAM, const void *param) {
CORO_INVOKE_1(CoroScheduler.sleep, 50); CORO_INVOKE_1(CoroScheduler.sleep, 50);
// Call the engine to handle the next frame // Call the engine to handle the next frame
CORO_INVOKE_1(_vm->_theEngine.DoFrame, _vm->_bDrawLocation); CORO_INVOKE_1(_vm->_theEngine.doFrame, _vm->_bDrawLocation);
// Warns that a frame is finished // Warns that a frame is finished
CoroScheduler.pulseEvent(_vm->_hEndOfFrame); CoroScheduler.pulseEvent(_vm->_hEndOfFrame);
// Handle drawing the frame // Handle drawing the frame
if (!_vm->_bPaused) { if (!_vm->_bPaused) {
if (!_vm->_theEngine.m_bWiping) if (!_vm->_theEngine._bWiping)
_vm->_window.GetNewFrame(_vm->_theEngine, NULL); _vm->_window.GetNewFrame(_vm->_theEngine, NULL);
else else
_vm->_window.GetNewFrame(_vm->_theEngine, &_vm->_theEngine.m_rcWipeEllipse); _vm->_window.GetNewFrame(_vm->_theEngine, &_vm->_theEngine._rcWipeEllipse);
} }
// Paint the frame onto the screen // Paint the frame onto the screen
@ -569,14 +569,14 @@ void TonyEngine::close(void) {
closeMusic(); closeMusic();
CoroScheduler.closeEvent(_hEndOfFrame); CoroScheduler.closeEvent(_hEndOfFrame);
_theBoxes.Close(); _theBoxes.Close();
_theEngine.Close(); _theEngine.close();
_window.Close(); _window.Close();
delete[] _curThumbnail; delete[] _curThumbnail;
} }
void TonyEngine::switchFullscreen(bool bFull) { void TonyEngine::switchFullscreen(bool bFull) {
_window.SwitchFullscreen(bFull); _window.SwitchFullscreen(bFull);
_theEngine.SwitchFullscreen(bFull); _theEngine.switchFullscreen(bFull);
} }
void TonyEngine::GDIControl(bool bCon) { void TonyEngine::GDIControl(bool bCon) {
@ -601,10 +601,10 @@ uint32 TonyEngine::getTime() {
} }
bool TonyEngine::canLoadGameStateCurrently() { bool TonyEngine::canLoadGameStateCurrently() {
return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->CanLoadSave(); return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->canLoadSave();
} }
bool TonyEngine::canSaveGameStateCurrently() { bool TonyEngine::canSaveGameStateCurrently() {
return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->CanLoadSave(); return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->canLoadSave();
} }
Common::Error TonyEngine::loadGameState(int slot) { Common::Error TonyEngine::loadGameState(int slot) {
@ -619,7 +619,7 @@ Common::Error TonyEngine::saveGameState(int slot, const Common::String &desc) {
RMSnapshot s; RMSnapshot s;
s.GrabScreenshot(*GLOBALS.GfxEngine, 4, _curThumbnail); s.GrabScreenshot(*GLOBALS.GfxEngine, 4, _curThumbnail);
GLOBALS.GfxEngine->SaveState(getSaveStateFileName(slot), (byte *)_curThumbnail, desc); GLOBALS.GfxEngine->saveState(getSaveStateFileName(slot), (byte *)_curThumbnail, desc);
return Common::kNoError; return Common::kNoError;
} }