TONY: Rename variables and functions in gfxengine.h
This commit is contained in:
parent
014330a538
commit
a5cb751f7a
8 changed files with 345 additions and 347 deletions
|
@ -2363,7 +2363,7 @@ DECLARE_CUSTOM_FUNCTION(DoCredits)(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint3
|
|||
CORO_INVOKE_0(GLOBALS.WaitFrame);
|
||||
if (GLOBALS.Input->mouseLeftClicked() || GLOBALS.Input->mouseRightClicked())
|
||||
break;
|
||||
if (_vm->getEngine()->GetInput().getAsyncKeyState(Common::KEYCODE_TAB))
|
||||
if (_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_TAB))
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2531,7 +2531,7 @@ ASSIGN(201, MustSkipIdleEnd);
|
|||
|
||||
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.Pointer = ptr;
|
||||
GLOBALS.Boxes = box;
|
||||
|
|
|
@ -72,7 +72,7 @@ class RMInventory;
|
|||
class RMInput;
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -2086,7 +2086,7 @@ void RMTextDialog::RemoveThis(CORO_PARAM, bool &result) {
|
|||
}
|
||||
|
||||
if (!m_bNoTab) {
|
||||
if (_vm->getEngine()->GetInput().getAsyncKeyState(Common::KEYCODE_TAB))
|
||||
if (_vm->getEngine()->getInput().getAsyncKeyState(Common::KEYCODE_TAB))
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,23 +47,23 @@ using namespace MPAL;
|
|||
/****************************************/
|
||||
|
||||
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) {
|
||||
_vm->getEngine()->UnloadLocation(coroParam, bDoOnExit, result);
|
||||
_vm->getEngine()->unloadLocation(coroParam, bDoOnExit, result);
|
||||
}
|
||||
|
||||
void MainLinkGraphicTask(RMGfxTask *task) {
|
||||
_vm->getEngine()->LinkGraphicTask(task);
|
||||
_vm->getEngine()->linkGraphicTask(task);
|
||||
}
|
||||
|
||||
void MainFreeze(void) {
|
||||
_vm->getEngine()->Freeze();
|
||||
_vm->getEngine()->freeze();
|
||||
}
|
||||
|
||||
void MainUnfreeze(void) {
|
||||
_vm->getEngine()->Unfreeze();
|
||||
_vm->getEngine()->unfreeze();
|
||||
}
|
||||
|
||||
void MainWaitFrame(CORO_PARAM) {
|
||||
|
@ -71,11 +71,11 @@ void MainWaitFrame(CORO_PARAM) {
|
|||
}
|
||||
|
||||
void MainShowMouse(void) {
|
||||
_vm->getEngine()->EnableMouse();
|
||||
_vm->getEngine()->enableMouse();
|
||||
}
|
||||
|
||||
void MainHideMouse(void) {
|
||||
_vm->getEngine()->DisableMouse();
|
||||
_vm->getEngine()->disableMouse();
|
||||
}
|
||||
|
||||
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) {
|
||||
_vm->getEngine()->DisableInput();
|
||||
_vm->getEngine()->disableInput();
|
||||
}
|
||||
|
||||
void MainEnableInput(void) {
|
||||
_vm->getEngine()->EnableInput();
|
||||
_vm->getEngine()->enableInput();
|
||||
}
|
||||
|
||||
void MainInitWipe(int type) {
|
||||
_vm->getEngine()->InitWipe(type);
|
||||
_vm->getEngine()->initWipe(type);
|
||||
}
|
||||
|
||||
void MainCloseWipe(void) {
|
||||
_vm->getEngine()->CloseWipe();
|
||||
_vm->getEngine()->closeWipe();
|
||||
}
|
||||
|
||||
void MainWaitWipeEnd(CORO_PARAM) {
|
||||
_vm->getEngine()->WaitWipeEnd(coroParam);
|
||||
_vm->getEngine()->waitWipeEnd(coroParam);
|
||||
}
|
||||
|
||||
void MainEnableGUI(void) {
|
||||
_vm->getEngine()->m_bGUIInterface = true;
|
||||
_vm->getEngine()->m_bGUIInventory = true;
|
||||
_vm->getEngine()->m_bGUIOption = true;
|
||||
_vm->getEngine()->_bGUIInterface = true;
|
||||
_vm->getEngine()->_bGUIInventory = true;
|
||||
_vm->getEngine()->_bGUIOption = true;
|
||||
}
|
||||
|
||||
void MainDisableGUI(void) {
|
||||
_vm->getEngine()->m_bGUIInterface = false;
|
||||
_vm->getEngine()->m_bGUIInventory = false;
|
||||
_vm->getEngine()->m_bGUIOption = false;
|
||||
_vm->getEngine()->_bGUIInterface = false;
|
||||
_vm->getEngine()->_bGUIInventory = false;
|
||||
_vm->getEngine()->_bGUIOption = false;
|
||||
}
|
||||
|
||||
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)) { \
|
||||
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 **************/
|
||||
if (m_bEditSaveName) {
|
||||
|
|
|
@ -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);
|
||||
_bigBuf.Create(RM_BBX, RM_BBY, 16);
|
||||
_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;
|
||||
_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);
|
||||
if (_input.mouseRightReleased()) {
|
||||
if (_bGUIInterface) {
|
||||
if (_inter.Released(_input.mousePos(), _curAction)) {
|
||||
_point.SetAction(_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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
|
|
|
@ -44,110 +44,110 @@ namespace Tony {
|
|||
|
||||
class RMGfxEngine {
|
||||
private:
|
||||
RMGfxTargetBuffer m_bigBuf;
|
||||
RMInput m_input;
|
||||
RMPointer m_point;
|
||||
RMLocation m_loc;
|
||||
RMOptionScreen m_opt;
|
||||
RMTony m_tony;
|
||||
RMInventory m_inv;
|
||||
RMInterface m_inter;
|
||||
RMTextItemName m_itemName;
|
||||
RMGfxTargetBuffer _bigBuf;
|
||||
RMInput _input;
|
||||
RMPointer _point;
|
||||
RMLocation _loc;
|
||||
RMOptionScreen _opt;
|
||||
RMTony _tony;
|
||||
RMInventory _inv;
|
||||
RMInterface _inter;
|
||||
RMTextItemName _itemName;
|
||||
|
||||
bool m_bOption;
|
||||
bool m_bLocationLoaded;
|
||||
bool _bOption;
|
||||
bool _bLocationLoaded;
|
||||
|
||||
bool m_bInput;
|
||||
bool m_bAlwaysDrawMouse;
|
||||
bool _bInput;
|
||||
bool _bAlwaysDrawMouse;
|
||||
|
||||
int m_nCurLoc;
|
||||
RMTonyAction m_curAction;
|
||||
int m_curActionObj;
|
||||
OSystem::MutexRef csMainLoop;
|
||||
int _nCurLoc;
|
||||
RMTonyAction _curAction;
|
||||
int _curActionObj;
|
||||
OSystem::MutexRef _csMainLoop;
|
||||
|
||||
int m_nWipeType;
|
||||
uint32 m_hWipeEvent;
|
||||
int m_nWipeStep;
|
||||
int _nWipeType;
|
||||
uint32 _hWipeEvent;
|
||||
int _nWipeStep;
|
||||
|
||||
bool m_bMustEnterMenu;
|
||||
bool _bMustEnterMenu;
|
||||
protected:
|
||||
static void ItemIrq(uint32 dwItem, int nPattern, int nStatus);
|
||||
void InitForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
|
||||
static void itemIrq(uint32 dwItem, int nPattern, int nStatus);
|
||||
void initForNewLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
|
||||
public:
|
||||
bool m_bWiping;
|
||||
Common::Rect m_rcWipeEllipse;
|
||||
bool m_bGUIOption;
|
||||
bool m_bGUIInterface;
|
||||
bool m_bGUIInventory;
|
||||
bool _bWiping;
|
||||
Common::Rect _rcWipeEllipse;
|
||||
bool _bGUIOption;
|
||||
bool _bGUIInterface;
|
||||
bool _bGUIInventory;
|
||||
public:
|
||||
RMGfxEngine();
|
||||
virtual ~RMGfxEngine();
|
||||
|
||||
// Draw the next frame
|
||||
void DoFrame(CORO_PARAM, bool bDrawLocation);
|
||||
void doFrame(CORO_PARAM, bool bDrawLocation);
|
||||
|
||||
// Initialises the graphics engine
|
||||
void Init();
|
||||
void init();
|
||||
|
||||
// Closes the graphics engine
|
||||
void Close(void);
|
||||
void close(void);
|
||||
|
||||
// Warns when changing
|
||||
void SwitchFullscreen(bool bFull);
|
||||
void switchFullscreen(bool bFull);
|
||||
|
||||
// Warn that we are guided by the GDI
|
||||
void GDIControl(bool bCon);
|
||||
|
||||
// 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
|
||||
void EnableInput(void);
|
||||
void DisableInput(void);
|
||||
void enableInput(void);
|
||||
void disableInput(void);
|
||||
|
||||
// Enables and disables mouse draw
|
||||
void EnableMouse(void);
|
||||
void DisableMouse(void);
|
||||
void enableMouse(void);
|
||||
void disableMouse(void);
|
||||
|
||||
operator byte *() {
|
||||
return (byte *)m_bigBuf;
|
||||
return (byte *)_bigBuf;
|
||||
}
|
||||
RMInput &GetInput() {
|
||||
return m_input;
|
||||
RMInput &getInput() {
|
||||
return _input;
|
||||
}
|
||||
|
||||
// Link to the custom function list
|
||||
void InitCustomDll(void);
|
||||
void initCustomDll(void);
|
||||
|
||||
// Link to graphic task
|
||||
void LinkGraphicTask(RMGfxTask *task) {
|
||||
m_bigBuf.AddPrim(new RMGfxPrimitive(task));
|
||||
void linkGraphicTask(RMGfxTask *task) {
|
||||
_bigBuf.AddPrim(new RMGfxPrimitive(task));
|
||||
};
|
||||
|
||||
// Manage a location
|
||||
uint32 LoadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
|
||||
void UnloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result);
|
||||
uint32 loadLocation(int nLoc, RMPoint ptTonyStart, RMPoint start);
|
||||
void unloadLocation(CORO_PARAM, bool bDoOnExit, uint32 *result);
|
||||
|
||||
// Freeze and unfreeze
|
||||
void Freeze(void);
|
||||
void Unfreeze(void);
|
||||
void freeze(void);
|
||||
void unfreeze(void);
|
||||
|
||||
// State management
|
||||
void SaveState(const Common::String &fn, byte *curThumb, const Common::String &name);
|
||||
void LoadState(CORO_PARAM, const Common::String &fn);
|
||||
void saveState(const Common::String &fn, byte *curThumb, const Common::String &name);
|
||||
void loadState(CORO_PARAM, const Common::String &fn);
|
||||
|
||||
// Pauses sound
|
||||
void PauseSound(bool bPause);
|
||||
void pauseSound(bool bPause);
|
||||
|
||||
// Wipe
|
||||
void InitWipe(int type);
|
||||
void CloseWipe(void);
|
||||
void WaitWipeEnd(CORO_PARAM);
|
||||
void initWipe(int type);
|
||||
void closeWipe(void);
|
||||
void waitWipeEnd(CORO_PARAM);
|
||||
|
||||
void SetPalesati(bool bpal) {
|
||||
m_inter.SetPalesati(bpal);
|
||||
void setPalesati(bool bpal) {
|
||||
_inter.SetPalesati(bpal);
|
||||
}
|
||||
bool CanLoadSave();
|
||||
bool canLoadSave();
|
||||
};
|
||||
|
||||
} // End of namespace Tony
|
||||
|
|
|
@ -530,7 +530,7 @@ void RMInventory::DoFrame(RMGfxTargetBuffer &bigBuf, RMPointer &ptr, RMPoint mpo
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -140,8 +140,8 @@ Common::ErrorCode TonyEngine::init() {
|
|||
_theBoxes.Init();
|
||||
|
||||
// Link to the custom graphics engine
|
||||
_theEngine.InitCustomDll();
|
||||
_theEngine.Init();
|
||||
_theEngine.initCustomDll();
|
||||
_theEngine.init();
|
||||
|
||||
// Allocate space for thumbnails when saving the game
|
||||
_curThumbnail = new uint16[160 * 120];
|
||||
|
@ -406,7 +406,7 @@ void TonyEngine::autoSave(CORO_PARAM) {
|
|||
CORO_INVOKE_0(MainWaitFrame);
|
||||
MainFreeze();
|
||||
_ctx->buf = getSaveStateFileName(0);
|
||||
_theEngine.SaveState(_ctx->buf, (byte *)_curThumbnail, "Autosave");
|
||||
_theEngine.saveState(_ctx->buf, (byte *)_curThumbnail, "Autosave");
|
||||
MainUnfreeze();
|
||||
|
||||
CORO_END_CODE;
|
||||
|
@ -415,7 +415,7 @@ void TonyEngine::autoSave(CORO_PARAM) {
|
|||
|
||||
void TonyEngine::saveState(int n, const char *name) {
|
||||
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);
|
||||
|
||||
_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;
|
||||
}
|
||||
|
@ -484,11 +484,11 @@ void TonyEngine::optionScreen(void) {
|
|||
}
|
||||
|
||||
void TonyEngine::openInitLoadMenu(CORO_PARAM) {
|
||||
_theEngine.OpenOptionScreen(coroParam, 1);
|
||||
_theEngine.openOptionScreen(coroParam, 1);
|
||||
}
|
||||
|
||||
void TonyEngine::openInitOptions(CORO_PARAM) {
|
||||
_theEngine.OpenOptionScreen(coroParam, 2);
|
||||
_theEngine.openOptionScreen(coroParam, 2);
|
||||
}
|
||||
|
||||
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 (_vm->_loadSlotNumber != -1 && GLOBALS.GfxEngine != NULL) {
|
||||
_ctx->fn = getSaveStateFileName(_vm->_loadSlotNumber);
|
||||
CORO_INVOKE_1(GLOBALS.GfxEngine->LoadState, _ctx->fn);
|
||||
CORO_INVOKE_1(GLOBALS.GfxEngine->loadState, _ctx->fn);
|
||||
_vm->_loadSlotNumber = -1;
|
||||
}
|
||||
|
||||
|
@ -525,17 +525,17 @@ void TonyEngine::playProcess(CORO_PARAM, const void *param) {
|
|||
CORO_INVOKE_1(CoroScheduler.sleep, 50);
|
||||
|
||||
// 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
|
||||
CoroScheduler.pulseEvent(_vm->_hEndOfFrame);
|
||||
|
||||
// Handle drawing the frame
|
||||
if (!_vm->_bPaused) {
|
||||
if (!_vm->_theEngine.m_bWiping)
|
||||
if (!_vm->_theEngine._bWiping)
|
||||
_vm->_window.GetNewFrame(_vm->_theEngine, NULL);
|
||||
else
|
||||
_vm->_window.GetNewFrame(_vm->_theEngine, &_vm->_theEngine.m_rcWipeEllipse);
|
||||
_vm->_window.GetNewFrame(_vm->_theEngine, &_vm->_theEngine._rcWipeEllipse);
|
||||
}
|
||||
|
||||
// Paint the frame onto the screen
|
||||
|
@ -569,14 +569,14 @@ void TonyEngine::close(void) {
|
|||
closeMusic();
|
||||
CoroScheduler.closeEvent(_hEndOfFrame);
|
||||
_theBoxes.Close();
|
||||
_theEngine.Close();
|
||||
_theEngine.close();
|
||||
_window.Close();
|
||||
delete[] _curThumbnail;
|
||||
}
|
||||
|
||||
void TonyEngine::switchFullscreen(bool bFull) {
|
||||
_window.SwitchFullscreen(bFull);
|
||||
_theEngine.SwitchFullscreen(bFull);
|
||||
_theEngine.switchFullscreen(bFull);
|
||||
}
|
||||
|
||||
void TonyEngine::GDIControl(bool bCon) {
|
||||
|
@ -601,10 +601,10 @@ uint32 TonyEngine::getTime() {
|
|||
}
|
||||
|
||||
bool TonyEngine::canLoadGameStateCurrently() {
|
||||
return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->CanLoadSave();
|
||||
return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->canLoadSave();
|
||||
}
|
||||
bool TonyEngine::canSaveGameStateCurrently() {
|
||||
return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->CanLoadSave();
|
||||
return GLOBALS.GfxEngine != NULL && GLOBALS.GfxEngine->canLoadSave();
|
||||
}
|
||||
|
||||
Common::Error TonyEngine::loadGameState(int slot) {
|
||||
|
@ -619,7 +619,7 @@ Common::Error TonyEngine::saveGameState(int slot, const Common::String &desc) {
|
|||
RMSnapshot s;
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue