[Scummvm-git-logs] scummvm master -> 0344e0adce3361f68c3ec0b92c86878e635e80ad
Strangerke
Strangerke at scummvm.org
Thu Sep 19 08:13:24 CEST 2019
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
cd2f87942f HDB: Fix another regression in inventory
0344e0adce HDB: Simplify some code
Commit: cd2f87942f79f11afdf63af26e91edc089b96973
https://github.com/scummvm/scummvm/commit/cd2f87942f79f11afdf63af26e91edc089b96973
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-09-19T08:04:34+02:00
Commit Message:
HDB: Fix another regression in inventory
Changed paths:
engines/hdb/window.cpp
diff --git a/engines/hdb/window.cpp b/engines/hdb/window.cpp
index a2dde63..5cd4875 100644
--- a/engines/hdb/window.cpp
+++ b/engines/hdb/window.cpp
@@ -53,9 +53,10 @@ Window::Window() {
_tryRestartY = 240; // (ok)
_panicXStop = g_hdb->_screenDrawWidth / 4;
_panicZoneFaceX = g_hdb->_screenDrawWidth - 32;
- // TODO: Check those values!
- _invItemSpaceX = 0;
- _invItemSpaceY = 0;
+
+ // Fields not used in the PPC version
+ _invItemSpaceX = 1;
+ _invItemSpaceY = 1;
} else {
_weaponX = (480 - 34);
_weaponY = 2;
@@ -76,6 +77,8 @@ Window::Window() {
_tryRestartY = ((g_hdb->_screenHeight >> 2) * 3); // (ok)
_panicXStop = g_hdb->_screenDrawWidth / 3;
_panicZoneFaceX = g_hdb->_screenDrawWidth - 32;
+ // Fields only used in the PPC version
+ _invItemSpace = 0;
}
_pauseY = (g_hdb->_screenHeight / 2 - 64);
@@ -106,7 +109,6 @@ Window::Window() {
_gfxInfobar = nullptr;
_gfxDarken = nullptr;
_infobarDimmed = 0;
- _invItemSpace = 0;
_dialogDelay = 0;
_numMsgQueue = 0;
_gfxTL = nullptr;
@@ -1327,13 +1329,12 @@ bool Window::checkInvClose(int x, int y) {
g_hdb->_sound->playSound(SND_MENU_SLIDER);
static AIType lastWeaponSelected = AI_NONE;
- Tile *gfx;
if (!g_hdb->getActionMode())
return false;
AIType t = g_hdb->_ai->getInvItemType(_invWinInfo.selection);
- gfx = g_hdb->_ai->getInvItemGfx(_invWinInfo.selection);
+ Tile *gfx = g_hdb->_ai->getInvItemGfx(_invWinInfo.selection);
switch (t) {
case ITEM_CLUB:
Commit: 0344e0adce3361f68c3ec0b92c86878e635e80ad
https://github.com/scummvm/scummvm/commit/0344e0adce3361f68c3ec0b92c86878e635e80ad
Author: Strangerke (strangerke at scummvm.org)
Date: 2019-09-19T08:10:49+02:00
Commit Message:
HDB: Simplify some code
Changed paths:
engines/hdb/ai-player.cpp
engines/hdb/hdb.cpp
engines/hdb/input.cpp
diff --git a/engines/hdb/ai-player.cpp b/engines/hdb/ai-player.cpp
index 059da9d..029df3f 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 0de3f32..bc780f6 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 df6d02e..093f525 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) {
More information about the Scummvm-git-logs
mailing list