diff options
-rw-r--r-- | engines/hdb/ai-player.cpp | 5 | ||||
-rw-r--r-- | engines/hdb/hdb.cpp | 11 | ||||
-rw-r--r-- | engines/hdb/input.cpp | 26 |
3 files changed, 11 insertions, 31 deletions
diff --git a/engines/hdb/ai-player.cpp b/engines/hdb/ai-player.cpp index 059da9dfc0..029df3f8d4 100644 --- a/engines/hdb/ai-player.cpp +++ b/engines/hdb/ai-player.cpp @@ -1446,15 +1446,14 @@ void aiMagicEggInit2(AIEntity *e) { void aiMagicEggUse(AIEntity *e) { if (!scumm_strnicmp(e->luaFuncAction, "ai_", 3) || !scumm_strnicmp(e->luaFuncAction, "item_", 5)) { - int i = 0; AIEntity *spawned = NULL; - while (aiEntList[i].type != END_AI_TYPES) { + for (int i = 0; aiEntList[i].type != END_AI_TYPES; ++i) { if (!scumm_stricmp(aiEntList[i].luaName, e->luaFuncAction)) { spawned = g_hdb->_ai->spawn(aiEntList[i].type, e->dir, e->tileX, e->tileY, NULL, NULL, NULL, DIR_NONE, e->level, 0, 0, 1); break; } - i++; } + if (spawned) { g_hdb->_ai->addAnimateTarget(e->tileX * kTileWidth, e->tileY * kTileHeight, 0, 3, ANIM_NORMAL, false, false, GROUP_EXPLOSION_BOOM_SIT); diff --git a/engines/hdb/hdb.cpp b/engines/hdb/hdb.cpp index 0de3f32eda..bc780f66a5 100644 --- a/engines/hdb/hdb.cpp +++ b/engines/hdb/hdb.cpp @@ -550,15 +550,8 @@ void HDBGame::moveMap(int x, int y) { ox += (_dx - x) / 8; oy += (_dy - y) / 8; - if (ox < 0) - ox = 0; - else if (ox > g_hdb->_map->mapPixelWidth() - 240) - ox = g_hdb->_map->mapPixelWidth() - 240; - - if (oy < 0) - oy = 0; - else if (oy > g_hdb->_map->mapPixelHeight() - 320) - oy = g_hdb->_map->mapPixelHeight() - 320; + ox = CLIP(ox, 0, g_hdb->_map->mapPixelWidth() - 240); + oy = CLIP(oy, 0, g_hdb->_map->mapPixelHeight() - 320) g_hdb->_map->setMapXY(ox, oy); } diff --git a/engines/hdb/input.cpp b/engines/hdb/input.cpp index df6d02e002..093f525ec4 100644 --- a/engines/hdb/input.cpp +++ b/engines/hdb/input.cpp @@ -439,28 +439,16 @@ void Input::stylusMove(int x, int y) { } void Input::updateMouse(int newX, int newY) { - _mouseX = newX; - _mouseY = newY; - - if (_mouseX < 0) - _mouseX = 0; - else if (_mouseX >= g_hdb->_screenWidth) - _mouseX = g_hdb->_screenWidth - 1; - - if (_mouseY < 0) - _mouseY = 0; - else if (_mouseY >= g_hdb->_screenHeight) - _mouseY = g_hdb->_screenHeight - 1; + _mouseX = CLIP(newX, 0, g_hdb->_screenWidth - 1); + _mouseY = CLIP(newY, 0, g_hdb->_screenHeight - 1); // Turn Cursor back on? - if (!g_hdb->_gfx->getPointer()) { + if (!g_hdb->_gfx->getPointer()) g_hdb->_gfx->showPointer(true); - } // Check if LButton is being dragged - if (_mouseLButton) { + if (_mouseLButton) stylusMove(_mouseX, _mouseY); - } } void Input::updateMouseButtons(int l, int m, int r) { @@ -510,7 +498,7 @@ void Input::updateMouseButtons(int l, int m, int r) { } void Input::updateKeys(Common::Event event, bool keyDown) { - static int current = 0, last = 0; + static bool current = false, last = false; if (keyDown && event.kbd.keycode == _keyQuit) { g_hdb->quitGame(); @@ -522,13 +510,13 @@ void Input::updateKeys(Common::Event event, bool keyDown) { // PAUSE key pressed? last = current; if (keyDown && event.kbd.keycode == Common::KEYCODE_p && g_hdb->getGameState() == GAME_PLAY) { - current = 1; + current = true; if (!last) { g_hdb->togglePause(); g_hdb->_sound->playSound(SND_POP); } } else - current = 0; + current = false; if (!g_hdb->getPause()) { if (event.kbd.keycode == _keyUp) { |