[Scummvm-git-logs] scummvm master -> eca2c242b24756df0f8a16f7bc0df42b1971c80e
Strangerke
noreply at scummvm.org
Wed Mar 5 05:23:56 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
eca2c242b2 M4: Remove a couple of includes in vars, add some consts
Commit: eca2c242b24756df0f8a16f7bc0df42b1971c80e
https://github.com/scummvm/scummvm/commit/eca2c242b24756df0f8a16f7bc0df42b1971c80e
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-03-05T06:23:22+01:00
Commit Message:
M4: Remove a couple of includes in vars, add some consts
Changed paths:
engines/m4/adv_r/adv_trigger.cpp
engines/m4/burger/gui/gui_gizmo.cpp
engines/m4/burger/rooms/section1/room102.cpp
engines/m4/burger/rooms/section3/room303.cpp
engines/m4/core/rooms.cpp
engines/m4/graphics/krn_pal.cpp
engines/m4/gui/gui_dialog.cpp
engines/m4/gui/gui_menu_items.cpp
engines/m4/platform/events.cpp
engines/m4/riddle/rooms/section7/room709.cpp
engines/m4/riddle/vars.cpp
engines/m4/vars.h
diff --git a/engines/m4/adv_r/adv_trigger.cpp b/engines/m4/adv_r/adv_trigger.cpp
index b86732b3e9e..79d0ac93108 100644
--- a/engines/m4/adv_r/adv_trigger.cpp
+++ b/engines/m4/adv_r/adv_trigger.cpp
@@ -23,6 +23,7 @@
#include "m4/core/errors.h"
#include "m4/vars.h"
#include "m4/m4.h"
+#include "m4/platform/timer.h"
namespace M4 {
@@ -36,7 +37,7 @@ int32 kernel_trigger_create(int32 trigger_num) {
error_show(FL, 'BADT', "bad trigger. %d > 0xffff", trigger_num);
}
- int32 new_trigger = trigger_num + (_G(game).room_id << 16) + (_G(kernel).trigger_mode << 28);
+ const int32 new_trigger = trigger_num + (_G(game).room_id << 16) + (_G(kernel).trigger_mode << 28);
return new_trigger;
}
@@ -64,8 +65,8 @@ bool kernel_trigger_dispatchx(int32 trigger_num) {
if (_G(between_rooms))
return true;
- KernelTriggerType old_trigger_mode = _G(kernel).trigger_mode;
- int32 old_trigger = _G(kernel).trigger;
+ const KernelTriggerType old_trigger_mode = _G(kernel).trigger_mode;
+ const int32 old_trigger = _G(kernel).trigger;
bool result = false;
if (trigger_num < 0)
@@ -134,7 +135,7 @@ void kernel_timing_trigger(int32 ticks, int16 trigger, const char *name) {
_G(globals)[GLB_TEMP_2] = kernel_trigger_create(trigger);
if (name) {
- Common::String machName = Common::String::format("timer - %s", name);
+ const Common::String machName = Common::String::format("timer - %s", name);
TriggerMachineByHash(2, nullptr, -1, -1, timer_callback, false, machName.c_str());
} else {
@@ -150,7 +151,7 @@ void kernel_timing_trigger(int32 ticks, int16 trigger,
}
void kernel_timing_trigger_daemon(int32 ticks, int16 trigger) {
- KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ const KernelTriggerType oldMode = _G(kernel).trigger_mode;
_G(kernel).trigger_mode = KT_DAEMON;
kernel_timing_trigger(ticks, trigger, nullptr);
_G(kernel).trigger_mode = oldMode;
@@ -159,7 +160,7 @@ void kernel_timing_trigger_daemon(int32 ticks, int16 trigger) {
void kernel_service_timing_trigger_q() {
// Dispatch pending timing triggers
int32 iter = 0;
- int32 now = timer_read_60();
+ const int32 now = timer_read_60();
while (iter < _GT(time_q_end) && _GT(time_q)[iter] <= now)
{
@@ -170,7 +171,7 @@ void kernel_service_timing_trigger_q() {
return;
// Remove dispatched triggers from the q
- int32 total = iter;
+ const int32 total = iter;
int32 dispatched = iter;
iter = 0;
while (dispatched < _GT(time_q_end)) {
diff --git a/engines/m4/burger/gui/gui_gizmo.cpp b/engines/m4/burger/gui/gui_gizmo.cpp
index 0a2ca5c36c6..ac48fb371c1 100644
--- a/engines/m4/burger/gui/gui_gizmo.cpp
+++ b/engines/m4/burger/gui/gui_gizmo.cpp
@@ -32,6 +32,7 @@
#include "m4/mem/mem.h"
#include "m4/platform/keys.h"
#include "m4/m4.h"
+#include "m4/platform/timer.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/burger/rooms/section1/room102.cpp b/engines/m4/burger/rooms/section1/room102.cpp
index 2c78b832430..172806e2c55 100644
--- a/engines/m4/burger/rooms/section1/room102.cpp
+++ b/engines/m4/burger/rooms/section1/room102.cpp
@@ -24,6 +24,7 @@
#include "m4/burger/vars.h"
#include "m4/core/imath.h"
#include "m4/graphics/gr_series.h"
+#include "m4/platform/timer.h"
namespace M4 {
namespace Burger {
@@ -172,7 +173,7 @@ void Room102::init() {
}
void Room102::daemon() {
- KernelTriggerType oldMode = _G(kernel).trigger_mode;
+ const KernelTriggerType oldMode = _G(kernel).trigger_mode;
int frame;
switch (_G(kernel).trigger) {
@@ -632,6 +633,9 @@ void Room102::daemon() {
if (!_flag1)
player_set_commands_allowed(true);
break;
+
+ default:
+ break;
}
break;
@@ -856,7 +860,7 @@ void Room102::daemon() {
break;
case 16:
- ws_walk(318, 343, nullptr, -1, 2, 1);
+ ws_walk(318, 343, nullptr, -1, 2, true);
break;
case 17:
@@ -1142,7 +1146,7 @@ void Room102::pre_parser() {
}
void Room102::parser() {
- bool lookFlag = player_said("look") || player_said("look at");
+ const bool lookFlag = player_said("look") || player_said("look at");
_G(kernel).trigger_mode = KT_DAEMON;
if (player_said("conv04")) {
@@ -1495,9 +1499,9 @@ void Room102::freshen() {
void Room102::conv04() {
_G(kernel).trigger_mode = KT_PARSE;
const char *sound = conv_sound_to_play();
- int who = conv_whos_talking();
- int node = conv_current_node();
- int entry = conv_current_entry();
+ const int who = conv_whos_talking();
+ const int node = conv_current_node();
+ const int entry = conv_current_entry();
if (_G(kernel).trigger == 22) {
if (who <= 0) {
@@ -1573,9 +1577,9 @@ void Room102::conv04() {
void Room102::conv05() {
_G(kernel).trigger_mode = KT_PARSE;
const char *sound = conv_sound_to_play();
- int who = conv_whos_talking();
- int node = conv_current_node();
- int entry = conv_current_entry();
+ const int who = conv_whos_talking();
+ const int node = conv_current_node();
+ const int entry = conv_current_entry();
if (_G(kernel).trigger == 22) {
if (who <= 0) {
@@ -1619,9 +1623,9 @@ void Room102::conv05() {
void Room102::conv06() {
_G(kernel).trigger_mode = KT_PARSE;
const char *sound = conv_sound_to_play();
- int who = conv_whos_talking();
- int node = conv_current_node();
- int entry = conv_current_entry();
+ const int who = conv_whos_talking();
+ const int node = conv_current_node();
+ const int entry = conv_current_entry();
if (_G(kernel).trigger == 22) {
if (who <= 0) {
diff --git a/engines/m4/burger/rooms/section3/room303.cpp b/engines/m4/burger/rooms/section3/room303.cpp
index 9fe87567200..770f45bdfa4 100644
--- a/engines/m4/burger/rooms/section3/room303.cpp
+++ b/engines/m4/burger/rooms/section3/room303.cpp
@@ -21,6 +21,7 @@
#include "m4/burger/rooms/section3/room303.h"
#include "m4/burger/vars.h"
+#include "m4/platform/timer.h"
namespace M4 {
namespace Burger {
diff --git a/engines/m4/core/rooms.cpp b/engines/m4/core/rooms.cpp
index 12c37395bce..832047bef4c 100644
--- a/engines/m4/core/rooms.cpp
+++ b/engines/m4/core/rooms.cpp
@@ -38,6 +38,7 @@
#include "m4/wscript/wst_regs.h"
#include "m4/vars.h"
#include "m4/m4.h"
+#include "m4/platform/timer.h"
namespace M4 {
diff --git a/engines/m4/graphics/krn_pal.cpp b/engines/m4/graphics/krn_pal.cpp
index 7fb513c17ea..68bb485238e 100644
--- a/engines/m4/graphics/krn_pal.cpp
+++ b/engines/m4/graphics/krn_pal.cpp
@@ -31,6 +31,7 @@
#include "m4/platform/keys.h"
#include "m4/vars.h"
#include "m4/m4.h"
+#include "m4/platform/timer.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index 53b8e8ebf1c..a245a923249 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -31,6 +31,7 @@
#include "m4/graphics/krn_pal.h"
#include "m4/mem/mem.h"
#include "m4/mem/memman.h"
+#include "m4/platform/timer.h"
#include "m4/vars.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_menu_items.cpp b/engines/m4/gui/gui_menu_items.cpp
index 88d483c6f14..5da179ac2bb 100644
--- a/engines/m4/gui/gui_menu_items.cpp
+++ b/engines/m4/gui/gui_menu_items.cpp
@@ -39,6 +39,7 @@
#include "m4/platform/keys.h"
#include "m4/vars.h"
#include "m4/m4.h"
+#include "m4/platform/timer.h"
namespace M4 {
namespace GUI {
@@ -500,6 +501,7 @@ bool guiMenu::eventHandler(guiMenu *theMenu, int32 eventType, int32 parm1, int32
case _ME_move:
case _ME_L_hold:
case _ME_doubleclick_hold:
+ default:
break;
}
return true;
@@ -658,19 +660,17 @@ void menuItem::destroyItem(menuItem *theItem) {
if (!theItem) {
return;
}
- if (theItem->background) {
- delete theItem->background;
- }
+ delete theItem->background;
delete theItem;
}
bool menuItem::cursorInsideItem(menuItem *myItem, int32 cursorX, int32 cursorY) {
if ((cursorX >= myItem->x1) && (cursorX <= myItem->x2) && (cursorY >= myItem->y1) && (cursorY <= myItem->y2)) {
return true;
- } else {
- return false;
}
+
+ return false;
}
//----------------------------- BUTTON FUNCTIONS ---------------------------------//
@@ -1009,6 +1009,7 @@ bool menuItemButton::handler(menuItemButton *myItem, int32 eventType, int32 even
case _ME_L_hold:
case _ME_doubleclick_hold:
+ default:
break;
}
@@ -1050,7 +1051,7 @@ bool menuItemButton::handler(menuItemButton *myItem, int32 eventType, int32 even
}
menuItemButton *menuItemButton::add(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h, CALLBACK callback, int32 buttonType,
- bool greyed, bool transparent, const char *prompt, ItemHandlerFunction i_handler) {
+ bool ghosted, bool transparent, const char *prompt, ItemHandlerFunction i_handler) {
int32 status;
// Verify params
@@ -1085,7 +1086,7 @@ menuItemButton *menuItemButton::add(guiMenu *myMenu, int32 tag, int32 x, int32 y
newItem->background = guiMenu::copyBackground(myMenu, x, y, w, h);
}
- if (greyed) {
+ if (ghosted) {
newItem->itemFlags = BTN_STATE_GREY;
} else {
newItem->itemFlags = BTN_STATE_NORM;
diff --git a/engines/m4/platform/events.cpp b/engines/m4/platform/events.cpp
index 9370f585661..f1b9561f1dc 100644
--- a/engines/m4/platform/events.cpp
+++ b/engines/m4/platform/events.cpp
@@ -23,6 +23,7 @@
#include "m4/platform/events.h"
#include "m4/vars.h"
#include "m4/m4.h"
+#include "m4/platform/timer.h"
namespace M4 {
diff --git a/engines/m4/riddle/rooms/section7/room709.cpp b/engines/m4/riddle/rooms/section7/room709.cpp
index 93525461a62..b2748bcaf36 100644
--- a/engines/m4/riddle/rooms/section7/room709.cpp
+++ b/engines/m4/riddle/rooms/section7/room709.cpp
@@ -24,6 +24,7 @@
#include "m4/gui/gui_sys.h"
#include "m4/riddle/vars.h"
#include "m4/platform/keys.h"
+#include "m4/platform/timer.h"
namespace M4 {
namespace Riddle {
diff --git a/engines/m4/riddle/vars.cpp b/engines/m4/riddle/vars.cpp
index df894261ce2..8e3ac4dd80e 100644
--- a/engines/m4/riddle/vars.cpp
+++ b/engines/m4/riddle/vars.cpp
@@ -24,7 +24,6 @@
#include "m4/riddle/vars.h"
#include "m4/riddle/inventory.h"
#include "m4/gui/gui_sys.h"
-#include "m4/gui/gui_vmng.h"
#include "m4/platform/keys.h"
namespace M4 {
diff --git a/engines/m4/vars.h b/engines/m4/vars.h
index c82370207c9..ea67a9eb98c 100644
--- a/engines/m4/vars.h
+++ b/engines/m4/vars.h
@@ -37,7 +37,6 @@
#include "m4/adv_r/adv_trigger.h"
#include "m4/adv_r/adv_walk.h"
#include "m4/adv_r/conv_io.h"
-#include "m4/core/globals.h"
#include "m4/core/mouse.h"
#include "m4/fileio/fstream.h"
#include "m4/fileio/sys_file.h"
@@ -54,7 +53,6 @@
#include "m4/mem/memman.h"
#include "m4/mem/res.h"
#include "m4/platform/events.h"
-#include "m4/platform/timer.h"
#include "m4/platform/sound/digi.h"
#include "m4/platform/sound/midi.h"
#include "m4/wscript/wscript.h"
More information about the Scummvm-git-logs
mailing list