[Scummvm-git-logs] scummvm master -> 2d00ab033c143d8b3eaae21c1643771e8d8ea72f
Strangerke
noreply at scummvm.org
Mon Jun 30 20:50:52 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
2d00ab033c M4: Some cleanup in gui_menu_items
Commit: 2d00ab033c143d8b3eaae21c1643771e8d8ea72f
https://github.com/scummvm/scummvm/commit/2d00ab033c143d8b3eaae21c1643771e8d8ea72f
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-06-30T21:50:45+01:00
Commit Message:
M4: Some cleanup in gui_menu_items
Changed paths:
engines/m4/gui/gui_menu_items.cpp
diff --git a/engines/m4/gui/gui_menu_items.cpp b/engines/m4/gui/gui_menu_items.cpp
index a3924e6e1fc..e7c7484e1dd 100644
--- a/engines/m4/gui/gui_menu_items.cpp
+++ b/engines/m4/gui/gui_menu_items.cpp
@@ -128,16 +128,19 @@ bool guiMenu::initialize(RGB8 *myPalette) {
return false;
}
}
- if ((_GM(slotInUse) = (bool *)mem_alloc(sizeof(bool) * MAX_SLOTS, "slotUnUse array")) == nullptr) {
+ _GM(slotInUse) = (bool *)mem_alloc(sizeof(bool) * MAX_SLOTS, "slotUnUse array");
+ if (_GM(slotInUse) == nullptr) {
return false;
}
// Allocate space for the thumbnail sprites
- if ((_GM(thumbNails) = (Sprite **)mem_alloc(sizeof(Sprite *) * MAX_SLOTS, "thumbNail array")) == nullptr) {
+ _GM(thumbNails) = (Sprite **)mem_alloc(sizeof(Sprite *) * MAX_SLOTS, "thumbNail array");
+ if (_GM(thumbNails) == nullptr) {
return false;
}
for (i = 0; i < MAX_SLOTS; i++) {
- if ((_GM(thumbNails)[i] = (Sprite *)mem_alloc(sizeof(Sprite), "thumbNail")) == nullptr) {
+ _GM(thumbNails)[i] = (Sprite *)mem_alloc(sizeof(Sprite), "thumbNail");
+ if (_GM(thumbNails)[i] == nullptr) {
return false;
}
_GM(thumbNails)[i]->sourceHandle = nullptr;
@@ -213,7 +216,7 @@ void guiMenu::shutdown(bool fadeToColor) {
GrBuff *guiMenu::copyBackground(guiMenu *myMenu, int32 x, int32 y, int32 w, int32 h) {
// Verify params
- if ((!myMenu) || (!myMenu->menuBuffer)) {
+ if (!myMenu || !myMenu->menuBuffer) {
return nullptr;
}
@@ -223,7 +226,7 @@ GrBuff *guiMenu::copyBackground(guiMenu *myMenu, int32 x, int32 y, int32 w, int3
// Get the source and destination buffers
Buffer *srcBuff = myMenu->menuBuffer->get_buffer();
Buffer *destBuff = copyOfBackground->get_buffer();
- if ((!srcBuff) || (!destBuff)) {
+ if (!srcBuff || !destBuff) {
delete copyOfBackground;
return nullptr;
@@ -895,7 +898,7 @@ void menuItemButton::drawButton(menuItemButton *myItem, guiMenu *myMenu, int32 x
gui_DrawSprite(mySprite, myBuff, x, y);
// If the button is a textbutton, write in the text
- if ((myItem->buttonType == BTN_TYPE_SL_TEXT) && (myItem->prompt)) {
+ if ((myItem->buttonType == BTN_TYPE_SL_TEXT) && myItem->prompt) {
// Write in the special tag
Common::sprintf_s(tempStr, 32, "%02d", myItem->tag - 1000 + _GM(firstSlotIndex));
@@ -1230,6 +1233,8 @@ void menuItemMsg::drawMsg(menuItemMsg *myItem, guiMenu *myMenu, int32 x, int32 y
case SL_TAG_THUMBNAIL:
mySprite = _GM(saveLoadThumbNail);
break;
+ default:
+ break;
}
// Get the menu buffer and draw the sprite to it
@@ -1439,6 +1444,7 @@ bool menuItemHSlider::handler(menuItemHSlider *myItem, int32 eventType, int32 ev
case _ME_L_hold:
case _ME_doubleclick_hold:
+ default:
break;
}
@@ -1500,7 +1506,7 @@ menuItemHSlider *menuItemHSlider::add(guiMenu *myMenu, int32 tag, int32 x, int32
newItem->background = guiMenu::copyBackground(myMenu, x, y, w, h);
}
- // Intialize the new slider
+ // Initialize the new slider
newItem->itemFlags = H_THUMB_NORM;
auto *thumb = _GM(menuSprites)[IS_RIDDLE ? (int)Riddle::GUI::OM_SLIDER_BTN_NORM :
(int)Burger::GUI::OM_SLIDER_BTN_NORM];
@@ -1673,7 +1679,7 @@ void menuItemVSlider::drawVSlider(menuItemVSlider *myItem, guiMenu *myMenu, int3
}
}
- // Draw the sprite comonents
+ // Draw the sprite components
gui_DrawSprite(vbarSprite, myBuff, x, y + upSprite->h);
gui_DrawSprite(upSprite, myBuff, x, y);
gui_DrawSprite(thumbSprite, myBuff, x, y + myItem->thumbY);
@@ -1864,6 +1870,8 @@ bool menuItemVSlider::handler(menuItemVSlider *myItem, int32 eventType, int32 ev
}
}
break;
+ default:
+ break;
}
// See if we need to redraw the vslider
@@ -1945,9 +1953,6 @@ void menuItemTextField::drawTextField(menuItemTextField *myItem, guiMenu *myMenu
break;
case TF_OVER:
- mySprite = _GM(menuSprites)[SaveLoadMenuBase::SL_LINE_OVER];
- break;
-
case TF_NORM:
default:
mySprite = _GM(menuSprites)[SaveLoadMenuBase::SL_LINE_OVER];
@@ -2056,6 +2061,7 @@ bool menuItemTextField::handler(menuItemTextField *myItem, int32 eventType, int3
case _ME_move:
case _ME_L_hold:
case _ME_doubleclick_hold:
+ default:
break;
}
} else if ((eventType == EVENT_KEY) && (myItem->itemFlags == TF_OVER)) {
@@ -2170,7 +2176,6 @@ bool menuItemTextField::handler(menuItemTextField *myItem, int32 eventType, int3
menuItemTextField *menuItemTextField::add(guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h, int32 initFlags,
const char *prompt, int32 specialTag, CALLBACK callback, bool transparent) {
- menuItemTextField *textInfo;
int32 status;
// Verify params
@@ -2204,7 +2209,8 @@ menuItemTextField *menuItemTextField::add(guiMenu *myMenu, int32 tag, int32 x, i
newItem->background = guiMenu::copyBackground(myMenu, x, y, w, h);
}
- if ((textInfo = (menuItemTextField *)mem_alloc(sizeof(menuItemTextField), "menu item textfield")) == nullptr) {
+ menuItemTextField *textInfo = (menuItemTextField *)mem_alloc(sizeof(menuItemTextField), "menu item textfield");
+ if (textInfo == nullptr) {
return nullptr;
}
textInfo->itemFlags = initFlags;
More information about the Scummvm-git-logs
mailing list