[Scummvm-git-logs] scummvm master -> c4b52862e81b9ce0d15745b2814ece9969591999
Strangerke
noreply at scummvm.org
Wed Jan 15 06:46:27 UTC 2025
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:
f8d6222b2c GOT: After a check in the original sources, remove two useless checks in mov_patterns
c4b52862e8 GOT: Fix PVS-Studio issue (V519), remove everal GOTOs, fix erroneously reported uninitialized member
Commit: f8d6222b2cf7666ea394be6c0b33b92a5180e8ba
https://github.com/scummvm/scummvm/commit/f8d6222b2cf7666ea394be6c0b33b92a5180e8ba
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-15T07:45:59+01:00
Commit Message:
GOT: After a check in the original sources, remove two useless checks in mov_patterns
Changed paths:
engines/got/game/move_patterns.cpp
diff --git a/engines/got/game/move_patterns.cpp b/engines/got/game/move_patterns.cpp
index 469916ab608..77626bc3dd7 100644
--- a/engines/got/game/move_patterns.cpp
+++ b/engines/got/game/move_patterns.cpp
@@ -302,11 +302,7 @@ int check_move0(int x, int y, ACTOR *actr) {
x1 = x + 1;
y1 = y + 8;
- if (_G(thor)->dir > 1)
- x2 = x + 12;
- else
- x2 = x + 12; // FIXME : This causes a duplicate branch warning in GCC. Need to check as in check_move0() it's 10
-
+ x2 = x + 12;
y2 = y + 15;
_G(thor_special_flag) = false;
@@ -2104,12 +2100,10 @@ int movement_twentyseven(ACTOR *actr) {
void set_thor_vars() {
_G(thor_x1) = _G(thor)->x + 1;
_G(thor_y1) = _G(thor)->y + 8;
+
_G(thor_real_y1) = _G(thor)->y;
- if (_G(thor)->dir > 1)
- _G(thor_x2) = (_G(thor)->x + 12);
- else
- _G(thor_x2) = (_G(thor)->x + 12); // CHECKME : in check_move0() it's 10
+ _G(thor_x2) = (_G(thor)->x + 12);
_G(thor_y2) = _G(thor)->y + 15;
}
Commit: c4b52862e81b9ce0d15745b2814ece9969591999
https://github.com/scummvm/scummvm/commit/c4b52862e81b9ce0d15745b2814ece9969591999
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-15T07:45:59+01:00
Commit Message:
GOT: Fix PVS-Studio issue (V519), remove everal GOTOs, fix erroneously reported uninitialized member
Changed paths:
engines/got/game/back.cpp
engines/got/views/dialogs/select_item.cpp
engines/got/views/dialogs/select_item.h
diff --git a/engines/got/game/back.cpp b/engines/got/game/back.cpp
index 2e6c348cdb3..daee50eb5b8 100644
--- a/engines/got/game/back.cpp
+++ b/engines/got/game/back.cpp
@@ -52,7 +52,6 @@ void show_level(int new_level) {
_G(bomb_flag) = false;
_G(slipping) = false;
- int save_d = _G(thor)->dir;
if (_G(scrn).icon[_G(thor)->center_y][_G(thor)->center_x] == 154)
_G(thor)->dir = 0;
@@ -70,9 +69,10 @@ void show_level(int new_level) {
show_objects();
show_enemies();
+ // The original was probably shortly displaying Thor in direction 0 before switching back to its prior position.
+ // This behavior wasn't noticed during initial playthrough by Dreammaster - Warning has been added so it can be checked eventually.
if (_G(scrn).icon[_G(thor)->center_y][_G(thor)->center_x] == 154)
- _G(thor)->dir = 0;
- _G(thor)->dir = save_d;
+ warning("show_level - Potential short move missing");
if (_G(warp_flag))
_G(current_level) = new_level - 5; // Force phase
@@ -198,14 +198,12 @@ void odin_speaks(int index, int item, const char *endMessage) {
}
int switch_icons() {
- int ix, iy;
-
play_sound(WOOP, false);
for (int y = 0; y < 12; y++) {
for (int x = 0; x < 20; x++) {
- ix = x * 16;
- iy = y * 16;
+ int ix = x * 16;
+ int iy = y * 16;
if (_G(scrn).icon[y][x] == 93) {
place_tile(x, y, 144);
} else if (_G(scrn).icon[y][x] == 144) {
@@ -225,12 +223,10 @@ int switch_icons() {
}
int rotate_arrows() {
- int x, y;
-
play_sound(WOOP, false);
- for (y = 0; y < 12; y++) {
- for (x = 0; x < 20; x++) {
+ for (int y = 0; y < 12; y++) {
+ for (int x = 0; x < 20; x++) {
if (_G(scrn).icon[y][x] == 205)
place_tile(x, y, 208);
else if (_G(scrn).icon[y][x] == 206)
@@ -246,9 +242,9 @@ int rotate_arrows() {
}
void kill_enemies(int iy, int ix) {
- int i, x1, y1, x2, y2;
+ int x1, y1, x2, y2;
- for (i = 3; i < MAX_ACTORS; i++) {
+ for (int i = 3; i < MAX_ACTORS; i++) {
if (_G(actor[i]).used) {
x1 = _G(actor[i]).x;
y1 = _G(actor[i]).y + _G(actor[i]).size_y - 2;
@@ -271,20 +267,11 @@ void kill_enemies(int iy, int ix) {
x2 = x1 + 13;
y2 = y1 + 5;
- if (point_within(x1, y1, ix, iy, ix + 15, iy + 15))
- goto dead;
- if (point_within(x2, y1, ix, iy, ix + 15, iy + 15))
- goto dead;
- if (point_within(x1, y2, ix, iy, ix + 15, iy + 15))
- goto dead;
- if (point_within(x2, y2, ix, iy, ix + 15, iy + 15))
- goto dead;
- return;
-
-dead:
- if (!_G(cheats).freezeHealth) {
- _G(thor)->health = 0;
- g_events->send(GameMessage("THOR_DIES"));
+ if (point_within(x1, y1, ix, iy, ix + 15, iy + 15) || point_within(x2, y1, ix, iy, ix + 15, iy + 15) || point_within(x1, y2, ix, iy, ix + 15, iy + 15) || point_within(x2, y2, ix, iy, ix + 15, iy + 15)) {
+ if (!_G(cheats).freezeHealth) {
+ _G(thor)->health = 0;
+ g_events->send(GameMessage("THOR_DIES"));
+ }
}
}
@@ -320,21 +307,18 @@ void select_item() {
}
int actor_speaks(ACTOR *actr, int index, int item) {
- Common::String str;
- int v;
- long lind;
-
if (actr->type != 4)
return 0;
- v = atoi(actr->name);
+
+ int v = atoi(actr->name);
if (v < 1 || v > 20)
return 0;
- lind = (long)_G(current_level);
+ long lind = (long)_G(current_level);
lind = lind * 1000;
lind += (long)actr->actor_num;
- str = Common::String::format("FACE%d", v);
+ Common::String str = Common::String::format("FACE%d", v);
if (Common::File::exists(Common::Path(str))) {
Gfx::Pics pics(str, 262);
execute_script(lind, pics);
diff --git a/engines/got/views/dialogs/select_item.cpp b/engines/got/views/dialogs/select_item.cpp
index 066ebfdae10..1bdf99d9941 100644
--- a/engines/got/views/dialogs/select_item.cpp
+++ b/engines/got/views/dialogs/select_item.cpp
@@ -34,6 +34,8 @@ static const char *ITEM_NAMES[] = {
};
SelectItem::SelectItem() : Dialog("SelectItem") {
+ _selectedItem = -1;
+
setBounds(Common::Rect(56, 48, 264, 160));
}
diff --git a/engines/got/views/dialogs/select_item.h b/engines/got/views/dialogs/select_item.h
index cf851465904..4994ec2f8c3 100644
--- a/engines/got/views/dialogs/select_item.h
+++ b/engines/got/views/dialogs/select_item.h
@@ -30,7 +30,7 @@ namespace Dialogs {
class SelectItem : public Dialog {
private:
- int _selectedItem = -1;
+ int _selectedItem;
void selectItem();
More information about the Scummvm-git-logs
mailing list