[Scummvm-git-logs] scummvm master -> d62688668beaaf49062d2d691affabd1a7802cf3
Strangerke
noreply at scummvm.org
Mon Feb 16 08:13:02 UTC 2026
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
7282ae9fd4 M4: Small cleanup in console and m4.h/cpp
9ed29dff9e M4: Some cleanup in subtitles and vars
f33ecd121b M4: Add a comment about original dead code in gr_pal
d62688668b M4: BURGER: Start reviewing code, cleanup in Burger code (except the rooms)
Commit: 7282ae9fd466a5ae3ac968ab3cd16ae2d45db0c1
https://github.com/scummvm/scummvm/commit/7282ae9fd466a5ae3ac968ab3cd16ae2d45db0c1
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-02-16T09:12:03+01:00
Commit Message:
M4: Small cleanup in console and m4.h/cpp
Changed paths:
engines/m4/console.cpp
engines/m4/m4.cpp
engines/m4/m4.h
diff --git a/engines/m4/console.cpp b/engines/m4/console.cpp
index d735972f64b..e97518c8449 100644
--- a/engines/m4/console.cpp
+++ b/engines/m4/console.cpp
@@ -40,24 +40,24 @@ Console::Console() : ::GUI::Debugger() {
}
bool Console::cmdTeleport(int argc, const char **argv) {
- if (argc == 2) {
- _G(game).setRoom(atol(argv[1]));
- _G(kernel).teleported_in = true;
- return false;
- } else {
+ if (argc != 2) {
debugPrintf("Currently in room %d\n", _G(game).room_id);
return true;
}
+
+ _G(game).setRoom(atol(argv[1]));
+ _G(kernel).teleported_in = true;
+ return false;
}
bool Console::cmdItem(int argc, const char **argv) {
- if (argc == 2) {
- inv_give_to_player(argv[1]);
- return false;
- } else {
+ if (argc != 2) {
debugPrintf("item <item name>\n");
return true;
}
+
+ inv_give_to_player(argv[1]);
+ return false;
}
bool Console::cmdHyperwalk(int argc, const char **argv) {
@@ -75,22 +75,20 @@ bool Console::cmdDigi(int argc, const char **argv) {
if (argc != 2) {
debugPrintf("digi <sound name>\n");
return true;
- } else {
- digi_play(argv[1], 1);
- return false;
}
- return true;
+ digi_play(argv[1], 1);
+ return false;
}
bool Console::cmdTrigger(int argc, const char **argv) {
if (argc == 2) {
kernel_trigger_dispatch_now(atol(argv[1]));
return false;
- } else {
- debugPrintf("trigger <number>\n");
- return true;
}
+
+ debugPrintf("trigger <number>\n");
+ return true;
}
bool Console::cmdCels(int argc, const char **argv) {
@@ -111,7 +109,7 @@ bool Console::cmdCel(int argc, const char **argv) {
if (argc != 2) {
debugPrintf("cel <cel number>\n");
} else {
- int num = atol(argv[1]);
+ const int num = atol(argv[1]);
if (!_GWS(globalCELSHandles)[num]) {
debugPrintf("cel index not in use\n");
@@ -136,16 +134,16 @@ bool Console::cmdInterface(int argc, const char **argv) {
if (argc < 2) {
debugPrintf("interface ['show', 'hide']\n");
return true;
- } else {
- Common::String param(argv[1]);
+ }
- if (param == "hide" || param == "off" || param == "false")
- interface_hide();
- else
- interface_show();
+ Common::String param(argv[1]);
- return false;
- }
+ if (param == "hide" || param == "off" || param == "false")
+ interface_hide();
+ else
+ interface_show();
+
+ return false;
}
bool Console::cmdMusic(int argc, const char **argv) {
@@ -153,10 +151,10 @@ bool Console::cmdMusic(int argc, const char **argv) {
debugPrintf("music <name>\n");
midi_play("ripthem1", 255, false, -1, 999);
return true;
- } else {
- midi_play(argv[1], 255, false, -1, 999);
- return false;
}
+
+ midi_play(argv[1], 255, false, -1, 999);
+ return false;
}
bool Console::cmdHotspots(int argc, const char **argv) {
diff --git a/engines/m4/m4.cpp b/engines/m4/m4.cpp
index 6c32690e2df..da3d58dab80 100644
--- a/engines/m4/m4.cpp
+++ b/engines/m4/m4.cpp
@@ -74,10 +74,11 @@ Common::Language M4Engine::getLanguage() const {
int M4Engine::isDemo() const {
if ((getFeatures() & ADGF_DEMO) == 0)
return GStyle_Game;
- else if (_gameDescription->features & kFeaturesNonInteractiveDemo)
+
+ if (_gameDescription->features & kFeaturesNonInteractiveDemo)
return GStyle_NonInteractiveDemo;
- else
- return GStyle_Demo;
+
+ return GStyle_Demo;
}
Common::Error M4Engine::run() {
diff --git a/engines/m4/m4.h b/engines/m4/m4.h
index 5d5d24ba019..7f2b23ba61b 100644
--- a/engines/m4/m4.h
+++ b/engines/m4/m4.h
@@ -26,13 +26,11 @@
#include "common/system.h"
#include "common/error.h"
#include "common/fs.h"
-#include "common/hash-str.h"
#include "common/random.h"
#include "common/serializer.h"
#include "common/util.h"
#include "engines/engine.h"
#include "engines/savestate.h"
-#include "graphics/screen.h"
#include "m4/detection.h"
#include "m4/vars.h"
Commit: 9ed29dff9e5b06848fcc22d08ba3c75eed951430
https://github.com/scummvm/scummvm/commit/9ed29dff9e5b06848fcc22d08ba3c75eed951430
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-02-16T09:12:04+01:00
Commit Message:
M4: Some cleanup in subtitles and vars
Changed paths:
engines/m4/subtitles.cpp
engines/m4/vars.cpp
diff --git a/engines/m4/subtitles.cpp b/engines/m4/subtitles.cpp
index 74105729192..2e5d87f73d0 100644
--- a/engines/m4/subtitles.cpp
+++ b/engines/m4/subtitles.cpp
@@ -66,11 +66,11 @@ void M4Subtitles::setupSubtitles() {
int16 h = g_system->getOverlayHeight();
int16 w = g_system->getOverlayWidth();
- int fontSize = MAX(MIN_FONT_SIZE, int(h * BASE_FONT_SIZE_PERCENT));
+ const int fontSize = MAX(MIN_FONT_SIZE, int(h * BASE_FONT_SIZE_PERCENT));
- int bottomMargin = int(h * BOTTOM_MARGIN_PERCENT);
+ const int bottomMargin = int(h * BOTTOM_MARGIN_PERCENT);
- int topOffset = int(h * DEFAULT_HEIGHT_PERCENT);
+ const int topOffset = int(h * DEFAULT_HEIGHT_PERCENT);
setBBox(Common::Rect(HORIZONTAL_MARGIN,
h - topOffset,
w - HORIZONTAL_MARGIN,
@@ -97,7 +97,7 @@ void M4Subtitles::drawSubtitle(const Common::String &audioFile) const {
if (!_loaded || !_subtitlesEnabled)
return;
- Common::String subtitle = getSubtitle(audioFile);
+ const Common::String subtitle = getSubtitle(audioFile);
if (subtitle.empty())
return;
@@ -113,8 +113,8 @@ void M4Subtitles::drawSubtitle(const Common::String &audioFile) const {
int16 M4Subtitles::nudgeSubtitle() const {
// Nudge subtitle text box upwards, depending on the lines to draw
- int16 h = g_system->getOverlayHeight();
- int fontSize = MAX(MIN_FONT_SIZE, int(h * BASE_FONT_SIZE_PERCENT));
+ const int16 h = g_system->getOverlayHeight();
+ const int fontSize = MAX(MIN_FONT_SIZE, int(h * BASE_FONT_SIZE_PERCENT));
return _splitPartCount > 0 ? static_cast<int16>((_splitPartCount - 1) * fontSize) : 0;
}
diff --git a/engines/m4/vars.cpp b/engines/m4/vars.cpp
index 51f311fafa5..78f73fe307a 100644
--- a/engines/m4/vars.cpp
+++ b/engines/m4/vars.cpp
@@ -136,7 +136,7 @@ void Vars::game_systems_initialize(byte flags) {
fire_up_gui();
if (flags & INSTALL_SOUND_DRIVERS) {
- int result = _midi.open();
+ const int result = _midi.open();
if (result > 0)
warning("MIDI Player init failed: \"%s\"", MidiDriver::getErrorName(result));
} else {
@@ -266,7 +266,7 @@ void Vars::create_mouse_watch_dialog() {
gr_font_set(_font_tiny);
_mousePosDialog = DialogCreateAbsolute(0, 380, 200, 480, 3 | SF_GET_MOUSE);
_showMousePos = false;
- int x_offset = 64;
+ const int x_offset = 64;
Dialog_Add_Message(_mousePosDialog, 4, 4, "Scene:", 0);
Dialog_Add_Message(_mousePosDialog, x_offset, 4, "0", 1);
@@ -298,8 +298,6 @@ void Vars::create_mouse_watch_dialog() {
}
void Vars::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
- int32 maxW, maxH;
-
_mouseSeriesHandle = nullptr;
_mouseSeriesOffset = 0;
_mouseSeriesPalOffset = 0;
@@ -312,6 +310,7 @@ void Vars::initMouseSeries(const Common::String &assetName, RGB8 *myPalette) {
if (LoadSpriteSeries(assetName.c_str(), &_mouseSeriesHandle, &_mouseSeriesOffset, &_mouseSeriesPalOffset, myPalette) > 0) {
_mouseSeriesResource = assetName;
+ int32 maxW, maxH;
if (ws_GetSSMaxWH(_mouseSeriesHandle, _mouseSeriesOffset, &maxW, &maxH)) {
if (maxW && maxH) {
_mouseBuffer.data = (byte *)mem_alloc(maxW * maxH, "mouse graphic");
Commit: f33ecd121bb6b2302ea090ff2614f18095590472
https://github.com/scummvm/scummvm/commit/f33ecd121bb6b2302ea090ff2614f18095590472
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-02-16T09:12:05+01:00
Commit Message:
M4: Add a comment about original dead code in gr_pal
Changed paths:
engines/m4/graphics/gr_pal.cpp
diff --git a/engines/m4/graphics/gr_pal.cpp b/engines/m4/graphics/gr_pal.cpp
index bb43160cd08..abeb01a84a6 100644
--- a/engines/m4/graphics/gr_pal.cpp
+++ b/engines/m4/graphics/gr_pal.cpp
@@ -112,6 +112,9 @@ void gr_pal_interface(RGB8 *fixpal) {
if (_GI().set_interface_palette(fixpal))
return;
+ // The following code is unreachable as set_interface_palette always returns true
+ // This is also present in the original code
+ //
// Low intensity
gr_pal_set_RGB8(&fixpal[0], 0, 0, 0); // r0 g0 b0 black
gr_pal_set_RGB8(&fixpal[1], 0, 0, 168); // r0 g0 b2 blue
Commit: d62688668beaaf49062d2d691affabd1a7802cf3
https://github.com/scummvm/scummvm/commit/d62688668beaaf49062d2d691affabd1a7802cf3
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-02-16T09:12:06+01:00
Commit Message:
M4: BURGER: Start reviewing code, cleanup in Burger code (except the rooms)
Changed paths:
engines/m4/burger/burger.cpp
engines/m4/burger/console.cpp
engines/m4/burger/core/conv.h
engines/m4/burger/core/stream_break.cpp
engines/m4/burger/flags.cpp
engines/m4/burger/gui/game_menu.cpp
engines/m4/burger/gui/game_menu.h
engines/m4/burger/gui/gui.h
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/gui/interface.cpp
engines/m4/burger/gui/interface.h
engines/m4/burger/gui/inventory.cpp
engines/m4/burger/hotkeys.h
engines/m4/burger/inventory.cpp
engines/m4/burger/other.cpp
engines/m4/burger/rooms/section3/room301.cpp
engines/m4/burger/vars.cpp
engines/m4/burger/vars.h
engines/m4/burger/walker.cpp
engines/m4/burger/walker.h
diff --git a/engines/m4/burger/burger.cpp b/engines/m4/burger/burger.cpp
index d69edbbd815..7f71bc5ff95 100644
--- a/engines/m4/burger/burger.cpp
+++ b/engines/m4/burger/burger.cpp
@@ -20,6 +20,7 @@
*/
#include "common/debug.h"
+#include "m4/burger/inventory.h"
#include "m4/burger/burger.h"
#include "m4/burger/console.h"
#include "m4/burger/vars.h"
@@ -35,55 +36,55 @@ namespace M4 {
namespace Burger {
static const seriesPlayBreak PLAY_BREAKS1[] = {
- { 0, 17, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
- { 18, 18, nullptr, 0, 0, 10008, 0, 0, 0, 0 },
- { 19, 21, "999blow", 1, 125, -1, 0, -1, 0, 0 },
- { 22, 30, nullptr, 0, 0, -1, 0, 0, 0, 0 },
- { 7, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
- { -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
+ { 0, 17, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 18, 18, nullptr, 0, 0, 10008, 0, 0, nullptr, 0 },
+ { 19, 21, "999blow", 1, 125, -1, 0, -1, nullptr, 0 },
+ { 22, 30, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 7, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 }
};
static const seriesPlayBreak PLAY_BREAKS2[] = {
- { 0, 11, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
- { 12, 13, nullptr, 0, 0, -1, 0, 5, 0, 0 },
- { 14, 26, "302w002", 1, 255, -1, 0, 0, 0, 0 },
- { 7, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
- { -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
+ { 0, 11, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 12, 13, nullptr, 0, 0, -1, 0, 5, nullptr, 0 },
+ { 14, 26, "302w002", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 }
};
static const seriesPlayBreak PLAY_BREAKS3[] = {
- { 0, 14, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
- { 15, 16, "600_008", 2, 255, -1, 0, 0, 0, 0 },
- { 17, 21, "602w012", 1, 255, -1, 0, 0, 0, 0 },
- { 7, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
- { -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
+ { 0, 14, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 15, 16, "600_008", 2, 255, -1, 0, 0, nullptr, 0 },
+ { 17, 21, "602w012", 1, 255, -1, 0, 0, nullptr, 0 },
+ { 7, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 }
};
static const seriesPlayBreak PLAY_BREAKS4[] = {
- { 0, 12, 0, 1, 0, -1, 2048, 0, 0, 0 },
- { 12, 13, "500_004", 1, 255, -1, 0, 2, 0, 0 },
- { 12, 0, 0, 0, 0, -1, 0, 0, 0, 0 },
- { -1, -1, 0, 0, 0, -1, 0, 0, 0, 0 }
+ { 0, 12, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 12, 13, "500_004", 1, 255, -1, 0, 2, nullptr, 0 },
+ { 12, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 }
};
static const seriesPlayBreak PLAY_BREAKS5[] = {
- { 0, 15, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
- { 16, 20, "999_001", 1, 200, -1, 0, 0, 0, 0 },
- { 19, 19, nullptr, 0, 0, -1, 0, 0, 0, 0 },
- { 15, 18, "999_001", 1, 200, -1, 0, 0, 0, 0 },
- { 15, 18, "999_001", 1, 200, -1, 0, 0, 0, 0 },
- { 14, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
- { -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
+ { 0, 15, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 16, 20, "999_001", 1, 200, -1, 0, 0, nullptr, 0 },
+ { 19, 19, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 15, 18, "999_001", 1, 200, -1, 0, 0, nullptr, 0 },
+ { 15, 18, "999_001", 1, 200, -1, 0, 0, nullptr, 0 },
+ { 14, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 }
};
static const seriesPlayBreak PLAY_BREAKS6[] = {
- { 0, 15, nullptr, 1, 0, -1, 2048, 0, 0, 0 },
- { 16, 23, "999_001", 1, 200, -1, 0, 0, 0, 0 },
- { 24, 30, "999_002", 1, 200, -1, 0, 0, 0, 0 },
- { 31, 34, nullptr, 1, 200, -1, 0, 0, 0, 0 },
- { 34, 34, nullptr, 0, 0, -1, 0, 0, 0, 0 },
- { 14, 0, nullptr, 0, 0, -1, 0, 0, 0, 0 },
- { -1, -1, nullptr, 0, 0, -1, 0, 0, 0, 0 }
+ { 0, 15, nullptr, 1, 0, -1, 2048, 0, nullptr, 0 },
+ { 16, 23, "999_001", 1, 200, -1, 0, 0, nullptr, 0 },
+ { 24, 30, "999_002", 1, 200, -1, 0, 0, nullptr, 0 },
+ { 31, 34, nullptr, 1, 200, -1, 0, 0, nullptr, 0 },
+ { 34, 34, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { 14, 0, nullptr, 0, 0, -1, 0, 0, nullptr, 0 },
+ { -1, -1, nullptr, 0, 0, -1, 0, 0, nullptr, 0 }
};
static const char *SAID1[][4] = {
@@ -333,7 +334,7 @@ void BurgerEngine::global_daemon() {
case kAdvanceHour:
if (!player_commands_allowed() && !_G(flags)[V299] && _G(my_walker) &&
_G(player).walker_in_this_scene && _G(player).walker_visible)
- sendWSMessage(0, 0, _G(my_walker), 0, 0, 1);
+ sendWSMessage(0, 0, _G(my_walker), 0, nullptr, 1);
kernel_timing_trigger(imath_ranged_rand(900, 1800), kAdvanceHour);
break;
@@ -734,8 +735,8 @@ void BurgerEngine::testDone5() {
#define MAX_INT 0x7FFFFFFF
void BurgerEngine::wilburTeleported() {
- KernelTriggerType oldMode = _G(kernel).trigger_mode;
- int oldSection = _G(game).section_id;
+ const KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ const int oldSection = _G(game).section_id;
switch (oldSection) {
case 3:
@@ -770,31 +771,29 @@ void BurgerEngine::wilburTeleported() {
if (_G(executing) != WHOLE_GAME) {
_G(flags).reset2();
_G(game).setRoom(604);
+ } else if (_G(flags)[kFifthTestPassed]) {
+ testDone5();
+ kernel_trigger_dispatch_now(10033);
+ } else if (_G(flags)[kFourthTestPassed] && !_G(flags)[V153]) {
+ testDone4();
+ _G(game).setRoom(207);
+ } else if (_G(flags)[kThirdTestPassed] && !_G(flags)[V185]) {
+ testDone3();
+ _G(game).setRoom(207);
+ } else if (_G(flags)[kSecondTestPassed] && !_G(flags)[V100]) {
+ testDone2();
+ _G(game).setRoom(207);
+ } else if (_G(flags)[kFirstTestPassed] && !_G(flags)[V242]) {
+ testDone1();
+ _G(game).setRoom(204);
} else {
- if (_G(flags)[kFifthTestPassed]) {
- testDone5();
- kernel_trigger_dispatch_now(10033);
- } else if (_G(flags)[kFourthTestPassed] && !_G(flags)[V153]) {
- testDone4();
- _G(game).setRoom(207);
- } else if (_G(flags)[kThirdTestPassed] && !_G(flags)[V185]) {
- testDone3();
- _G(game).setRoom(207);
- } else if (_G(flags)[kSecondTestPassed] && !_G(flags)[V100]) {
- testDone2();
- _G(game).setRoom(207);
- } else if (_G(flags)[kFirstTestPassed] && !_G(flags)[V242]) {
- testDone1();
- _G(game).setRoom(204);
- } else {
- static_cast<Inventory *>(_G(inventory))->reset();
- _G(flags).reset5();
- _G(flags).reset4();
- _G(flags).reset3();
- _G(flags).reset2();
- _G(flags).reset1();
- _G(game).setRoom(101);
- }
+ static_cast<Inventory *>(_G(inventory))->reset();
+ _G(flags).reset5();
+ _G(flags).reset4();
+ _G(flags).reset3();
+ _G(flags).reset2();
+ _G(flags).reset1();
+ _G(game).setRoom(101);
}
_G(kernel).trigger_mode = oldMode;
@@ -830,8 +829,8 @@ bool BurgerEngine::canLoadGameStateCurrently(Common::U32String *msg) {
if (g_vars && _G(game).room_id == 903)
// Allow loading games from the main menu
return true;
- else
- return M4Engine::canLoadGameStateCurrently(msg);
+
+ return M4Engine::canLoadGameStateCurrently(msg);
}
} // namespace Burger
diff --git a/engines/m4/burger/console.cpp b/engines/m4/burger/console.cpp
index c1482870f5b..26d8d4f8bcb 100644
--- a/engines/m4/burger/console.cpp
+++ b/engines/m4/burger/console.cpp
@@ -38,7 +38,7 @@ bool Console::cmdGlobal(int argc, const char **argv) {
debugPrintf("Flag %d = %d\n", flagNum, _G(flags)[(Flag)flagNum]);
} else if (argc == 3) {
int flagNum = atol(argv[1]);
- int flagVal = atol(argv[2]);
+ const int flagVal = atol(argv[2]);
_G(flags)[(Flag)flagNum] = flagVal;
debugPrintf("Flag set\n");
} else {
@@ -49,11 +49,8 @@ bool Console::cmdGlobal(int argc, const char **argv) {
}
bool Console::cmdTest(int argc, const char **argv) {
- int tests = _G(flags)[kFirstTestPassed] ? 1 : 0 +
- _G(flags)[kSecondTestPassed] ? 1 : 0 +
- _G(flags)[kThirdTestPassed] ? 1 : 0 +
- _G(flags)[kFourthTestPassed] ? 1 : 0 +
- _G(flags)[kFifthTestPassed] ? 1 : 0;
+ const int tests = _G(flags)[kFirstTestPassed] ? 1 : 0 + _G(flags)[kSecondTestPassed] ? 1 : 0 +
+ _G(flags)[kThirdTestPassed] ? 1 : 0 + _G(flags)[kFourthTestPassed] ? 1 : 0 + _G(flags)[kFifthTestPassed] ? 1 : 0;
debugPrintf("Tests passed = %d\n", tests);
return true;
@@ -61,14 +58,13 @@ bool Console::cmdTest(int argc, const char **argv) {
bool Console::cmdTime(int argc, const char **argv) {
if (argc == 2) {
- int newTime = atol(argv[1]);
+ const int newTime = atol(argv[1]);
_G(flags).set_boonsville_time(newTime - 1);
return false;
-
- } else {
- debugPrintf("Current time is %d\n", _G(flags)[kBoonsvilleTime]);
- return true;
}
+
+ debugPrintf("Current time is %d\n", _G(flags)[kBoonsvilleTime]);
+ return true;
}
} // End of namespace Burger
diff --git a/engines/m4/burger/core/conv.h b/engines/m4/burger/core/conv.h
index b6aa259c314..9dbeb7bf4a3 100644
--- a/engines/m4/burger/core/conv.h
+++ b/engines/m4/burger/core/conv.h
@@ -23,8 +23,6 @@
#ifndef M4_BURGER_CORE_CONV_H
#define M4_BURGER_CORE_CONV_H
-#include "m4/m4_types.h"
-
namespace M4 {
namespace Burger {
diff --git a/engines/m4/burger/core/stream_break.cpp b/engines/m4/burger/core/stream_break.cpp
index ecf15adc391..fd0d04a19aa 100644
--- a/engines/m4/burger/core/stream_break.cpp
+++ b/engines/m4/burger/core/stream_break.cpp
@@ -48,7 +48,7 @@ static void set_next_series_stream_break() {
}
void handle_series_stream_break() {
- int32 thisFrame = _GB(my_stream_break)->frame;
+ const int32 thisFrame = _GB(my_stream_break)->frame;
auto &streamBreak = _GB(my_stream_break);
// Handle all breaks for this frame number (only one series break can occur on each frame)
diff --git a/engines/m4/burger/flags.cpp b/engines/m4/burger/flags.cpp
index 9f181461f59..8755ef0e21c 100644
--- a/engines/m4/burger/flags.cpp
+++ b/engines/m4/burger/flags.cpp
@@ -62,7 +62,7 @@ Flags::Flags() {
}
void Flags::sync(Common::Serializer &s) {
- size_t count = size();
+ const size_t count = size();
for (uint i = 0; i < count; ++i)
s.syncAsSint32LE(_flags[i]);
}
@@ -74,9 +74,9 @@ void Flags::reset() {
int32 Flags::get_boonsville_time_and_display(bool showTime) {
if (showTime) {
int time = (*this)[kBoonsvilleTime];
- int seconds = time % 60;
+ const int seconds = time % 60;
time /= 60;
- int minutes = time % 60;
+ const int minutes = time % 60;
time /= 60;
term_message("Boonsville time: %d:%d:%d", time, minutes, seconds);
@@ -94,21 +94,19 @@ bool Flags::advance_boonsville_time_and_check_schedule(int32 time) {
if (player_commands_allowed() && _G(player).walker_visible && INTERFACE_VISIBLE) {
(*this)[kBoonsvillePriorTime] = (*this)[kBoonsvilleTime];
(*this)[kBoonsvilleTime] += time;
- return dispatch_scheduled_boonsville_time_trigger(
- get_boonsville_time_and_display());
- } else {
- return false;
+ return dispatch_scheduled_boonsville_time_trigger(get_boonsville_time_and_display());
}
+
+ return false;
}
bool Flags::dispatch_scheduled_boonsville_time_trigger(int32 time) {
- KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ const KernelTriggerType oldMode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
bool result = false;
for (const BoonsvilleEvent *rec = EVENTS; rec->_time; ++rec) {
- if ((*this)[kBoonsvilleTime] >= rec->_time &&
- (*this)[kBoonsvillePriorTime] < rec->_time) {
+ if ((*this)[kBoonsvilleTime] >= rec->_time && (*this)[kBoonsvillePriorTime] < rec->_time) {
result = true;
term_message("Time for: %s", rec->_text);
schedule_boonsville_time();
@@ -121,18 +119,18 @@ bool Flags::dispatch_scheduled_boonsville_time_trigger(int32 time) {
}
void Flags::schedule_boonsville_time() {
- int theTime = get_boonsville_time_and_display();
- int hours = theTime / 216000;
- int minutes = (theTime % 216000) / 3600;
- int seconds = (theTime % 3600) / 60;
+ const int theTime = get_boonsville_time_and_display();
+ const int hours = theTime / 216000;
+ const int minutes = (theTime % 216000) / 3600;
+ const int seconds = (theTime % 3600) / 60;
bool flag = false;
term_message("************ Schedule ************");
for (const auto &te : EVENTS) {
- int teHours = te._time / 216000;
- int teMinutes = (te._time % 216000) / 3600;
- int teSeconds = (te._time % 3600) / 60;
+ const int teHours = te._time / 216000;
+ const int teMinutes = (te._time % 216000) / 3600;
+ const int teSeconds = (te._time % 3600) / 60;
if (te._time <= theTime) {
term_message("done %1d:%2d:%2d %s", teHours, teMinutes, teSeconds, te._text);
diff --git a/engines/m4/burger/gui/game_menu.cpp b/engines/m4/burger/gui/game_menu.cpp
index c5a75eba3a7..738d38b8362 100644
--- a/engines/m4/burger/gui/game_menu.cpp
+++ b/engines/m4/burger/gui/game_menu.cpp
@@ -21,7 +21,6 @@
#include "graphics/thumbnail.h"
#include "m4/burger/gui/game_menu.h"
-#include "m4/burger/gui/interface.h"
#include "m4/adv_r/other.h"
#include "m4/adv_r/adv_player.h"
#include "m4/core/errors.h"
@@ -29,7 +28,6 @@
#include "m4/gui/gui_event.h"
#include "m4/gui/gui_menu_items.h"
#include "m4/gui/hotkeys.h"
-#include "m4/graphics/gr_sprite.h"
#include "m4/gui/gui_sys.h"
#include "m4/gui/gui_vmng.h"
#include "m4/mem/mem.h"
@@ -671,6 +669,9 @@ void SaveLoadMenu::cb_SaveLoad_VSlider(menuItemVSlider *myItem, guiMenu *myMenu)
redraw = (DrawFunction)true;
}
break;
+
+ default:
+ break;
}
// See if we were able to set a new first slot index
@@ -714,8 +715,7 @@ void SaveLoadMenu::cb_SaveLoad_Save(void *, guiMenu *myMenu) {
Common::strcpy_s(_GM(slotTitles)[_GM(slotSelected) - 1], 80, myText->prompt);
// Save the game
- bool saveGameFailed = !g_engine->saveGameFromMenu(_GM(slotSelected),
- myText->prompt, _GM(_thumbnail));
+ const bool saveGameFailed = !g_engine->saveGameFromMenu(_GM(slotSelected), myText->prompt, _GM(_thumbnail));
// If the save game failed, bring up the err menu
if (saveGameFailed) {
@@ -777,10 +777,10 @@ void SaveLoadMenu::cb_SaveLoad_Cancel(menuItemButton *, guiMenu *myMenu) {
// Find the textfield and use it's coords to place the button
menuItem *myItem = guiMenu::getItem(2000, myMenu);
- int32 x = myItem->x1;
- int32 y = myItem->y1;
- int32 w = myItem->x2 - myItem->x1 + 1;
- int32 h = myItem->y2 - myItem->y1 + 1;
+ const int32 x = myItem->x1;
+ const int32 y = myItem->y1;
+ const int32 w = myItem->x2 - myItem->x1 + 1;
+ const int32 h = myItem->y2 - myItem->y1 + 1;
// Delete the textfield
guiMenu::itemDelete(myItem, 2000, myMenu);
@@ -845,7 +845,7 @@ void SaveLoadMenu::cb_SaveLoad_Slot(menuItemButton *myButton, guiMenu *myMenu) {
// Get the button
Common::strcpy_s(prompt, 80, myButton->prompt);
- int32 specialTag = myButton->specialTag;
+ const int32 specialTag = myButton->specialTag;
// Set the globals
_GM(slotSelected) = myButton->specialTag;
@@ -860,10 +860,10 @@ void SaveLoadMenu::cb_SaveLoad_Slot(menuItemButton *myButton, guiMenu *myMenu) {
}
// Get the slot coords, and delete it
- int32 x = myButton->x1;
- int32 y = myButton->y1;
- int32 w = myButton->x2 - myButton->x1 + 1;
- int32 h = myButton->y2 - myButton->y1 + 1;
+ const int32 x = myButton->x1;
+ const int32 y = myButton->y1;
+ const int32 w = myButton->x2 - myButton->x1 + 1;
+ const int32 h = myButton->y2 - myButton->y1 + 1;
guiMenu::itemDelete(myButton, -1, myMenu);
if (_GM(currMenuIsSave)) {
@@ -896,7 +896,7 @@ void SaveLoadMenu::cb_SaveLoad_Slot(menuItemButton *myButton, guiMenu *myMenu) {
bool SaveLoadMenu::load_Handler(menuItemButton *myItem, int32 eventType, int32 event, int32 x, int32 y, void **currItem) {
// Handle the event just like any other button
- bool handled = menuItemButton::handler(myItem, eventType, event, x, y, currItem);
+ const bool handled = menuItemButton::handler(myItem, eventType, event, x, y, currItem);
// If we've selected a slot, we want the thumbNail to remain on the menu permanently
if (_GM(slotSelected) >= 0) {
@@ -954,15 +954,6 @@ void CreateGameMenu(RGB8 *myPalette) {
GameMenu::show(myPalette);
}
-void CreateGameMenuFromMain(RGB8 *myPalette) {
- if (_G(pal_fade_in_progress) || _G(menuSystemInitialized)) {
- return;
- }
-
- _GM(gameMenuFromMain) = true;
- GameMenu::show(myPalette);
-}
-
void CreateSaveMenu(RGB8 *myPalette) {
_GM(saveLoadFromHotkey) = false;
SaveLoadMenu::show(myPalette, true);
diff --git a/engines/m4/burger/gui/game_menu.h b/engines/m4/burger/gui/game_menu.h
index 784a61c9d36..1238570121d 100644
--- a/engines/m4/burger/gui/game_menu.h
+++ b/engines/m4/burger/gui/game_menu.h
@@ -25,10 +25,8 @@
#include "graphics/surface.h"
#include "m4/m4_types.h"
-#include "m4/graphics/gr_buff.h"
#include "m4/gui/gui_menu_items.h"
#include "m4/gui/game_menu.h"
-#include "m4/gui/gui_univ.h"
namespace M4 {
namespace Burger {
@@ -106,7 +104,6 @@ extern void CreateF3LoadMenu(RGB8 *myPalette);
// Routines used by the main menu
void CreateLoadMenuFromMain(RGB8 *myPalette);
-void CreateGameMenuFromMain(RGB8 *myPalette);
} // namespace GUI
} // namespace Burger
diff --git a/engines/m4/burger/gui/gui.h b/engines/m4/burger/gui/gui.h
index d1b5f936628..33fdd66deb3 100644
--- a/engines/m4/burger/gui/gui.h
+++ b/engines/m4/burger/gui/gui.h
@@ -23,9 +23,6 @@
#ifndef M4_BURGER_GUI_H
#define M4_BURGER_GUI_H
-#include "m4/burger/gui/game_menu.h"
-#include "m4/burger/gui/interface.h"
-
namespace M4 {
namespace Burger {
namespace GUI {
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index 772f72250a7..b4c7bf39e61 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -194,7 +194,7 @@ static void gizmo_digi_wait(int spriteIndex1, int spriteIndex2) {
gizmo_restore_sprite(spriteNum);
spriteNum = (spriteNum == spriteIndex2) ? spriteIndex1 : spriteNum + 1;
- uint32 timer = timer_read_60();
+ const uint32 timer = timer_read_60();
while (!g_engine->shouldQuit() && (timer_read_60() - timer) < 6)
gizmo_sound();
@@ -368,8 +368,7 @@ static void gizmo_free_gui(Gizmo *gizmo) {
}
GrBuff *grBuff = gizmo->_grBuff;
- if (grBuff)
- delete grBuff;
+ delete grBuff;
mem_free(gizmo);
}
diff --git a/engines/m4/burger/gui/interface.cpp b/engines/m4/burger/gui/interface.cpp
index c33c270f04c..755b0478f41 100644
--- a/engines/m4/burger/gui/interface.cpp
+++ b/engines/m4/burger/gui/interface.cpp
@@ -23,7 +23,9 @@
#include "m4/core/cstring.h"
#include "m4/core/errors.h"
#include "m4/graphics/gr_series.h"
+#include "m4/graphics/graphics.h"
#include "m4/gui/gui_event.h"
+#include "m4/burger/gui/game_menu.h"
#include "m4/burger/burger.h"
#include "m4/burger/vars.h"
#include "m4/adv_r/other.h"
@@ -273,7 +275,7 @@ void Interface::refresh_left_arrow() {
}
void Interface::trackIcons() {
- KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ const KernelTriggerType oldMode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
switch (_interfaceBox->_highlight_index) {
@@ -359,6 +361,9 @@ void Interface::trackIcons() {
}
break;
+ default:
+ break;
+
}
_G(kernel).trigger_mode = oldMode;
@@ -411,9 +416,9 @@ ControlStatus Interface::trackHotspots(int event, int x, int y) {
_hotspot = nullptr;
return SELECTED;
- } else {
- return IN_CONTROL;
}
+
+ return IN_CONTROL;
}
void Interface::dispatch_command() {
@@ -439,8 +444,8 @@ void Interface::dispatch_command() {
}
void Interface::handleState(ControlStatus status) {
- int highlight = _inventory->_highlight;
- int index = _inventory->_scroll + highlight;
+ const int highlight = _inventory->_highlight;
+ const int index = _inventory->_scroll + highlight;
switch (status) {
case NOTHING:
diff --git a/engines/m4/burger/gui/interface.h b/engines/m4/burger/gui/interface.h
index ff4d8f97176..c449df0ddfe 100644
--- a/engines/m4/burger/gui/interface.h
+++ b/engines/m4/burger/gui/interface.h
@@ -25,7 +25,6 @@
#include "m4/adv_r/adv_interface.h"
#include "m4/adv_r/adv_hotspot.h"
-#include "m4/graphics/graphics.h"
#include "m4/burger/gui/inventory.h"
namespace M4 {
diff --git a/engines/m4/burger/gui/inventory.cpp b/engines/m4/burger/gui/inventory.cpp
index 6d4c98fa5e0..8c3bb318051 100644
--- a/engines/m4/burger/gui/inventory.cpp
+++ b/engines/m4/burger/gui/inventory.cpp
@@ -144,19 +144,19 @@ int16 Inventory::inside(int16 x, int16 y) const {
int16 Inventory::cell_pos_x(int16 index) {
if (_cells_h > _cells_v) { // Horizontal orientation, fill left to right
return (int16)((index / _cells_v) * _cell_w);
- } else { // Vertical orientation, fill top to bottom
- return (int16)((index / _cells_h) * _cell_w);
}
+
+ return (int16)((index / _cells_h) * _cell_w);
}
int16 Inventory::cell_pos_y(int16 index) {
if (_cells_h > _cells_v) {
// Horizontal orientation, fill left to right
return (int16)((index % _cells_v) * _cell_h);
- } else {
- // Vertical orientation, fill top to bottom
- return (int16)((index % _cells_h) * _cell_h);
}
+
+ // Vertical orientation, fill top to bottom
+ return (int16)((index % _cells_h) * _cell_h);
}
void Inventory::highlight_part(int16 index) {
@@ -233,10 +233,10 @@ ControlStatus Inventory::track(int32 eventType, int16 x, int16 y) {
if (!_GI(visible))
return NOTHING;
- ControlStatus result = NOTHING;
+ ControlStatus result;
- int16 over = inside(x, y);
- bool button_clicked = eventType == _ME_L_click || eventType == _ME_L_hold || eventType == _ME_L_drag;
+ const int16 over = inside(x, y);
+ const bool button_clicked = eventType == _ME_L_click || eventType == _ME_L_hold || eventType == _ME_L_drag;
// If Button is pressed
if (button_clicked) {
diff --git a/engines/m4/burger/hotkeys.h b/engines/m4/burger/hotkeys.h
index 24fc39b8898..1a0051dd4b8 100644
--- a/engines/m4/burger/hotkeys.h
+++ b/engines/m4/burger/hotkeys.h
@@ -23,9 +23,7 @@
#ifndef M4_BURGER_HOTKEYS_H
#define M4_BURGER_HOTKEYS_H
-#include "m4/m4_types.h"
#include "m4/gui/hotkeys.h"
-#include "m4/core/mouse.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/burger/inventory.cpp b/engines/m4/burger/inventory.cpp
index c1e82bb9dc6..85d4433f561 100644
--- a/engines/m4/burger/inventory.cpp
+++ b/engines/m4/burger/inventory.cpp
@@ -77,7 +77,7 @@ static const InvObject INVENTORY_ITEMS[] = {
};
void Inventory::init() {
- bool isFrench = g_engine->getLanguage() == Common::FR_FRA;
+ const bool isFrench = g_engine->getLanguage() == Common::FR_FRA;
for (const InvObject *item = INVENTORY_ITEMS; item->_name; ++item) {
const char *foreignName = isFrench ? item->_frenchName : item->_germanName;
diff --git a/engines/m4/burger/other.cpp b/engines/m4/burger/other.cpp
index 55de90c2780..ad2ddefb684 100644
--- a/engines/m4/burger/other.cpp
+++ b/engines/m4/burger/other.cpp
@@ -33,13 +33,11 @@ static void other_fade_me_out(int32 trigger) {
}
void other_resurrect_player() {
- KernelTriggerType old_mode;
-
if (!g_engine->autosaveExists())
error_show(FL, "Couldn't resume game");
_G(kernel).restore_slot = 0;
- old_mode = _G(kernel).trigger_mode;
+ const KernelTriggerType old_mode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
other_fade_me_out(TRIG_RESTORE_GAME);
diff --git a/engines/m4/burger/rooms/section3/room301.cpp b/engines/m4/burger/rooms/section3/room301.cpp
index 55ba1e4a69a..c0586a7de94 100644
--- a/engines/m4/burger/rooms/section3/room301.cpp
+++ b/engines/m4/burger/rooms/section3/room301.cpp
@@ -221,13 +221,13 @@ void Room301::daemon() {
case 17:
pal_fade_set_start(0);
- pal_mirror_colours(120, 122);
+ pal_mirror_colours(120, 122, _G(master_palette));
pal_fade_init(_G(kernel).first_fade, 255, 100, 30, 14);
break;
case 18:
pal_fade_set_start(0);
- pal_mirror_colours(32, 39);
+ pal_mirror_colours(32, 39, _G(master_palette));
pal_fade_init(_G(kernel).first_fade, 255, 100, 30, 19);
break;
diff --git a/engines/m4/burger/vars.cpp b/engines/m4/burger/vars.cpp
index 5aefd5abd7b..3466876cf35 100644
--- a/engines/m4/burger/vars.cpp
+++ b/engines/m4/burger/vars.cpp
@@ -22,14 +22,10 @@
#include "common/config-manager.h"
#include "common/debug.h"
#include "common/events.h"
+#include "m4/burger/inventory.h"
#include "m4/burger/vars.h"
#include "m4/burger/rooms/room.h"
-#include "m4/adv_r/adv_file.h"
-#include "m4/core/errors.h"
-#include "m4/graphics/gr_series.h"
#include "m4/gui/gui_sys.h"
-#include "m4/gui/gui_vmng.h"
-#include "m4/mem/mem.h"
#include "m4/platform/keys.h"
#include "m4/detection.h"
#include "m4/m4.h"
diff --git a/engines/m4/burger/vars.h b/engines/m4/burger/vars.h
index 45d6469bed5..4e5dc4d1e17 100644
--- a/engines/m4/burger/vars.h
+++ b/engines/m4/burger/vars.h
@@ -22,15 +22,14 @@
#ifndef M4_BURGER_VARS_H
#define M4_BURGER_VARS_H
-#include "common/textconsole.h"
#include "m4/vars.h"
#include "m4/burger/core/release_trigger.h"
#include "m4/burger/core/stream_break.h"
#include "m4/burger/gui/gui.h"
#include "m4/burger/gui/gui_gizmo.h"
+#include "m4/burger/gui/interface.h"
#include "m4/burger/flags.h"
#include "m4/burger/hotkeys.h"
-#include "m4/burger/inventory.h"
#include "m4/burger/series_player.h"
#include "m4/burger/walker.h"
diff --git a/engines/m4/burger/walker.cpp b/engines/m4/burger/walker.cpp
index 84ede9595ab..f718df2e9a9 100644
--- a/engines/m4/burger/walker.cpp
+++ b/engines/m4/burger/walker.cpp
@@ -36,11 +36,11 @@ namespace Burger {
#define NUM_SHADOW_SERIES 5
// These are the walker types
-#define WALKER_PLAYER 0
+#define WALKER_PLAYER 0
#define WALKER_ALT 1
// These are the shadow types
-#define SHADOW_PLAYER 0
+#define SHADOW_PLAYER 0
#define SHADOW_ALT 1
static const char *WILBUR_SERIES[8] = {
diff --git a/engines/m4/burger/walker.h b/engines/m4/burger/walker.h
index 18a87c3e3d5..3720c172d37 100644
--- a/engines/m4/burger/walker.h
+++ b/engines/m4/burger/walker.h
@@ -23,7 +23,6 @@
#ifndef M4_BURGER_WALKER_H
#define M4_BURGER_WALKER_H
-#include "common/array.h"
#include "m4/adv_r/adv_walk.h"
namespace M4 {
More information about the Scummvm-git-logs
mailing list