aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra
diff options
context:
space:
mode:
authorJohannes Schickel2010-01-29 22:43:23 +0000
committerJohannes Schickel2010-01-29 22:43:23 +0000
commit595a2e16f15ce73fe7c7ae0a31f33ca760356ff0 (patch)
tree17dbae19b5bbad762f07d648425125ef69d8fb11 /engines/kyra
parent027b44673a62da07ca5cf913f93b86261d10f3bb (diff)
downloadscummvm-rg350-595a2e16f15ce73fe7c7ae0a31f33ca760356ff0.tar.gz
scummvm-rg350-595a2e16f15ce73fe7c7ae0a31f33ca760356ff0.tar.bz2
scummvm-rg350-595a2e16f15ce73fe7c7ae0a31f33ca760356ff0.zip
Fix use of undefined behavior. (Thanks to syke for reporting)
svn-id: r47685
Diffstat (limited to 'engines/kyra')
-rw-r--r--engines/kyra/animator_hof.cpp4
-rw-r--r--engines/kyra/animator_mr.cpp4
-rw-r--r--engines/kyra/gui_lok.cpp8
-rw-r--r--engines/kyra/gui_lol.cpp6
-rw-r--r--engines/kyra/sequences_hof.cpp2
-rw-r--r--engines/kyra/sound_towns.cpp2
-rw-r--r--engines/kyra/sprites_lol.cpp4
7 files changed, 15 insertions, 15 deletions
diff --git a/engines/kyra/animator_hof.cpp b/engines/kyra/animator_hof.cpp
index 7609b3009d..e1471239da 100644
--- a/engines/kyra/animator_hof.cpp
+++ b/engines/kyra/animator_hof.cpp
@@ -123,7 +123,7 @@ void KyraEngine_HoF::updateItemAnimations() {
const ItemAnimData_v2 *s = &_itemAnimData[_nextAnimItem];
ActiveItemAnim *a = &_activeItemAnim[_nextAnimItem];
- _nextAnimItem = ++_nextAnimItem % _itemAnimDataSize;
+ _nextAnimItem = (_nextAnimItem + 1) % _itemAnimDataSize;
uint32 ctime = _system->getMillis();
if (ctime < a->nextFrame)
@@ -168,7 +168,7 @@ void KyraEngine_HoF::updateItemAnimations() {
if (nextFrame) {
a->nextFrame = _system->getMillis() + (s->frames[a->currentFrame].delay * _tickLength);
- a->currentFrame = ++a->currentFrame % s->numFrames;
+ a->currentFrame = (a->currentFrame + 1) % s->numFrames;
}
}
diff --git a/engines/kyra/animator_mr.cpp b/engines/kyra/animator_mr.cpp
index b15691c3f0..12f1061432 100644
--- a/engines/kyra/animator_mr.cpp
+++ b/engines/kyra/animator_mr.cpp
@@ -193,7 +193,7 @@ void KyraEngine_MR::updateItemAnimations() {
const ItemAnimData_v2 *s = &_itemAnimData[_nextAnimItem];
ActiveItemAnim *a = &_activeItemAnim[_nextAnimItem];
- _nextAnimItem = ++_nextAnimItem % 10;
+ _nextAnimItem = (_nextAnimItem + 1) % 10;
uint32 ctime = _system->getMillis();
if (ctime < a->nextFrame)
@@ -232,7 +232,7 @@ void KyraEngine_MR::updateItemAnimations() {
if (nextFrame) {
a->nextFrame = _system->getMillis() + (s->frames[a->currentFrame].delay * _tickLength);
- a->currentFrame = ++a->currentFrame % s->numFrames;
+ a->currentFrame = (a->currentFrame + 1) % s->numFrames;
}
}
diff --git a/engines/kyra/gui_lok.cpp b/engines/kyra/gui_lok.cpp
index 1a822b01a5..13cb56c842 100644
--- a/engines/kyra/gui_lok.cpp
+++ b/engines/kyra/gui_lok.cpp
@@ -1008,7 +1008,7 @@ void GUI_LoK::setupControls(Menu &menu) {
int GUI_LoK::controlsChangeMusic(Button *button) {
updateMenuButton(button);
- _vm->_configMusic = ++_vm->_configMusic % ((_vm->gameFlags().platform == Common::kPlatformFMTowns) ? 3 : 2);
+ _vm->_configMusic = (_vm->_configMusic + 1) % ((_vm->gameFlags().platform == Common::kPlatformFMTowns) ? 3 : 2);
setupControls(_menu[5]);
return 0;
}
@@ -1024,7 +1024,7 @@ int GUI_LoK::controlsChangeSounds(Button *button) {
int GUI_LoK::controlsChangeWalk(Button *button) {
updateMenuButton(button);
- _vm->_configWalkspeed = ++_vm->_configWalkspeed % 5;
+ _vm->_configWalkspeed = (_vm->_configWalkspeed + 1) % 5;
_vm->setWalkspeed(_vm->_configWalkspeed);
setupControls(_menu[5]);
return 0;
@@ -1033,7 +1033,7 @@ int GUI_LoK::controlsChangeWalk(Button *button) {
int GUI_LoK::controlsChangeText(Button *button) {
updateMenuButton(button);
- _vm->_configTextspeed = ++_vm->_configTextspeed % 4;
+ _vm->_configTextspeed = (_vm->_configTextspeed + 1) % 4;
setupControls(_menu[5]);
return 0;
}
@@ -1041,7 +1041,7 @@ int GUI_LoK::controlsChangeText(Button *button) {
int GUI_LoK::controlsChangeVoice(Button *button) {
updateMenuButton(button);
- _vm->_configVoice = ++_vm->_configVoice % 3;
+ _vm->_configVoice = (_vm->_configVoice + 1) % 3;
setupControls(_menu[5]);
return 0;
}
diff --git a/engines/kyra/gui_lol.cpp b/engines/kyra/gui_lol.cpp
index ac6e1aaf27..0f13738662 100644
--- a/engines/kyra/gui_lol.cpp
+++ b/engines/kyra/gui_lol.cpp
@@ -1059,7 +1059,7 @@ int LoLEngine::clickedTurnLeftArrow(Button *button) {
return 0;
gui_toggleButtonDisplayMode(_flags.isTalkie ? 79 : 77, 1);
- _currentDirection = (--_currentDirection) & 3;
+ _currentDirection = (_currentDirection - 1) & 3;
_sceneDefaultUpdate = 1;
@@ -1081,7 +1081,7 @@ int LoLEngine::clickedTurnRightArrow(Button *button) {
return 0;
gui_toggleButtonDisplayMode(_flags.isTalkie ? 81 : 79, 1);
- _currentDirection = (++_currentDirection) & 3;
+ _currentDirection = (_currentDirection + 1) & 3;
_sceneDefaultUpdate = 1;
@@ -2801,7 +2801,7 @@ int GUI_LoL::clickedOptionsMenu(Button *button) {
_vm->sound()->enableSFX(_vm->_configSounds);
break;
case 0xfff7:
- _vm->_monsterDifficulty = ++_vm->_monsterDifficulty % 3;
+ _vm->_monsterDifficulty = (_vm->_monsterDifficulty + 1) % 3;
break;
case 0xfff6:
_vm->_smoothScrollingEnabled ^= true;
diff --git a/engines/kyra/sequences_hof.cpp b/engines/kyra/sequences_hof.cpp
index bdba04bf9e..26919215a0 100644
--- a/engines/kyra/sequences_hof.cpp
+++ b/engines/kyra/sequences_hof.cpp
@@ -2716,7 +2716,7 @@ void KyraEngine_HoF::seq_scrollPage(int bottom, int top) {
_screen->fillRect(12, def->y - 8, 28, def->y + 8, 0, 4);
_screen->drawShape(4, getShapePtr(def->itemIndex + def->frames[a->currentFrame]), 12, def->y - 8, 0, 0);
if (_seqFrameCounter % 2 == 0)
- a->currentFrame = ++a->currentFrame % 20;
+ a->currentFrame = (a->currentFrame + 1) % 20;
}
}
_screen->copyRegionEx(4, 0, srcH, 2, 2, dstY + bottom, 320, dstH, &d);
diff --git a/engines/kyra/sound_towns.cpp b/engines/kyra/sound_towns.cpp
index ec9d46ff5d..1c88f8e878 100644
--- a/engines/kyra/sound_towns.cpp
+++ b/engines/kyra/sound_towns.cpp
@@ -2144,7 +2144,7 @@ bool TownsPC98_OpnChannel::control_fc_decOutLevel(uint8 para) {
bool TownsPC98_OpnChannel::control_fd_jump(uint8 para) {
uint8 *tmp = _drv->_trackPtr + READ_LE_UINT16(_dataPtr - 1);
- _dataPtr = (tmp[1] == 1) ? tmp : ++_dataPtr;
+ _dataPtr = (tmp[1] == 1) ? tmp : (_dataPtr + 1);
return true;
}
diff --git a/engines/kyra/sprites_lol.cpp b/engines/kyra/sprites_lol.cpp
index ce14489e3e..035a54cfd3 100644
--- a/engines/kyra/sprites_lol.cpp
+++ b/engines/kyra/sprites_lol.cpp
@@ -270,7 +270,7 @@ void LoLEngine::placeMonster(MonsterInPlay *monster, uint16 x, uint16 y) {
if (monster->x != x || monster->y != y) {
monster->x = x;
monster->y = y;
- monster->currentSubFrame = (++monster->currentSubFrame) & 3;
+ monster->currentSubFrame = (monster->currentSubFrame + 1) & 3;
}
if (monster->block == 0)
@@ -1115,7 +1115,7 @@ void LoLEngine::updateMonster(MonsterInPlay *monster) {
if ((monster->mode != 11) && (monster->mode != 14)) {
if (!(_rnd.getRandomNumber(255) & 3)) {
- monster->shiftStep = (++monster->shiftStep) & 0x0f;
+ monster->shiftStep = (monster->shiftStep + 1) & 0x0f;
checkSceneUpdateNeed(monster->block);
}
}