TONY: Rename variables and functions in input.h

This commit is contained in:
Strangerke 2012-06-05 00:02:15 +02:00
parent 7b547a78cc
commit 014330a538
7 changed files with 55 additions and 55 deletions

View file

@ -2020,10 +2020,10 @@ DECLARE_CUSTOM_FUNCTION(StartDialog)(CORO_PARAM, uint32 nDialog, uint32 nStartGr
GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_NONE); GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_NONE);
MainShowMouse(); MainShowMouse();
while (!(GLOBALS.Input->MouseLeftClicked() && ((_ctx->sel = _ctx->dc.GetSelection()) != -1))) { while (!(GLOBALS.Input->mouseLeftClicked() && ((_ctx->sel = _ctx->dc.GetSelection()) != -1))) {
CORO_INVOKE_0(GLOBALS.WaitFrame); CORO_INVOKE_0(GLOBALS.WaitFrame);
GLOBALS.Freeze(); GLOBALS.Freeze();
CORO_INVOKE_1(_ctx->dc.DoFrame, GLOBALS.Input->MousePos()); CORO_INVOKE_1(_ctx->dc.DoFrame, GLOBALS.Input->mousePos());
GLOBALS.Unfreeze(); GLOBALS.Unfreeze();
} }
@ -2361,9 +2361,9 @@ DECLARE_CUSTOM_FUNCTION(DoCredits)(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint3
while (_ctx->startTime + dwTime * 1000 > _vm->getTime()) { while (_ctx->startTime + dwTime * 1000 > _vm->getTime()) {
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;
} }

View file

@ -2086,13 +2086,13 @@ 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;
} }
if (!m_bNoTab) { if (!m_bNoTab) {
if (m_input) { if (m_input) {
if (m_input->MouseLeftClicked() || m_input->MouseRightClicked()) if (m_input->mouseLeftClicked() || m_input->mouseRightClicked())
return; return;
} }
} }

View file

@ -1032,9 +1032,9 @@ void RMOptionScreen::DoFrame(CORO_PARAM, RMInput *input) {
return; return;
// Reads input // Reads input
_ctx->mousePos = input->MousePos(); _ctx->mousePos = input->mousePos();
_ctx->bLeftClick = input->MouseLeftClicked(); _ctx->bLeftClick = input->mouseLeftClicked();
_ctx->bRightClick = input->MouseRightClicked(); _ctx->bRightClick = input->mouseRightClicked();
_ctx->bRefresh = false; _ctx->bRefresh = false;
@ -1097,7 +1097,7 @@ 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; }

View file

@ -146,7 +146,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
g_system->lockMutex(csMainLoop); g_system->lockMutex(csMainLoop);
// Poll of input devices // Poll of input devices
m_input.Poll(); m_input.poll();
if (m_bMustEnterMenu && GLOBALS.bIdleExited) { if (m_bMustEnterMenu && GLOBALS.bIdleExited) {
m_bOption = true; m_bOption = true;
@ -172,12 +172,12 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
// Check the mouse input // Check the mouse input
if (m_bInput && !m_tony.InAction()) { if (m_bInput && !m_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 (m_inv.HaveFocus(m_input.mousePos()) && !m_inter.Active()) {
// Left Click // 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 // 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_curAction = TA_COMBINE;
m_point.SetAction(m_curAction); m_point.SetAction(m_curAction);
} }
@ -185,18 +185,18 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
// Right Click // Right Click
// *********** // ***********
if (m_input.MouseRightClicked()) { if (m_input.mouseRightClicked()) {
if (m_itemName.IsItemSelected()) { if (m_itemName.IsItemSelected()) {
m_curActionObj = 0; m_curActionObj = 0;
m_inv.RightClick(m_input.MousePos()); m_inv.RightClick(m_input.mousePos());
} else } else
m_inv.RightClick(m_input.MousePos()); m_inv.RightClick(m_input.mousePos());
} else } else
// Right Release // Right Release
// ************* // *************
if (m_input.MouseRightReleased()) { if (m_input.mouseRightReleased()) {
if (m_inv.RightRelease(m_input.MousePos(), m_curAction)) { if (m_inv.RightRelease(m_input.mousePos(), m_curAction)) {
CORO_INVOKE_3(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_curAction = TA_GOTO;
@ -208,16 +208,16 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
// ************ // ************
if (m_bGUIOption) { if (m_bGUIOption) {
if (!m_tony.InAction() && m_bInput) { 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); CORO_INVOKE_1(OpenOptionScreen, 0);
goto SKIPCLICKSINISTRO; goto SKIPCLICKSINISTRO;
} else if (m_input.GetAsyncKeyState(Common::KEYCODE_ESCAPE)) } else if (m_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 (m_input.getAsyncKeyState(Common::KEYCODE_F3) || m_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 (m_input.getAsyncKeyState(Common::KEYCODE_F2) || m_input.getAsyncKeyState(Common::KEYCODE_F7))
// Load game screen // Load game screen
CORO_INVOKE_1(OpenOptionScreen, 4); CORO_INVOKE_1(OpenOptionScreen, 4);
} }
@ -226,7 +226,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
// Left Click // Left Click
// ************** // **************
if (m_input.MouseLeftClicked() && !m_inter.Active()) { if (m_input.mouseLeftClicked() && !m_inter.Active()) {
if (m_curAction != TA_COMBINE) if (m_curAction != TA_COMBINE)
CORO_INVOKE_3(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());
@ -247,29 +247,29 @@ SKIPCLICKSINISTRO:
// ************ // ************
if (m_curAction == TA_COMBINE) { if (m_curAction == TA_COMBINE) {
// During a combine, it cancels it // During a combine, it cancels it
if (m_input.MouseRightClicked()) { if (m_input.mouseRightClicked()) {
m_inv.EndCombine(); m_inv.EndCombine();
m_curActionObj = 0; m_curActionObj = 0;
m_curAction = TA_GOTO; m_curAction = TA_GOTO;
m_point.SetAction(m_curAction); m_point.SetAction(m_curAction);
m_point.SetSpecialPointer(RMPointer::PTR_NONE); 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) { if (m_bGUIInterface) {
// Before opening the interface, replaces GOTO // Before opening the interface, replaces GOTO
m_curAction = TA_GOTO; m_curAction = TA_GOTO;
m_curActionObj = 0; m_curActionObj = 0;
m_point.SetAction(m_curAction); m_point.SetAction(m_curAction);
m_inter.Clicked(m_input.MousePos()); m_inter.Clicked(m_input.mousePos());
} }
} }
// Right Release // Right Release
// ************* // *************
if (m_input.MouseRightReleased()) { if (m_input.mouseRightReleased()) {
if (m_bGUIInterface) { 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); m_point.SetAction(m_curAction);
CORO_INVOKE_3(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);
@ -281,14 +281,14 @@ SKIPCLICKSINISTRO:
} }
// Update the name under the mouse pointer // 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()) 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);
} }
// Interface & Inventory // Interface & Inventory
m_inter.DoFrame(m_bigBuf, m_input.MousePos()); 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_inv.DoFrame(m_bigBuf, m_point, m_input.mousePos(), (!m_tony.InAction() && !m_inter.Active() && m_bGUIInventory));
} }
// Animate Tony // Animate Tony
@ -305,7 +305,7 @@ SKIPCLICKSINISTRO:
m_tony.SetScrollPosition(m_loc.ScrollPosition()); m_tony.SetScrollPosition(m_loc.ScrollPosition());
if ((!m_tony.InAction() && m_bInput) || m_bAlwaysDrawMouse) { 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); m_point.DoFrame(&m_bigBuf);
} }
@ -498,7 +498,7 @@ void RMGfxEngine::Init() {
mpalInstallItemIrq(ItemIrq); mpalInstallItemIrq(ItemIrq);
// Initialise the input // Initialise the input
m_input.Init(); m_input.init();
// Initialise the mouse pointer // Initialise the mouse pointer
m_point.Init(); m_point.Init();
@ -527,7 +527,7 @@ void RMGfxEngine::Close(void) {
m_inv.Close(); m_inv.Close();
m_tony.Close(); m_tony.Close();
m_point.Close(); m_point.Close();
m_input.Close(); m_input.close();
} }
void RMGfxEngine::SwitchFullscreen(bool bFull) { void RMGfxEngine::SwitchFullscreen(bool bFull) {

View file

@ -49,7 +49,7 @@ RMInput::~RMInput() {
} }
void RMInput::Poll(void) { void RMInput::poll(void) {
_leftClickMouse = _leftReleaseMouse = _rightClickMouse = _rightReleaseMouse = false; _leftClickMouse = _leftReleaseMouse = _rightClickMouse = _rightReleaseMouse = false;
// Get pending events // Get pending events
@ -102,24 +102,24 @@ void RMInput::Poll(void) {
} }
} }
void RMInput::Init() { void RMInput::init() {
} }
void RMInput::Close(void) { void RMInput::close(void) {
} }
bool RMInput::MouseLeft() { bool RMInput::mouseLeft() {
return _leftButton; return _leftButton;
} }
bool RMInput::MouseRight() { bool RMInput::mouseRight() {
return _rightButton; return _rightButton;
} }
/** /**
* Return true if a key has been pressed * Return true if a key has been pressed
*/ */
bool RMInput::GetAsyncKeyState(Common::KeyCode kc) { bool RMInput::getAsyncKeyState(Common::KeyCode kc) {
// The act of testing for a particular key automatically clears the state, to prevent // The act of testing for a particular key automatically clears the state, to prevent
// the same key being registered in multiple different frames // the same key being registered in multiple different frames
bool result = _keyDown[(int)kc]; bool result = _keyDown[(int)kc];

View file

@ -55,45 +55,45 @@ public:
~RMInput(); ~RMInput();
// Class initialisation // Class initialisation
void Init(/*uint32 hInst*/); void init(/*uint32 hInst*/);
// Closes the class // Closes the class
void Close(void); void close(void);
// Polling (must be performed once per frame) // Polling (must be performed once per frame)
void Poll(void); void poll(void);
// Reading of the mouse // Reading of the mouse
RMPoint MousePos() { RMPoint mousePos() {
return _mousePos; return _mousePos;
} }
// Current status of the mouse buttons // Current status of the mouse buttons
bool MouseLeft(); bool mouseLeft();
bool MouseRight(); bool mouseRight();
// Events of mouse clicks // Events of mouse clicks
bool MouseLeftClicked() { bool mouseLeftClicked() {
return _leftClickMouse; return _leftClickMouse;
} }
bool MouseRightClicked() { bool mouseRightClicked() {
return _rightClickMouse; return _rightClickMouse;
} }
bool MouseBothClicked() { bool mouseBothClicked() {
return _leftClickMouse && _rightClickMouse; return _leftClickMouse && _rightClickMouse;
} }
bool MouseLeftReleased() { bool mouseLeftReleased() {
return _leftReleaseMouse; return _leftReleaseMouse;
} }
bool MouseRightReleased() { bool mouseRightReleased() {
return _rightReleaseMouse; return _rightReleaseMouse;
} }
bool MouseBothReleased() { bool mouseBothReleased() {
return _leftReleaseMouse && _rightReleaseMouse; return _leftReleaseMouse && _rightReleaseMouse;
} }
// Returns true if the given key is pressed // Returns true if the given key is pressed
bool GetAsyncKeyState(Common::KeyCode kc); bool getAsyncKeyState(Common::KeyCode kc);
}; };
} // 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;
} }