[Scummvm-git-logs] scummvm master -> 8b172da92de45f8e649d0a076ae16e5e5effb32b
athrxx
noreply at scummvm.org
Fri Jun 27 20:41:31 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
8b172da92d KYRA: (EOB) - reduce cpu usage
Commit: 8b172da92de45f8e649d0a076ae16e5e5effb32b
https://github.com/scummvm/scummvm/commit/8b172da92de45f8e649d0a076ae16e5e5effb32b
Author: athrxx (athrxx at scummvm.org)
Date: 2025-06-27T22:40:10+02:00
Commit Message:
KYRA: (EOB) - reduce cpu usage
Changed paths:
engines/kyra/engine/chargen.cpp
engines/kyra/engine/eobcommon.cpp
engines/kyra/gui/gui_eob.cpp
engines/kyra/sequence/sequences_darkmoon.cpp
engines/kyra/sequence/sequences_eob.cpp
diff --git a/engines/kyra/engine/chargen.cpp b/engines/kyra/engine/chargen.cpp
index 9d5aa8ee908..ebe09ef37c1 100644
--- a/engines/kyra/engine/chargen.cpp
+++ b/engines/kyra/engine/chargen.cpp
@@ -381,6 +381,7 @@ bool CharacterGenerator::createCustomParty(const uint8 ***faceShapes) {
_activeBox = 0;
for (bool loop = true; loop && (!_vm->shouldQuit());) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
_vm->_gui->updateBoxFrameHighLight(_activeBox + 6);
int inputFlag = getInput(_vm->_activeButtons);
_vm->removeInputTop();
@@ -433,6 +434,7 @@ bool CharacterGenerator::createCustomParty(const uint8 ***faceShapes) {
loop = true;
}
}
+ _vm->delayUntil(frameEnd);
}
return true;
@@ -725,6 +727,7 @@ void CharacterGenerator::createPartyMember() {
assert(_vm->_gui);
for (int i = 0; i != 3 && !_vm->shouldQuit(); i++) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
bool bck = false;
switch (i) {
@@ -747,6 +750,7 @@ void CharacterGenerator::createPartyMember() {
if (bck)
i -= 2;
+ _vm->delayUntil(frameEnd);
};
if (!_vm->shouldQuit()) {
@@ -754,6 +758,7 @@ void CharacterGenerator::createPartyMember() {
statsAndFacesMenu();
for (_characters[_activeBox].name[0] = 0; _characters[_activeBox].name[0] == 0 && !_vm->shouldQuit();) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
processFaceMenuSelection(_chargenMinStats[6]);
printStats(_activeBox, 0);
if (_vm->gameFlags().platform == Common::kPlatformSegaCD) {
@@ -778,6 +783,7 @@ void CharacterGenerator::createPartyMember() {
processNameInput(_activeBox, _vm->guiSettings()->colors.guiColorBlue);
}
}
+ _vm->delayUntil(frameEnd);
}
}
}
@@ -803,11 +809,13 @@ int CharacterGenerator::raceSexMenu() {
int16 res = -1;
while (res == -1 && !_vm->shouldQuit()) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
res = _vm->_gui->simpleMenu_process(1, _chargenRaceSexStrings, 0, -1, 0);
if (_vm->_flags.platform == Common::kPlatformSegaCD)
_screen->sega_getRenderer()->render(0, 18, 8, 20, 16);
_screen->updateScreen();
updateMagicShapes();
+ _vm->delayUntil(frameEnd);
}
return res;
@@ -850,6 +858,7 @@ int CharacterGenerator::classMenu(int raceSex) {
bool backBtnHiLite = false;
while (res == -1 && !_vm->shouldQuit()) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
updateMagicShapes();
int in = getInput(0) & 0xFF;
Common::Point mp = _vm->getMousePos();
@@ -878,6 +887,7 @@ int CharacterGenerator::classMenu(int raceSex) {
}
_screen->updateScreen();
}
+ _vm->delayUntil(frameEnd);
}
_vm->removeInputTop();
@@ -924,6 +934,7 @@ int CharacterGenerator::alignmentMenu(int cClass) {
bool backBtnHiLite = false;
while (res == -1 && !_vm->shouldQuit()) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
updateMagicShapes();
int in = getInput(0) & 0xFF;
Common::Point mp = _vm->getMousePos();
@@ -952,6 +963,7 @@ int CharacterGenerator::alignmentMenu(int cClass) {
}
_screen->updateScreen();
}
+ _vm->delayUntil(frameEnd);
}
_vm->removeInputTop();
@@ -1112,6 +1124,7 @@ void CharacterGenerator::statsAndFacesMenu() {
int in = 0;
while (!in && !_vm->shouldQuit()) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
updateMagicShapes();
in = getInput(_vm->_activeButtons);
_vm->removeInputTop();
@@ -1141,6 +1154,7 @@ void CharacterGenerator::statsAndFacesMenu() {
initButtonsFromList(27, 4);
in = 0;
}
+ _vm->delayUntil(frameEnd);
}
_vm->_gui->updateBoxFrameHighLight(6 + _activeBox);
@@ -1179,6 +1193,7 @@ void CharacterGenerator::faceSelectMenu() {
int in = 0;
while (!in && !_vm->shouldQuit()) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
updateMagicShapes();
in = getInput(_vm->_activeButtons);
_vm->removeInputTop();
@@ -1201,6 +1216,7 @@ void CharacterGenerator::faceSelectMenu() {
} else {
in = 0;
}
+ _vm->delayUntil(frameEnd);
}
_vm->_gui->updateBoxFrameHighLight(-1);
@@ -1430,6 +1446,7 @@ int CharacterGenerator::modifyStat(int index, int8 *stat1, int8 *stat2) {
}
for (bool loop = true; loop && !_vm->shouldQuit();) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
uint8 v1 = *s1;
updateMagicShapes();
int inputFlag = getInput(_vm->_activeButtons);
@@ -1554,6 +1571,7 @@ int CharacterGenerator::modifyStat(int index, int8 *stat1, int8 *stat2) {
}
_screen->updateScreen();
}
+ _vm->delayUntil(frameEnd);
}
_screen->setFont(of);
@@ -2218,6 +2236,7 @@ int TransferPartyWiz::selectCharactersMenu() {
bool update = false;
for (bool loop = true; loop && (!_vm->shouldQuit());) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
int inputFlag = _vm->checkInput(0, false, 0) & 0x8FF;
_vm->removeInputTop();
@@ -2290,6 +2309,7 @@ int TransferPartyWiz::selectCharactersMenu() {
_vm->_gui->messageDialog(16, count < 4 ? 69 : 70, _vm->guiSettings()->colors.guiColorLightRed);
_screen->updateScreen();
+ _vm->delayUntil(frameEnd);
}
_screen->setFont(of);
diff --git a/engines/kyra/engine/eobcommon.cpp b/engines/kyra/engine/eobcommon.cpp
index e209ffaa648..8b06f93953f 100644
--- a/engines/kyra/engine/eobcommon.cpp
+++ b/engines/kyra/engine/eobcommon.cpp
@@ -744,6 +744,7 @@ void EoBCoreEngine::runLoop() {
_runFlag = true;
while (!shouldQuit() && _runFlag) {
+ uint32 frameEnd = _system->getMillis() + 8;
checkPartyStatus(true);
checkInput(_activeButtons, true, 0);
removeInputTop();
@@ -770,6 +771,7 @@ void EoBCoreEngine::runLoop() {
snd_updateLevelScore();
snd_updateEnvironmentalSfx(0);
turnUndeadAuto();
+ delayUntil(frameEnd);
}
}
diff --git a/engines/kyra/gui/gui_eob.cpp b/engines/kyra/gui/gui_eob.cpp
index 0783528fbd3..a0436523221 100644
--- a/engines/kyra/gui/gui_eob.cpp
+++ b/engines/kyra/gui/gui_eob.cpp
@@ -2396,6 +2396,7 @@ void GUI_EoB::runCampMenu() {
for (bool runLoop = true; runLoop && !_vm->shouldQuit();) {
bool buttonsUnchanged = true;
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
if (newMenu != -1) {
drawCampMenu();
@@ -2670,6 +2671,8 @@ void GUI_EoB::runCampMenu() {
_screen->updateScreen();
prevHighlightButton = highlightButton;
}
+
+ _vm->delayUntil(frameEnd);
}
if (cs != -1)
@@ -2689,6 +2692,7 @@ bool GUI_EoB::runLoadMenu(int x, int y, bool fromMainMenu) {
_screen->modifyScreenDim(11, dm->sx + (x >> 3), dm->sy + y, dm->w, dm->h);
for (bool runLoop = true; runLoop && !_vm->shouldQuit();) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
updateSaveSlotsList(_vm->_targetName);
_vm->useMainMenuGUISettings(fromMainMenu);
@@ -2712,6 +2716,7 @@ bool GUI_EoB::runLoadMenu(int x, int y, bool fromMainMenu) {
result = true;
}
}
+ _vm->delayUntil(frameEnd);
}
_screen->modifyScreenDim(11, xo, yo, dm->w, dm->h);
@@ -2739,6 +2744,7 @@ bool GUI_EoB::confirmDialogue2(int dim, int id, int deflt) {
drawMenuButtonBox(x[i], y, 32, _dlgButtonHeight2, false, false);
for (bool runLoop = true; runLoop && !_vm->shouldQuit();) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
Common::Point p = _vm->getMousePos();
if (_vm->posWithinRect(p.x, p.y, x[0], y, x[0] + 32, y + _dlgButtonHeight2))
newHighlight = 0;
@@ -2774,6 +2780,7 @@ bool GUI_EoB::confirmDialogue2(int dim, int id, int deflt) {
_screen->updateScreen();
lastHighlight = newHighlight;
}
+ _vm->delayUntil(frameEnd);
}
drawMenuButtonBox(x[newHighlight], y, 32, _dlgButtonHeight2, true, true);
@@ -3327,6 +3334,7 @@ bool GUI_EoB::runSaveMenu(int x, int y) {
_screen->modifyScreenDim(11, dm->sx + (x >> 3), dm->sy + y, dm->w, dm->h);
for (bool runLoop = true; runLoop && !_vm->shouldQuit();) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
updateSaveSlotsList(_vm->_targetName);
int slot = selectSaveSlotDialog(x, y, 0);
if (slot > _numSlotsVisible - 1) {
@@ -3406,6 +3414,7 @@ bool GUI_EoB::runSaveMenu(int x, int y) {
runLoop = false;
}
+ _vm->delayUntil(frameEnd);
}
_screen->modifyScreenDim(11, xo, yo, dm->w, dm->h);
@@ -3427,6 +3436,7 @@ int GUI_EoB::selectSaveSlotDialog(int x, int y, int id) {
int slot = -1;
for (bool runLoop = true; runLoop && !_vm->shouldQuit();) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
int inputFlag = _vm->checkInput(0, false, 0) & 0x8FF;
_vm->removeInputTop();
bool clickedButton = false;
@@ -3525,6 +3535,7 @@ int GUI_EoB::selectSaveSlotDialog(int x, int y, int id) {
drawSaveSlotButton(newHighlight, 1, true);
_screen->updateScreen();
}
+ _vm->delayUntil(frameEnd);
}
return newHighlight;
@@ -3647,6 +3658,7 @@ void GUI_EoB::runMemorizePrayMenu(int charIndex, int spellType) {
bool highLightClicked = (_vm->gameFlags().platform == Common::kPlatformSegaCD);
for (bool runLoop = true; runLoop && !_vm->shouldQuit();) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
updateBoxFrameHighLight(charIndex);
if (newHighLightButton < 0)
@@ -3781,6 +3793,7 @@ void GUI_EoB::runMemorizePrayMenu(int charIndex, int spellType) {
if (newHighLightButton == lastHighLightButton)
drawMenuButton(_vm->gui_getButton(buttonList, inputFlag & 0x7FFF), _vm->gameFlags().platform == Common::kPlatformSegaCD, true, true);
}
+ _vm->delayUntil(frameEnd);
}
releaseButtons(buttonList);
@@ -3881,6 +3894,7 @@ void GUI_EoB::scribeScrollDialogue() {
int newHighLight = 0;
while (s && !_vm->shouldQuit()) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
if (redraw) {
s = 0;
for (int i = 0; i < 32 && s < 6; i++) {
@@ -3946,6 +3960,7 @@ void GUI_EoB::scribeScrollDialogue() {
redraw = true;
s--;
}
+ _vm->delayUntil(frameEnd);
}
releaseButtons(buttonList);
@@ -4282,6 +4297,7 @@ bool GUI_EoB::confirmDialogue(int id) {
bool result = false;
for (bool runLoop = true; runLoop && !_vm->shouldQuit();) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
if (newHighlight != lastHighlight) {
if (lastHighlight != -1)
drawMenuButton(_vm->gui_getButton(buttonList, lastHighlight + 33), false, false, true);
@@ -4321,6 +4337,7 @@ bool GUI_EoB::confirmDialogue(int id) {
drawMenuButton(b, false, true, true);
_screen->updateScreen();
}
+ _vm->delayUntil(frameEnd);
}
releaseButtons(buttonList);
@@ -4416,6 +4433,7 @@ int GUI_EoB::selectCharacterDialogue(int id) {
Screen::FontId of = _screen->setFont(_vm->_conFont);
while (result == -2 && !_vm->shouldQuit()) {
+ uint32 frameEnd = _vm->_system->getMillis() + 8;
int inputFlag = _vm->checkInput(buttonList, false, 0);
_vm->removeInputTop();
@@ -4460,6 +4478,7 @@ int GUI_EoB::selectCharacterDialogue(int id) {
if (found[result])
result = -2;
}
+ _vm->delayUntil(frameEnd);
}
updateBoxFrameHighLight(-1);
diff --git a/engines/kyra/sequence/sequences_darkmoon.cpp b/engines/kyra/sequence/sequences_darkmoon.cpp
index f2f8c7b68ef..7690bd9f92c 100644
--- a/engines/kyra/sequence/sequences_darkmoon.cpp
+++ b/engines/kyra/sequence/sequences_darkmoon.cpp
@@ -217,8 +217,11 @@ int DarkMoonEngine::mainMenuLoop() {
_gui->simpleMenu_setup(6, 0, _mainMenuStrings, -1, 0, 0, _configRenderMode == Common::kRenderCGA ? 1 : guiSettings()->colors.guiColorWhite, guiSettings()->colors.guiColorLightRed, guiSettings()->colors.guiColorBlack);
_screen->updateScreen();
- while (sel == -1 && !shouldQuit())
+ while (sel == -1 && !shouldQuit()) {
+ uint32 frameEnd = _system->getMillis() + 8;
sel = _gui->simpleMenu_process(6, _mainMenuStrings, 0, -1, 0);
+ delayUntil(frameEnd);
+ }
} while ((sel < 0 || sel > 5) && !shouldQuit());
if (_flags.platform == Common::kPlatformFMTowns && sel == 2) {
@@ -235,8 +238,11 @@ void DarkMoonEngine::townsUtilitiesMenu() {
do {
_gui->simpleMenu_setup(8, 0, _utilMenuStrings, -1, 0, 0, _configRenderMode == Common::kRenderCGA ? 1 : guiSettings()->colors.guiColorWhite, guiSettings()->colors.guiColorLightRed, guiSettings()->colors.guiColorBlack);
_screen->updateScreen();
- while (sel == -1 && !shouldQuit())
+ while (sel == -1 && !shouldQuit()) {
+ uint32 frameEnd = _system->getMillis() + 8;
sel = _gui->simpleMenu_process(8, _utilMenuStrings, 0, -1, 0);
+ delayUntil(frameEnd);
+ }
if (sel == 0) {
_config2431 ^= true;
sel = -1;
diff --git a/engines/kyra/sequence/sequences_eob.cpp b/engines/kyra/sequence/sequences_eob.cpp
index d45cba6465e..49ddf987a3b 100644
--- a/engines/kyra/sequence/sequences_eob.cpp
+++ b/engines/kyra/sequence/sequences_eob.cpp
@@ -2285,8 +2285,12 @@ int EoBEngine::mainMenuLoop() {
_screen->sega_getRenderer()->render(0);
_screen->updateScreen();
- while (sel == -1 && !shouldQuit())
+ while (sel == -1 && !shouldQuit()) {
+ uint32 frameEnd = _system->getMillis() + 8;
sel = _gui->simpleMenu_process(8, _mainMenuStrings, 0, -1, 0);
+ delayUntil(frameEnd);
+
+ }
} while ((sel < 0 || sel > 5) && !shouldQuit());
return sel + 1;
More information about the Scummvm-git-logs
mailing list