Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenXcom/OXCE issues with CTRL/ALT button press and music/sound effects #338

Open
psavola opened this issue Jun 29, 2024 · 0 comments
Open

Comments

@psavola
Copy link

psavola commented Jun 29, 2024

I have noticed two sets of issues in sdl12-compat (also in 1.2.68) that didn't exist and go away if I roll back to SDL 1.2.15.

I've reported these in https://openxcom.org/forum/index.php?topic=12069.0. (Previous other OpenXcom issues were handled in #215). But I suppose these are issues in sdl12-compat, because the vanilla SDL works (unless someone can show that the OpenXcom/OXCE code in question is actually wrong).

  1. when you press down CTRL, ALT or some other key, if this should result in a change in GUI, no change is shown (but potentially the behaviour is silently changed). There multiple cases where this occurs.

The easiest to reproduce is when your craft arrives at destination and you press CTRL on the "start mission yes/no screen", the GUI button for "NO" no longer changes to "PATROL". However, if you still press the unchanged button while holding down CTRL, the craft will start patrolling, not return to the base. So this is a "visual problem", not affecting functionality. (Other button-pressing issues are more severe for playability.)

The OXCE code for this particular thing is in
https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Geoscape/ConfirmLandingState.cpp#L97:

_btnNo->onKeyboardPress((ActionHandler)&ConfirmLandingState::togglePatrolButton, SDLK_LCTRL);
_btnNo->onKeyboardRelease((ActionHandler)&ConfirmLandingState::togglePatrolButton, SDLK_LCTRL);

And the handler is at https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Geoscape/ConfirmLandingState.h#L36
and https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Geoscape/ConfirmLandingState.cpp#L325 as follows:

void ConfirmLandingState::togglePatrolButton(Action *)
{
if (_game->isCtrlPressed())
{
_btnNo->setText(tr("STR_PATROL"));
}
else
{
_btnNo->setText(tr("STR_NO"));
}
}

So my uneducated guess is that for some reason either the "isCtrlPressed" condition does not work or "setText" does not work when it should change the already drawn text outputs based on holding down a key.

If the issue were to be found in isCtrlPressed(), it would probably be somewhere around https://github.com/MeridianOXC/OpenXcom/blob/oxce-plus/src/Engine/Game.cpp#L712

bool Game::isCtrlPressed(bool considerTouchButtons) const
{
if (considerTouchButtons && _ctrl)
{
return true;
}
return (SDL_GetModState() & KMOD_CTRL) != 0;
}

  1. At least with one major mod, there are lot of really weird beeps and extra noises in battlescape music tracks and SFX. I didn't see this when quickly testing in vanilla.

I couldn't figure out how to test these further, so I rolled back to using SDL 1.2.15. But I suppose I could possibly try again if there is interest in working on these to get these fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant