Skip to content

Conversation

@stephanmeesters
Copy link

@stephanmeesters stephanmeesters commented Dec 16, 2025

This bugfix closes #1922 and possibly closes #1999

Introduced with #1369 was a mouse capture state that would update when you paused the game however it did not reset this capture state regarding pausing when GameLogic:reset() was called.

Tested with Zero Hour. I could not test it in Generals because a bug see #2001

@stephanmeesters stephanmeesters force-pushed the bugfix-camera-scroll-savegame branch from d92da0d to 513cdf8 Compare December 16, 2025 19:13

m_rankPointsToAddAtGameStart = 0;

TheMouse->onGamePaused(FALSE);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The observation makes sense.

The implementation is not optimal. It will be better to replace

	m_pauseFrame = 0;
	m_gamePaused = FALSE;
	m_pauseSound = FALSE;
	m_pauseMusic = FALSE;
	m_pauseInput = FALSE;
	m_inputEnabledMemory = TRUE;
	m_mouseVisibleMemory = TRUE;
	m_logicTimeScaleEnabledMemory = FALSE;

with

	setGamePaused(FALSE);
	m_pauseFrame = 0;
	m_inputEnabledMemory = TRUE;
	m_mouseVisibleMemory = TRUE;
	m_logicTimeScaleEnabledMemory = FALSE;

higher up in this function and probably also in the init function.

This way other events can also properly update on pause state change.

Not sure if

	m_inputEnabledMemory = TRUE;
	m_mouseVisibleMemory = TRUE;
	m_logicTimeScaleEnabledMemory = FALSE;

still need to be reset then. I suspect it does not matter, but not sure.

Copy link
Author

@stephanmeesters stephanmeesters Dec 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made the requested changes and moved the memory resets above the setGamePaused(FALSE) so that things like TheMouse->setVisibility are updated as expected

Mouse edge scroll behavior, music and sound effects and mouse appear fine after the change. I do now notice a very short audio music glitch when loading the savegame probably (confirmed) because we're now calling TheAudio->resumeAudio(AudioAffect_Music) in reset()

@xezon xezon added Bug Something is not working right, typically is user facing Minor Severity: Minor < Major < Critical < Blocker ThisProject The issue was introduced by this project, or this task is specific to this project labels Dec 16, 2025
@stephanmeesters stephanmeesters force-pushed the bugfix-camera-scroll-savegame branch 2 times, most recently from 7797d40 to 474d1da Compare December 18, 2025 11:45
@L3-M
Copy link

L3-M commented Dec 19, 2025

What is the current status of this change?
Successfully merging this pull request will not close the linked issues ( #1922 and #1999 ) with this current description. Please check GitHub Docs:

https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword

@stephanmeesters
Copy link
Author

stephanmeesters commented Dec 19, 2025

The description has been updated to link the issues.

I've been looking for a clean solution, the problem right now is that setGamePaused does not only affect state but also performs actions like resuming sounds and music, which now leads to an audio glitch when you do that in reset() or init(), which ideally is a function only concerned about state.

Also setGamePaused deals with memory variables for restoring variables which does not apply for init() and reset().

So I think either we add some parameter to setGamePaused to indicate we only want state changes and no side effects, or we keep reset() much like it was before and i will do another pass to see that we properly reset everything.

It was possible to clean up init() a bit by using reset() there see refactor commit.

@xezon
Copy link

xezon commented Dec 19, 2025

Better make the deduplication a separate refactor change to reduce the complexity of this bug fix.

As for music bug, check why it happens and try to figure out an elegant way to avoid this.

@stephanmeesters stephanmeesters force-pushed the bugfix-camera-scroll-savegame branch from 474d1da to 6dfcb89 Compare December 19, 2025 19:46
@stephanmeesters
Copy link
Author

Alright the deduplication commit is gone from this and I've added a parameter to setGamePaused to prevent resuming audio in init() and reset().

The audio mishap was because reset would resume the music, and then milliseconds later the audiomanager subsystem would also reset which does a hard stop on all sounds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Minor Severity: Minor < Major < Critical < Blocker ThisProject The issue was introduced by this project, or this task is specific to this project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Camera edge scroll broken during online match Camera edge scroll broken after loading a savegame from ingame menu

3 participants