Skip to content

Commit

Permalink
TONY: Rename variables and functions in input.h
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Jun 4, 2012
1 parent 7b547a7 commit 014330a
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 55 deletions.
8 changes: 4 additions & 4 deletions engines/tony/custom.cpp
Expand Up @@ -2020,10 +2020,10 @@ DECLARE_CUSTOM_FUNCTION(StartDialog)(CORO_PARAM, uint32 nDialog, uint32 nStartGr
GLOBALS.Pointer->SetSpecialPointer(GLOBALS.Pointer->PTR_NONE);
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);
GLOBALS.Freeze();
CORO_INVOKE_1(_ctx->dc.DoFrame, GLOBALS.Input->MousePos());
CORO_INVOKE_1(_ctx->dc.DoFrame, GLOBALS.Input->mousePos());
GLOBALS.Unfreeze();
}

Expand Down Expand Up @@ -2361,9 +2361,9 @@ DECLARE_CUSTOM_FUNCTION(DoCredits)(CORO_PARAM, uint32 nMsg, uint32 dwTime, uint3

while (_ctx->startTime + dwTime * 1000 > _vm->getTime()) {
CORO_INVOKE_0(GLOBALS.WaitFrame);
if (GLOBALS.Input->MouseLeftClicked() || GLOBALS.Input->MouseRightClicked())
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;
}

Expand Down
4 changes: 2 additions & 2 deletions engines/tony/font.cpp
Expand Up @@ -2086,13 +2086,13 @@ 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;
}

if (!m_bNoTab) {
if (m_input) {
if (m_input->MouseLeftClicked() || m_input->MouseRightClicked())
if (m_input->mouseLeftClicked() || m_input->mouseRightClicked())
return;
}
}
Expand Down
8 changes: 4 additions & 4 deletions engines/tony/game.cpp
Expand Up @@ -1032,9 +1032,9 @@ void RMOptionScreen::DoFrame(CORO_PARAM, RMInput *input) {
return;

// Reads input
_ctx->mousePos = input->MousePos();
_ctx->bLeftClick = input->MouseLeftClicked();
_ctx->bRightClick = input->MouseRightClicked();
_ctx->mousePos = input->mousePos();
_ctx->bLeftClick = input->mouseLeftClicked();
_ctx->bRightClick = input->mouseRightClicked();

_ctx->bRefresh = false;

Expand Down Expand Up @@ -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)) { \
m_EditName[strlen(m_EditName) +1 ] = '\0'; m_EditName[strlen(m_EditName)] = c; _ctx->bRefresh = true; }

Expand Down
50 changes: 25 additions & 25 deletions engines/tony/gfxengine.cpp
Expand Up @@ -146,7 +146,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
g_system->lockMutex(csMainLoop);

// Poll of input devices
m_input.Poll();
m_input.poll();

if (m_bMustEnterMenu && GLOBALS.bIdleExited) {
m_bOption = true;
Expand All @@ -172,31 +172,31 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
// Check the mouse input
if (m_bInput && !m_tony.InAction()) {
// If we are on the inventory, it is it who controls all input
if (m_inv.HaveFocus(m_input.MousePos()) && !m_inter.Active()) {
if (m_inv.HaveFocus(m_input.mousePos()) && !m_inter.Active()) {
// Left Click
// **********
if (m_input.MouseLeftClicked()/* && m_itemName.IsItemSelected()*/) {
if (m_input.mouseLeftClicked()/* && m_itemName.IsItemSelected()*/) {
// Left click activates the combine, if we are on an object
if (m_inv.LeftClick(m_input.MousePos(), m_curActionObj)) {
if (m_inv.LeftClick(m_input.mousePos(), m_curActionObj)) {
m_curAction = TA_COMBINE;
m_point.SetAction(m_curAction);
}
} else

// Right Click
// ***********
if (m_input.MouseRightClicked()) {
if (m_input.mouseRightClicked()) {
if (m_itemName.IsItemSelected()) {
m_curActionObj = 0;
m_inv.RightClick(m_input.MousePos());
m_inv.RightClick(m_input.mousePos());
} else
m_inv.RightClick(m_input.MousePos());
m_inv.RightClick(m_input.mousePos());
} else

// Right Release
// *************
if (m_input.MouseRightReleased()) {
if (m_inv.RightRelease(m_input.MousePos(), m_curAction)) {
if (m_input.mouseRightReleased()) {
if (m_inv.RightRelease(m_input.mousePos(), m_curAction)) {
CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction);

m_curAction = TA_GOTO;
Expand All @@ -208,16 +208,16 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
// ************
if (m_bGUIOption) {
if (!m_tony.InAction() && m_bInput) {
if ((m_input.MouseLeftClicked() && m_input.MousePos().x < 3 && m_input.MousePos().y < 3)) {
if ((m_input.mouseLeftClicked() && m_input.mousePos().x < 3 && m_input.mousePos().y < 3)) {
CORO_INVOKE_1(OpenOptionScreen, 0);
goto SKIPCLICKSINISTRO;
} else if (m_input.GetAsyncKeyState(Common::KEYCODE_ESCAPE))
} else if (m_input.getAsyncKeyState(Common::KEYCODE_ESCAPE))
CORO_INVOKE_1(OpenOptionScreen, 0);
else if (!_vm->getIsDemo()) {
if (m_input.GetAsyncKeyState(Common::KEYCODE_F3) || m_input.GetAsyncKeyState(Common::KEYCODE_F5))
if (m_input.getAsyncKeyState(Common::KEYCODE_F3) || m_input.getAsyncKeyState(Common::KEYCODE_F5))
// Save game screen
CORO_INVOKE_1(OpenOptionScreen, 3);
else if (m_input.GetAsyncKeyState(Common::KEYCODE_F2) || m_input.GetAsyncKeyState(Common::KEYCODE_F7))
else if (m_input.getAsyncKeyState(Common::KEYCODE_F2) || m_input.getAsyncKeyState(Common::KEYCODE_F7))
// Load game screen
CORO_INVOKE_1(OpenOptionScreen, 4);
}
Expand All @@ -226,7 +226,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {

// Left Click
// **************
if (m_input.MouseLeftClicked() && !m_inter.Active()) {
if (m_input.mouseLeftClicked() && !m_inter.Active()) {

if (m_curAction != TA_COMBINE)
CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_point.CurAction());
Expand All @@ -247,29 +247,29 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
// ************
if (m_curAction == TA_COMBINE) {
// During a combine, it cancels it
if (m_input.MouseRightClicked()) {
if (m_input.mouseRightClicked()) {
m_inv.EndCombine();
m_curActionObj = 0;
m_curAction = TA_GOTO;
m_point.SetAction(m_curAction);
m_point.SetSpecialPointer(RMPointer::PTR_NONE);
}
} else if (m_input.MouseRightClicked() && m_itemName.IsItemSelected() && m_point.GetSpecialPointer() == RMPointer::PTR_NONE) {
} else if (m_input.mouseRightClicked() && m_itemName.IsItemSelected() && m_point.GetSpecialPointer() == RMPointer::PTR_NONE) {
if (m_bGUIInterface) {
// Before opening the interface, replaces GOTO
m_curAction = TA_GOTO;
m_curActionObj = 0;
m_point.SetAction(m_curAction);
m_inter.Clicked(m_input.MousePos());
m_inter.Clicked(m_input.mousePos());
}
}


// Right Release
// *************
if (m_input.MouseRightReleased()) {
if (m_input.mouseRightReleased()) {
if (m_bGUIInterface) {
if (m_inter.Released(m_input.MousePos(), m_curAction)) {
if (m_inter.Released(m_input.mousePos(), m_curAction)) {
m_point.SetAction(m_curAction);
CORO_INVOKE_3(m_tony.MoveAndDoAction, m_itemName.GetHotspot(), m_itemName.GetSelectedItem(), m_curAction);

Expand All @@ -281,14 +281,14 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
}

// Update the name under the mouse pointer
m_itemName.SetMouseCoord(m_input.MousePos());
m_itemName.SetMouseCoord(m_input.mousePos());
if (!m_inter.Active() && !m_inv.MiniActive())
CORO_INVOKE_4(m_itemName.DoFrame, m_bigBuf, m_loc, m_point, m_inv);
}

// Interface & Inventory
m_inter.DoFrame(m_bigBuf, m_input.MousePos());
m_inv.DoFrame(m_bigBuf, m_point, m_input.MousePos(), (!m_tony.InAction() && !m_inter.Active() && m_bGUIInventory));
m_inter.DoFrame(m_bigBuf, m_input.mousePos());
m_inv.DoFrame(m_bigBuf, m_point, m_input.mousePos(), (!m_tony.InAction() && !m_inter.Active() && m_bGUIInventory));
}

// Animate Tony
Expand All @@ -305,7 +305,7 @@ void RMGfxEngine::DoFrame(CORO_PARAM, bool bDrawLocation) {
m_tony.SetScrollPosition(m_loc.ScrollPosition());

if ((!m_tony.InAction() && m_bInput) || m_bAlwaysDrawMouse) {
m_point.SetCoord(m_input.MousePos());
m_point.SetCoord(m_input.mousePos());
m_point.DoFrame(&m_bigBuf);
}

Expand Down Expand Up @@ -498,7 +498,7 @@ void RMGfxEngine::Init() {
mpalInstallItemIrq(ItemIrq);

// Initialise the input
m_input.Init();
m_input.init();

// Initialise the mouse pointer
m_point.Init();
Expand Down Expand Up @@ -527,7 +527,7 @@ void RMGfxEngine::Close(void) {
m_inv.Close();
m_tony.Close();
m_point.Close();
m_input.Close();
m_input.close();
}

void RMGfxEngine::SwitchFullscreen(bool bFull) {
Expand Down
12 changes: 6 additions & 6 deletions engines/tony/input.cpp
Expand Up @@ -49,7 +49,7 @@ RMInput::~RMInput() {

}

void RMInput::Poll(void) {
void RMInput::poll(void) {
_leftClickMouse = _leftReleaseMouse = _rightClickMouse = _rightReleaseMouse = false;

// Get pending events
Expand Down Expand Up @@ -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;
}

bool RMInput::MouseRight() {
bool RMInput::mouseRight() {
return _rightButton;
}

/**
* 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 same key being registered in multiple different frames
bool result = _keyDown[(int)kc];
Expand Down
26 changes: 13 additions & 13 deletions engines/tony/input.h
Expand Up @@ -55,45 +55,45 @@ class RMInput {
~RMInput();

// Class initialisation
void Init(/*uint32 hInst*/);
void init(/*uint32 hInst*/);

// Closes the class
void Close(void);
void close(void);

// Polling (must be performed once per frame)
void Poll(void);
void poll(void);

// Reading of the mouse
RMPoint MousePos() {
RMPoint mousePos() {
return _mousePos;
}

// Current status of the mouse buttons
bool MouseLeft();
bool MouseRight();
bool mouseLeft();
bool mouseRight();

// Events of mouse clicks
bool MouseLeftClicked() {
bool mouseLeftClicked() {
return _leftClickMouse;
}
bool MouseRightClicked() {
bool mouseRightClicked() {
return _rightClickMouse;
}
bool MouseBothClicked() {
bool mouseBothClicked() {
return _leftClickMouse && _rightClickMouse;
}
bool MouseLeftReleased() {
bool mouseLeftReleased() {
return _leftReleaseMouse;
}
bool MouseRightReleased() {
bool mouseRightReleased() {
return _rightReleaseMouse;
}
bool MouseBothReleased() {
bool mouseBothReleased() {
return _leftReleaseMouse && _rightReleaseMouse;
}

// Returns true if the given key is pressed
bool GetAsyncKeyState(Common::KeyCode kc);
bool getAsyncKeyState(Common::KeyCode kc);
};

} // End of namespace Tony
Expand Down
2 changes: 1 addition & 1 deletion engines/tony/inventory.cpp
Expand Up @@ -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;
}

Expand Down

0 comments on commit 014330a

Please sign in to comment.