[Scummvm-git-logs] scummvm master -> b48ac7ddcb3f161c94cbdda453af1b85deb0ba83
Strangerke
noreply at scummvm.org
Fri Feb 13 11:08:16 UTC 2026
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
b2a5a6a51e M4: Some more cleanup in graphics
5c03105ad6 M4: remove unused code in gui_dialog
b48ac7ddcb M4: Partial cleanup in gui
Commit: b2a5a6a51e0454a041d1ff01a1dfccc0855102b3
https://github.com/scummvm/scummvm/commit/b2a5a6a51e0454a041d1ff01a1dfccc0855102b3
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-02-13T12:07:48+01:00
Commit Message:
M4: Some more cleanup in graphics
Changed paths:
engines/m4/graphics/gr_surface.cpp
engines/m4/graphics/gr_surface.h
engines/m4/graphics/rend.cpp
diff --git a/engines/m4/graphics/gr_surface.cpp b/engines/m4/graphics/gr_surface.cpp
index 535028fb25b..3d9625b55a1 100644
--- a/engines/m4/graphics/gr_surface.cpp
+++ b/engines/m4/graphics/gr_surface.cpp
@@ -25,16 +25,6 @@
namespace M4 {
-M4Surface::M4Surface(int sw, int sh) : Buffer() {
- this->w = sw;
- this->h = sh;
- this->stride = sw;
- this->encoding = NO_COMPRESS;
- this->data = new byte[sw * sh];
- Common::fill(this->data, this->data + sw * sh, 0);
- _disposeAfterUse = DisposeAfterUse::YES;
-}
-
M4Surface::M4Surface(const byte *src, int sw, int sh) {
this->w = sw;
this->h = sh;
@@ -131,7 +121,8 @@ void M4Surface::drawInner(const Buffer &src, const byte *depthCodes, int x, int
if (y >= h)
// Below bottom of screen
break;
- else if (y < 0)
+
+ if (y < 0)
// Above top of screen
continue;
diff --git a/engines/m4/graphics/gr_surface.h b/engines/m4/graphics/gr_surface.h
index bc5ed9f0170..8f7abe948ff 100644
--- a/engines/m4/graphics/gr_surface.h
+++ b/engines/m4/graphics/gr_surface.h
@@ -37,7 +37,6 @@ private:
public:
M4Surface() : Buffer() {}
M4Surface(const Buffer &src) : Buffer(src) {}
- M4Surface(int sw, int sh);
M4Surface(const byte *src, int sw, int sh);
~M4Surface();
diff --git a/engines/m4/graphics/rend.cpp b/engines/m4/graphics/rend.cpp
index 23d5f5083ee..828f8bd2739 100644
--- a/engines/m4/graphics/rend.cpp
+++ b/engines/m4/graphics/rend.cpp
@@ -69,7 +69,9 @@ static RenderResult r_0() {
if (code <= kJumpXY) {
_GR(sourceAddress) = from;
return (RenderResult)code;
- } else while (code--) {
+ }
+
+ while (code--) {
uint8 data = *from++;
if (data)
@@ -124,7 +126,9 @@ static RenderResult r_0_5() {
if (code <= kJumpXY) {
_GR(sourceAddress) = from;
return (RenderResult)code;
- } else while (code--) {
+ }
+
+ while (code--) {
uint8 data = *from++;
if (data)
@@ -184,7 +188,9 @@ static RenderResult r_1() {
if (code <= kJumpXY) {
_GR(sourceAddress) = from;
return (RenderResult)code;
- } else while (code--) {
+ }
+
+ while (code--) {
++myWidth;
uint8 data = *from++;
@@ -243,7 +249,9 @@ static RenderResult r_2() {
if (code <= kJumpXY) {
_GR(sourceAddress) = from;
return (RenderResult)code;
- } else while (code--) {
+ }
+
+ while (code--) {
uint8 data = *from++;
Error -= scaleX;
@@ -280,10 +288,10 @@ static RenderResult r_3() {
uint8 *from = _GR(sourceAddress);
uint8 *to = _GR(destinationAddress);
uint8 *depth = _GR(depthAddress);
- uint8 sdepth = _GR(spriteDepth);
+ const uint8 sdepth = _GR(spriteDepth);
int32 Error = _GR(X_error);
- uint32 scaleX = _GR(X_scale);
- long Inc = _GR(Increment);
+ const uint32 scaleX = _GR(X_scale);
+ const long Inc = _GR(Increment);
for (;;) {
// Assume that the first byte is a run-length counter followed by pix data
@@ -295,8 +303,10 @@ static RenderResult r_3() {
if (code <= kJumpXY) {
_GR(sourceAddress) = from;
return (RenderResult)code;
- } else while (code--) {
- uint8 data = *from++;
+ }
+
+ while (code--) {
+ const uint8 data = *from++;
Error -= scaleX;
@@ -313,13 +323,13 @@ static RenderResult r_3() {
}
}
} else {
- uint8 data = *from++;
+ const uint8 data = *from++;
while (runLength--) {
Error -= scaleX;
while (Error < 0) {
- uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+ const uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
if (data && (!ddepth || sdepth < ddepth))
*to = data;
@@ -338,7 +348,7 @@ static RenderResult r_4() {
uint8 *from = _GR(sourceAddress);
uint8 *to = _GR(destinationAddress);
int32 PixelPos = _GR(StartingPixelPos);
- long Inc = _GR(Increment);
+ const long Inc = _GR(Increment);
for (;;) {
#ifdef OPTIMIZE_CLIP
@@ -362,8 +372,10 @@ static RenderResult r_4() {
if (code <= kJumpXY) {
_GR(sourceAddress) = from;
return (RenderResult)code;
- } else while (code--) {
- uint8 data = *from++;
+ }
+
+ while (code--) {
+ const uint8 data = *from++;
if (data && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch))
*to = data;
@@ -371,7 +383,7 @@ static RenderResult r_4() {
PixelPos += Inc;
}
} else {
- uint8 data = *from++;
+ const uint8 data = *from++;
if (!data) {
if (Inc == 1) {
@@ -395,9 +407,9 @@ static RenderResult r_5() {
uint8 *from = _GR(sourceAddress);
uint8 *to = _GR(destinationAddress);
uint8 *depth = _GR(depthAddress);
- uint8 sdepth = _GR(spriteDepth);
+ const uint8 sdepth = _GR(spriteDepth);
int32 PixelPos = _GR(StartingPixelPos);
- long Inc = _GR(Increment);
+ const long Inc = _GR(Increment);
for (;;) {
#ifdef OPTIMIZE_CLIP
@@ -421,9 +433,11 @@ static RenderResult r_5() {
if (code <= kJumpXY) {
_GR(sourceAddress) = from;
return (RenderResult)code;
- } else while (code--) {
- uint8 data = *from++;
- uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+ }
+
+ while (code--) {
+ const uint8 data = *from++;
+ const uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
if (data && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch) && (!ddepth || sdepth < ddepth))
*to = data;
@@ -432,7 +446,7 @@ static RenderResult r_5() {
PixelPos += Inc;
}
} else {
- uint8 data = *from++;
+ const uint8 data = *from++;
if (!data)
if (Inc == 1) {
@@ -444,7 +458,7 @@ static RenderResult r_5() {
depth -= runLength;
PixelPos -= runLength;
} else while (runLength--) {
- uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+ const uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
if (PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch) && (!ddepth || sdepth < ddepth))
*to = data;
@@ -460,8 +474,8 @@ static RenderResult r_6() {
uint8 *from = _GR(sourceAddress);
uint8 *to = _GR(destinationAddress);
int32 PixelPos = _GR(StartingPixelPos), Error = _GR(X_error);
- uint32 scaleX = _GR(X_scale);
- long Inc = _GR(Increment);
+ const uint32 scaleX = _GR(X_scale);
+ const long Inc = _GR(Increment);
for (;;) {
#ifdef OPTIMIZE_CLIP
@@ -485,8 +499,10 @@ static RenderResult r_6() {
if (code <= kJumpXY) {
_GR(sourceAddress) = from;
return (RenderResult)code;
- } else while (code--) {
- uint8 data = *from++;
+ }
+
+ while (code--) {
+ const uint8 data = *from++;
Error -= scaleX;
@@ -500,7 +516,7 @@ static RenderResult r_6() {
}
}
} else {
- uint8 data = *from++;
+ const uint8 data = *from++;
while (runLength--) {
Error -= scaleX;
@@ -522,10 +538,10 @@ static RenderResult r_7() {
uint8 *from = _GR(sourceAddress);
uint8 *to = _GR(destinationAddress);
uint8 *depth = _GR(depthAddress);
- uint8 sdepth = _GR(spriteDepth);
+ const uint8 sdepth = _GR(spriteDepth);
int32 PixelPos = _GR(StartingPixelPos), Error = _GR(X_error);
- uint32 scaleX = _GR(X_scale);
- long Inc = _GR(Increment);
+ const uint32 scaleX = _GR(X_scale);
+ const long Inc = _GR(Increment);
for (;;) {
#ifdef OPTIMIZE_CLIP
@@ -549,13 +565,15 @@ static RenderResult r_7() {
if (code <= kJumpXY) {
_GR(sourceAddress) = from;
return (RenderResult)code;
- } else while (code--) {
- uint8 data = *from++;
+ }
+
+ while (code--) {
+ const uint8 data = *from++;
Error -= scaleX;
while (Error < 0) {
- uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+ const uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
if (data && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch) && (!ddepth || sdepth < ddepth))
*to = data;
@@ -567,13 +585,13 @@ static RenderResult r_7() {
}
}
} else {
- uint8 data = *from++;
+ const uint8 data = *from++;
while (runLength--) {
Error -= scaleX;
while (Error < 0) {
- uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+ const uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
if (data && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch) && (!ddepth || sdepth < ddepth))
*to = data;
@@ -594,8 +612,8 @@ static RenderResult r_8() {
uint8 *from = _GR(sourceAddress);
uint8 *to = _GR(destinationAddress);
int32 PixelPos = _GR(StartingPixelPos), Error = _GR(X_error);
- uint32 scaleX = _GR(X_scale);
- long Inc = _GR(Increment);
+ const uint32 scaleX = _GR(X_scale);
+ const long Inc = _GR(Increment);
uint32 r, g, b;
for (;;) {
@@ -620,8 +638,10 @@ static RenderResult r_8() {
if (code <= kJumpXY) {
_GR(sourceAddress) = from;
return (RenderResult)code;
- } else while (code--) {
- uint8 data = *from++;
+ }
+
+ while (code--) {
+ const uint8 data = *from++;
Error -= scaleX;
@@ -655,7 +675,7 @@ static RenderResult r_8() {
}
}
} else {
- uint8 data = *from++;
+ const uint8 data = *from++;
while (runLength--) {
Error -= scaleX;
@@ -697,10 +717,10 @@ static RenderResult r_9() {
uint8 *from = _GR(sourceAddress);
uint8 *to = _GR(destinationAddress);
uint8 *depth = _GR(depthAddress);
- uint8 sdepth = _GR(spriteDepth);
+ const uint8 sdepth = _GR(spriteDepth);
int32 PixelPos = _GR(StartingPixelPos), Error = _GR(X_error);
- uint32 scaleX = _GR(X_scale);
- long Inc = _GR(Increment);
+ const uint32 scaleX = _GR(X_scale);
+ const long Inc = _GR(Increment);
uint32 r, g, b;
for (;;) {
@@ -725,13 +745,15 @@ static RenderResult r_9() {
if (code <= kJumpXY) {
_GR(sourceAddress) = from;
return (RenderResult)code;
- } else while (code--) {
- uint8 data = *from++;
+ }
+
+ while (code--) {
+ const uint8 data = *from++;
Error -= scaleX;
while (Error < 0) {
- uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+ const uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
if (data != 128 && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch) && (!ddepth || sdepth < ddepth)) {
// Handle pixel
@@ -764,13 +786,13 @@ static RenderResult r_9() {
}
}
} else {
- uint8 data = *from++;
+ const uint8 data = *from++;
while (runLength--) {
Error -= scaleX;
while (Error < 0) {
- uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
+ const uint8 ddepth = (uint8)(*depth & DEPTH_MASK);
if (data != 128 && PixelPos >= _GR(LeftPorch) && PixelPos < _GR(RightPorch) && (!ddepth || sdepth < ddepth)) {
// Handle pixel
@@ -830,7 +852,7 @@ int32 scale_this(int32 Value, int32 Scaler, int32 Error) {
}
void GetUpdateRectangle(int32 x, int32 y, int32 hot_x, int32 hot_y, int32 scale_x, int32 scale_y, int32 Width, int32 Height, M4Rect *UpdateRect) {
- int errY = hot_y * scale_y % 100;
+ const int errY = hot_y * scale_y % 100;
UpdateRect->y1 = y - hot_y * scale_y / 100;
UpdateRect->y2 = UpdateRect->y1 + scale_this(Height, scale_y, errY);
Commit: 5c03105ad6b88c850bdd545f76d74828c15c2eca
https://github.com/scummvm/scummvm/commit/5c03105ad6b88c850bdd545f76d74828c15c2eca
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-02-13T12:07:49+01:00
Commit Message:
M4: remove unused code in gui_dialog
Changed paths:
engines/m4/gui/gui_dialog.cpp
engines/m4/gui/gui_dialog.h
engines/m4/gui/gui_vmng_screen.cpp
engines/m4/gui/gui_vmng_screen.h
diff --git a/engines/m4/gui/gui_dialog.cpp b/engines/m4/gui/gui_dialog.cpp
index 0da093b46f8..226053a1ca6 100644
--- a/engines/m4/gui/gui_dialog.cpp
+++ b/engines/m4/gui/gui_dialog.cpp
@@ -48,26 +48,10 @@ void Dialog::destroy() {
DialogDestroy(this);
}
-void Dialog::refresh() {
- Dialog_Refresh(this);
-}
-
-void Dialog::resize(int32 newW, int32 newH) {
- Dialog_Resize(this, newW, newH);
-}
-
void Dialog::configure(int32 defaultTag, int32 returnTag, int32 cancelTag) {
Dialog_Configure(this, defaultTag, returnTag, cancelTag);
}
-void Dialog::setDefault(int32 tag) {
- Dialog_SetDefault(this, tag);
-}
-
-bool Dialog::setPressed(int32 tag) {
- return Dialog_SetPressed(this, tag);
-}
-
void Dialog::show() {
vmng_screen_show(this);
}
@@ -76,47 +60,18 @@ bool Dialog::addMessage(int32 x, int32 y, const char *prompt, int32 tag) {
return Dialog_Add_Message(this, x, y, prompt, tag);
}
-bool Dialog::addPicture(int32 x, int32 y, Buffer *myBuff, int32 tag) {
- return Dialog_Add_Picture(this, x, y, myBuff, tag);
-}
-
bool Dialog::addButton(int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag) {
return Dialog_Add_Button(this, x, y, prompt, cb, tag);
}
-bool Dialog::addRepeatButton(int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag) {
- return Dialog_Add_RepeatButton(this, x, y, prompt, cb, tag);
-}
-
-bool Dialog::addList(int32 x1, int32 y1, int32 x2, int32 y2, M4CALLBACK cb, int32 tag) {
- return Dialog_Add_List(this, x1, y1, x2, y2, cb, tag);
-}
-
bool Dialog::addTextField(int32 x1, int32 y1, int32 x2, const char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength) {
return Dialog_Add_TextField(this, x1, y1, x2, defaultPrompt, cb, tag, fieldLength);
}
-void Dialog::registerTextField() {
- Dialog_RegisterTextField(this);
-}
-
Item *Dialog::getItem(int32 tag) {
return Dialog_Get_Item(this, tag);
}
-void Dialog::changeItemPrompt(const char *newPrompt, Item *myItem, int32 tag) {
- Dialog_Change_Item_Prompt(this, newPrompt, myItem, tag);
-}
-
-bool Dialog::removeItem(Item *myItem, int32 tag) {
- return Dialog_Remove_Item(this, myItem, tag);
-}
-
-void Dialog::refreshItem(Item *myItem, int32 tag) {
- Dialog_Refresh_Item(this, myItem, tag);
-}
-
-
bool gui_dialog_init() {
_GD(listboxSearchStr)[0] = '\0';
return true;
@@ -163,17 +118,17 @@ Dialog *DialogCreateAbsolute(int32 x1, int32 y1, int32 x2, int32 y2, uint32 scrn
bdr.scrBuf = tempBuffer;
bdr.fillMe = FILL_INTERIOR;
bdr.pressed = false; bdr.el_type = DIALOGBOX;
- bdr.x1 = 0; bdr.y1 = 0; bdr.x2 = dialog->w - 1; bdr.y2 = dialog->h - 1;
+ bdr.x1 = 0;
+ bdr.y1 = 0;
+ bdr.x2 = dialog->w - 1;
+ bdr.y2 = dialog->h - 1;
+
drawGUIelement(&bdr, nullptr);
dialog->dlgBuffer->release();
return dialog;
}
-Dialog *DialogCreate(M4Rect *r, uint32 scrnFlags) {
- return DialogCreateAbsolute(r->x1, r->y1, r->x2, r->y2, scrnFlags);
-}
-
void vmng_Dialog_Destroy(Dialog *d) {
Item *myItems;
Item *tempItem = myItems = d->itemList;
@@ -206,20 +161,6 @@ void DialogDestroy(Dialog *d, M4Rect *r) {
vmng_Dialog_Destroy(d);
}
-bool GetDialogCoords(Dialog *d, M4Rect *r) {
- ScreenContext *myScreen;
- if ((!d) || (!r))
- return false;
- if ((myScreen = vmng_screen_find((void *)d, nullptr)) == nullptr)
- return false;
-
- r->x1 = myScreen->x1;
- r->x2 = myScreen->x2;
- r->y1 = myScreen->y1;
- r->y2 = myScreen->y2;
- return true;
-}
-
bool Dialog_Add_Message(Dialog *d, int32 x, int32 y, const char *prompt, int32 tag) {
Item *myItem = ItemAdd(d->itemList, x, y, 0, 0, prompt, tag, MESSAGE, nullptr, 0);
if (myItem == nullptr) {
@@ -233,20 +174,6 @@ bool Dialog_Add_Message(Dialog *d, int32 x, int32 y, const char *prompt, int32 t
return true;
}
-bool Dialog_Add_Picture(Dialog *d, int32 x, int32 y, Buffer *myBuff, int32 tag) {
- Item *myItem = ItemAdd(d->itemList, x, y, myBuff->w, myBuff->h, (char *)myBuff->data, tag, PICTURE, nullptr, 0);
- if (myItem == nullptr) {
- return false;
- }
-
- if (!d->itemList)
- d->itemList = myItem;
-
- d->listBottom = myItem;
- Dialog_Refresh_Item(d, myItem, myItem->tag);
- return true;
-}
-
bool Dialog_Add_Button(Dialog *d, int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag) {
Item *myItem = ItemAdd(d->itemList, x, y, 0, 0, prompt, tag, BUTTON, cb, 0);
if (myItem == nullptr) {
@@ -260,33 +187,6 @@ bool Dialog_Add_Button(Dialog *d, int32 x, int32 y, const char *prompt, M4CALLBA
return true;
}
-bool Dialog_Add_RepeatButton(Dialog *d, int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag) {
- Item *myItem = ItemAdd(d->itemList, x, y, 0, 0, prompt, tag, REPEAT_BUTTON, cb, 0);
- if (myItem == nullptr) {
- return false;
- }
-
- if (!d->itemList)
- d->itemList = myItem;
-
- d->listBottom = myItem;
- Dialog_Refresh_Item(d, myItem, myItem->tag);
- return true;
-}
-
-bool Dialog_Add_List(Dialog *d, int32 x1, int32 y1, int32 x2, int32 y2, M4CALLBACK cb, int32 tag) {
- Item *myItem = ItemAdd(d->itemList, x1, y1, x2 - x1 + 1, y2 - y1 + 1, nullptr, tag, LISTBOX, cb, 0);
- if (myItem == nullptr) {
- return false;
- }
- if (!d->itemList)
- d->itemList = myItem;
-
- d->listBottom = myItem;
- Dialog_Refresh_Item(d, myItem, myItem->tag);
- return true;
-}
-
bool Dialog_Add_TextField(Dialog *d, int32 x1, int32 y1, int32 x2, const char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength) {
Item *myItem = ItemAdd(d->itemList, x1, y1, x2 - x1 + 1, 0, defaultPrompt, tag, TEXTFIELD, cb, fieldLength);
if (myItem == nullptr) {
@@ -300,113 +200,6 @@ bool Dialog_Add_TextField(Dialog *d, int32 x1, int32 y1, int32 x2, const char *d
return true;
}
-bool Dialog_Add_Key(Dialog *d, long myKey, HotkeyCB cb) {
- return AddScreenHotkey((void *)d, myKey, cb);
-}
-
-bool Dialog_Remove_Key(Dialog *d, long myKey) {
- return RemoveScreenHotkey((void *)d, myKey);
-}
-
-bool Dialog_Remove_Item(Dialog *d, Item *myItem, int32 tag) {
- int32 status;
- ScreenContext *myScreen = vmng_screen_find((void *)d, &status);
- if (!myScreen)
- return false;
- if (!myItem)
- myItem = ItemFind(d->itemList, tag);
- if (!myItem)
- return false;
-
- // NOTE: if the item removed is the default, cancel, or return item, problems could happen...
- if (myItem->next)
- myItem->next->prev = myItem->prev;
- else
- d->listBottom = myItem;
- if (myItem->prev)
- myItem->prev->next = myItem->next;
- else
- d->itemList = myItem->next;
-
- gr_color_set(__LTGRAY);
- Buffer *tempBuffer = d->dlgBuffer->get_buffer();
- gr_buffer_rect_fill(tempBuffer, myItem->x, myItem->y, myItem->w, myItem->h);
- d->dlgBuffer->release();
- if (status == SCRN_ACTIVE) {
- RestoreScreens(myScreen->x1 + myItem->x, myScreen->y1 + myItem->y,
- myScreen->x1 + myItem->x + myItem->w - 1,
- myScreen->y1 + myItem->y + myItem->h - 1);
- }
-
- Item_destroy(myItem);
- return true;
-}
-
-bool Dialog_ListItemExists(Dialog *d, Item *myItem, int32 tag, char *prompt, int32 listTag) {
- if ((!myItem) && (!d))
- return false;
- if (!myItem)
- myItem = ItemFind(d->itemList, tag);
- if (!myItem)
- return false;
-
- return ListItemExists(myItem, prompt, listTag);
-}
-
-bool Dialog_Add_List_Item(Dialog *d, Item *myItem, char *prompt, int32 tag, int32 listTag, int32 addMode, bool refresh) {
- int32 status;
- ScreenContext *myScreen = vmng_screen_find((void *)d, &status);
-
- if (!myScreen)
- return false;
- if (!myItem)
- myItem = ItemFind(d->itemList, tag);
-
- bool retValue = ListItemAdd(myItem, prompt, listTag, addMode, nullptr);
-
- if (retValue && refresh) {
- Dialog_Refresh_Item(d, myItem, myItem->tag);
- }
-
- return true;
-}
-
-bool Dialog_Delete_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myListItem, int32 listTag) {
- int32 status;
- ScreenContext *myScreen = vmng_screen_find((void *)d, &status);
- if (myScreen == nullptr)
- return false;
-
- if (!myItem) {
- myItem = ItemFind(d->itemList, tag);
- myListItem = nullptr;
- }
- if (ListItemDelete(myItem, myListItem, listTag)) {
- Dialog_Refresh_Item(d, myItem, myItem->tag);
- }
-
- return true;
-}
-
-bool Dialog_Change_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myListItem,
- int32 listTag, char *newPrompt, int32 newListTag, int32 changeMode, bool refresh) {
- int32 status;
- ScreenContext *myScreen = vmng_screen_find((void *)d, &status);
-
- if (!myScreen)
- return false;
- if (!myItem) {
- myItem = ItemFind(d->itemList, tag);
- myListItem = nullptr;
- }
-
- bool retValue = ListItemChange(myItem, myListItem, listTag, newPrompt, newListTag, changeMode);
- if (retValue && refresh) {
- Dialog_Refresh_Item(d, myItem, myItem->tag);
- }
-
- return retValue;
-}
void Dialog_Change_Item_Prompt(Dialog *d, const char *newPrompt, Item *myItem, int32 tag) {
int32 status, itemType;
@@ -451,22 +244,6 @@ void Dialog_Change_Item_Prompt(Dialog *d, const char *newPrompt, Item *myItem, i
}
}
-bool Dialog_ListboxSearch(Dialog *d, Item *myItem, int32 tag, int32 searchMode, char *searchStr, int32 parm1) {
- int32 status;
- ScreenContext *myScreen = vmng_screen_find((void *)d, &status);
-
- if (!myScreen)
- return false;
- if (!myItem)
- myItem = ItemFind(d->itemList, tag);
- if (!myItem || (myItem->type != LISTBOX))
- return false;
-
- bool returnValue = ListItemSearch(myItem, searchMode, searchStr, parm1);
- Dialog_Refresh_Item(d, myItem, myItem->tag);
- return returnValue;
-}
-
Item *Dialog_Get_Item(Dialog *d, int32 tag) {
if (!d)
return nullptr;
@@ -509,21 +286,28 @@ void Dialog_Refresh_Item(Dialog *d, Item *myItem, int32 tag) {
void Dialog_Refresh(Dialog *d) {
int32 status, itemType;
- ButtonDrawRec bdr;
if (!d) return;
Buffer *tempBuffer = d->dlgBuffer->get_buffer();
+ ButtonDrawRec bdr;
bdr.dialog = (void *)d;
bdr.scrBuf = tempBuffer; bdr.fillMe = FILL_INTERIOR;
bdr.pressed = false; bdr.el_type = DIALOGBOX;
- bdr.x1 = 0; bdr.y1 = 0; bdr.x2 = d->w - 1; bdr.y2 = d->h - 1;
+ bdr.x1 = 0;
+ bdr.y1 = 0;
+ bdr.x2 = d->w - 1;
+ bdr.y2 = d->h - 1;
+
drawGUIelement(&bdr, nullptr);
for (Item *i = d->itemList; i != nullptr; i = i->next) {
- if (i == d->default_item) itemType = ITEM_DEFAULT;
- else if (i == d->return_item) itemType = ITEM_RETURN;
- else itemType = ITEM_NORMAL;
+ if (i == d->default_item)
+ itemType = ITEM_DEFAULT;
+ else if (i == d->return_item)
+ itemType = ITEM_RETURN;
+ else
+ itemType = ITEM_NORMAL;
Item_show(i, (void *)d, tempBuffer, itemType);
}
@@ -548,28 +332,6 @@ void Dialog_Refresh_All(void) {
}
}
-void Dialog_Resize(Dialog *d, int32 newW, int32 newH) {
- if (!d) {
- return;
- }
- if (newW <= 0) {
- newW = d->w;
- }
- if (newH <= 0) {
- newH = d->h;
- }
-
- delete d->dlgBuffer;
- d->dlgBuffer = new GrBuff(newW, newH);
-
- d->w = newW;
- d->h = newH;
-
- ResizeScreen(d, newW, newH);
- Dialog_Refresh(d);
- return;
-}
-
static void DialogShow(void *s, void *r, void *b, int32 destX, int32 destY) {
ScreenContext *myScreen = (ScreenContext *)s;
RectList *myRectList = (RectList *)r;
@@ -653,9 +415,9 @@ bool Dialog_SetPressed(Dialog *d, int32 tag) {
if (myItem) {
Dialog_Refresh_Item(d, myItem, myItem->tag);
return true;
- } else {
- return false;
}
+
+ return false;
}
static bool Dialog_SetUnpressed(Dialog *d, int32 tag) {
@@ -668,9 +430,9 @@ static bool Dialog_SetUnpressed(Dialog *d, int32 tag) {
if (myItem) {
Dialog_Refresh_Item(d, myItem, myItem->tag);
return true;
- } else {
- return false;
}
+
+ return false;
}
static bool Dialog_SetNextDefault(ScreenContext *myScreen, Dialog *d) {
@@ -696,8 +458,8 @@ static bool Dialog_SetNextDefault(ScreenContext *myScreen, Dialog *d) {
if (d->default_item)
return true;
- else
- return false;
+
+ return false;
}
static bool Dialog_SetPrevDefault(ScreenContext *myScreen, Dialog *d) {
@@ -724,8 +486,8 @@ static bool Dialog_SetPrevDefault(ScreenContext *myScreen, Dialog *d) {
if (d->default_item)
return true;
- else
- return false;
+
+ return false;
}
void Dialog_GetNextListItem(Dialog *d) {
@@ -760,109 +522,19 @@ static void Dialog_GetPrevPageList(Dialog *d) {
}
}
-ListItem *Dialog_GetCurrListItem(Dialog *d, Item *i, int32 tag) {
- if ((!i) && (!d))
- return nullptr;
- if (!i)
- i = ItemFind(d->itemList, tag);
- if (!i)
- return nullptr;
-
- return i->currItem;
-}
-
-char *Dialog_GetCurrListItemPrompt(Dialog *d, Item *i, int32 tag) {
- ListItem *myListItem = Dialog_GetCurrListItem(d, i, tag);
- if (myListItem == nullptr)
- return nullptr;
-
- return myListItem->prompt;
-}
-
-bool Dialog_GetCurrListItemTag(Dialog *d, Item *i, int32 tag, int32 *listTag) {
- ListItem *myListItem = Dialog_GetCurrListItem(d, i, tag);
- if (myListItem == nullptr)
- return false;
-
- *listTag = myListItem->tag;
- return true;
-}
-
-char *Dialog_GetListItemPrompt(Dialog *d, Item *i, int32 tag, int32 listTag) {
- if (!i)
- i = ItemFind(d->itemList, tag);
- if (!i)
- return nullptr;
-
- ListItem *myListItem = ListItemFind(i, LIST_BY_TAG, nullptr, listTag);
- if (myListItem == nullptr)
- return nullptr;
-
- return myListItem->prompt;
-}
-
-void Dialog_EmptyListBox(Dialog *d, Item *i, int32 tag) {
- int32 status;
-
- if ((!i) && (!d))
- return;
- if (!i)
- i = ItemFind(d->itemList, tag);
- if (!i)
- return;
-
- Item_empty_list(i);
- (void)vmng_screen_find((void *)d, &status);
- Dialog_Refresh_Item(d, i, i->tag);
-}
-
-void Dialog_RegisterTextField(Dialog *d) {
- Item *myItem = nullptr;
- int32 status;
-
- ScreenContext *myScreen = vmng_screen_find((void *)d, &status);
- if ((!myScreen) || (status != SCRN_ACTIVE))
- return;
- if ((myItem = Item_CheckTextField()) == nullptr)
- return;
- if (myItem->callback) {
- (myItem->callback)((void *)myItem, (void *)d);
- myScreen = vmng_screen_find((void *)d, &status);
- Dialog_Refresh_Item(d, myItem, myItem->tag);
- }
-}
-
static void SystemErrCallback(void *, void *) {
_GD(okButton) = true;
}
-void Dialog_SystemError(char *s) {
- Dialog *aDlog = DialogCreateAbsolute(0, 0, MAX_VIDEO_X, MAX_VIDEO_Y, SF_ALERT);
- Dialog_Add_Message(aDlog, 20, 60, s, 2);
- Dialog_Add_Button(aDlog, 50, 80, " OK ", SystemErrCallback, 100);
-
- Dialog_Configure(aDlog, 0, 100, 0);
- vmng_screen_show((void *)aDlog);
- _GD(okButton) = false;
-
- while (!_GD(okButton)) {
- gui_system_event_handler();
- }
-
- DialogDestroy(aDlog, (M4Rect *)nullptr);
-}
-
void Dialog_KeyMouseCollision(void) {
- Item *textItem;
_GD(movingScreen) = false;
_GD(clickItem) = nullptr;
_GD(doubleClickItem) = nullptr;
_GD(listboxSearchStr)[0] = '\0';
- if ((textItem = Item_CheckTextField()) != nullptr) {
- if (textItem->callback) {
- (textItem->callback)((void *)textItem, nullptr);
- }
+ Item *textItem = Item_CheckTextField();
+ if (textItem && textItem->callback) {
+ (textItem->callback)((void *)textItem, nullptr);
}
}
@@ -990,6 +662,8 @@ static bool Dialog_EventHandler(void *myDialog, int32 eventType, int32 parm1, in
case KEY_SHFTTAB:
handled = Dialog_SetPrevDefault(myScreen, d);
break;
+ default:
+ break;
}
}
return handled;
@@ -1143,11 +817,14 @@ static bool Dialog_EventHandler(void *myDialog, int32 eventType, int32 parm1, in
clearClickItem = true;
}
break;
+
+ default:
+ break;
}
if (_GD(clickItem)) {
- if ((_GD(clickItem) = Dialog_Get_Item(d, _GD(clickItem)->tag)) != nullptr) {
+ _GD(clickItem) = Dialog_Get_Item(d, _GD(clickItem)->tag);
+ if (_GD(clickItem))
Dialog_Refresh_Item(d, _GD(clickItem), _GD(clickItem)->tag);
- }
}
if (clearClickItem) {
_GD(doubleClickItem) = _GD(clickItem);
@@ -1331,10 +1008,6 @@ void TextScrn_Activate(TextScrn *myTextScrn) {
vmng_screen_show((void *)myTextScrn);
}
-bool TextScrn_Add_Key(TextScrn *myTextScrn, long myKey, HotkeyCB cb) {
- return AddScreenHotkey((void *)myTextScrn, myKey, cb);
-}
-
bool TextScrn_Add_TextItem(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
int32 justification, const char *prompt, M4CALLBACK callback) {
@@ -1410,40 +1083,6 @@ bool TextScrn_Add_Message(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
return true;
}
-void TextScrn_Delete_TextItem(TextScrn *myTextScrn, int32 tag) {
- int32 status;
- TextItem *tempTextItem;
-
- ScreenContext *myScreen = vmng_screen_find((void *)myTextScrn, &status);
- if (myScreen == nullptr)
- return;
-
- TextItem *myTextItem = myTextScrn->myTextItems;
-
- if (myTextItem->tag == tag) {
- myTextScrn->myTextItems = myTextItem->next;
- tempTextItem = myTextItem;
- } else {
- while (myTextItem->next && (myTextItem->next->tag != tag))
- myTextItem = myTextItem->next;
-
- if ((tempTextItem = myTextItem->next) == nullptr)
- return;
- myTextItem->next = tempTextItem->next;
- }
-
- int32 x = tempTextItem->x;
- int32 y = tempTextItem->y;
- int32 w = tempTextItem->w;
- int32 h = tempTextItem->h;
- mem_free(tempTextItem->prompt);
- mem_free((void *)tempTextItem);
-
- if (status == SCRN_ACTIVE) {
- RestoreScreens(myScreen->x1 + x, myScreen->y1 + y, myScreen->x1 + x + w - 1, myScreen->y1 + y + h - 1);
- }
-}
-
static bool TextScrn_EventHandler(void *theTextScrn, int32 eventType, int32 parm1, int32 parm2, int32 parm3, bool *currScreen) {
TextScrn *myTextScrn = (TextScrn *)theTextScrn;
int32 status;
diff --git a/engines/m4/gui/gui_dialog.h b/engines/m4/gui/gui_dialog.h
index 8b77a0d3759..fb48d7460f2 100644
--- a/engines/m4/gui/gui_dialog.h
+++ b/engines/m4/gui/gui_dialog.h
@@ -45,30 +45,18 @@ struct Dialog {
// General support methods
void destroy();
- void refresh();
- void resize(int32 newW, int32 newH);
void configure(int32 defaultTag, int32 returnTag, int32 cancelTag);
- void setDefault(int32 tag);
- bool setPressed(int32 tag);
void show();
// Add methods
bool addMessage(int32 x, int32 y, const char *prompt, int32 tag);
- bool addPicture(int32 x, int32 y, Buffer *myBuff, int32 tag);
bool addButton(int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag);
- bool addRepeatButton(int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag);
- bool addList(int32 x1, int32 y1, int32 x2, int32 y2, M4CALLBACK cb, int32 tag);
// Item Fields
Item *getItem(int32 tag);
- void changeItemPrompt(const char *newPrompt, Item *myItem, int32 tag);
- bool removeItem(Item *myItem, int32 tag);
- void refreshItem(Item *myItem, int32 tag);
// Text Fields
bool addTextField(int32 x1, int32 y1, int32 x2, const char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength);
- void registerTextField();
-
};
struct TextScrn {
@@ -100,13 +88,10 @@ void gui_dialog_shutdown();
//GENERAL DIALOG SUPPORT
Dialog *DialogCreateAbsolute(int32 x1, int32 y1, int32 x2, int32 y2, uint32 scrnFlags);
-Dialog *DialogCreate(M4Rect *r, uint32 scrnFlags);
void vmng_Dialog_Destroy(Dialog *d); //used only by viewmgr.cpp **DO NOT USE
void DialogDestroy(Dialog *d, M4Rect *r = nullptr);
void Dialog_Refresh(Dialog *d);
void Dialog_Refresh_All();
-void Dialog_Resize(Dialog *d, int32 newW, int32 newH);
-bool GetDialogCoords(Dialog *d, M4Rect *r);
void Dialog_Configure(Dialog *d, int32 defaultTag, int32 returnTag, int32 cancelTag);
void Dialog_SetDefault(Dialog *d, int32 tag);
bool Dialog_SetPressed(Dialog *d, int32 tag);
@@ -114,55 +99,26 @@ bool Dialog_SetPressed(Dialog *d, int32 tag);
//MESSAGE TYPE SUPPORT
bool Dialog_Add_Message(Dialog *d, int32 x, int32 y, const char *prompt, int32 tag);
-//PICTURE TYPE SUPPORT
-bool Dialog_Add_Picture(Dialog *d, int32 x, int32 y, Buffer *myBuff, int32 tag);
-
//BUTTON TYPE SUPPORT
bool Dialog_Add_Button(Dialog *d, int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag);
-bool Dialog_Add_RepeatButton(Dialog *d, int32 x, int32 y, const char *prompt, M4CALLBACK cb, int32 tag);
//LIST TYPE SUPPORT
-bool Dialog_Add_List(Dialog *d, int32 x1, int32 y1, int32 x2, int32 y2, M4CALLBACK cb, int32 tag);
-bool Dialog_Add_DirList(Dialog *d, int32 x1, int32 y1, int32 x2, int32 y2, M4CALLBACK cb, int32 tag, char *myDir, char *myTypes);
-bool Dialog_Change_DirList(Dialog *d, Item *myItem, const char *myDir, const char *myTypes);
-bool Dialog_Add_List_Item(Dialog *d, Item *myItem, const char *prompt, int32 tag, int32 listTag, int32 addMode, bool refresh);
-bool Dialog_Delete_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myListItem, int32 listTag);
-bool Dialog_Change_List_Item(Dialog *d, Item *myItem, int32 tag, ListItem *myListItem, int32 listTag, char *newPrompt, int32 newListTag, int32 changeMode, bool refresh);
-void Dialog_EmptyListBox(Dialog *d, Item *i, int32 tag);
-char *Dialog_GetListItemPrompt(Dialog *d, Item *i, int32 tag, int32 listTag);
-ListItem *Dialog_GetCurrListItem(Dialog *d, Item *i, int32 tag);
-char *Dialog_GetCurrListItemPrompt(Dialog *d, Item *i, int32 tag);
-bool Dialog_GetCurrListItemTag(Dialog *d, Item *i, int32 tag, int32 *listTag);
-bool Dialog_ListItemExists(Dialog *d, Item *myItem, int32 tag, char *prompt, int32 listTag);
-bool Dialog_ListboxSearch(Dialog *d, Item *myItem, int32 tag, int32 searchMode, char *searchStr, int32 parm1);
void Dialog_GetPrevListItem(Dialog *d);
void Dialog_GetNextListItem(Dialog *d);
//TEXTFIELD TYPE SUPPORT
bool Dialog_Add_TextField(Dialog *d, int32 x1, int32 y1, int32 x2, const char *defaultPrompt, M4CALLBACK cb, int32 tag, int32 fieldLength);
-void Dialog_RegisterTextField(Dialog *d);
-
-//HOTKEY SUPPORT
-bool Dialog_Add_Key(Dialog *d, long myKey, HotkeyCB cb);
-bool Dialog_Remove_Key(Dialog *d, long myKey);
//GENERAL ITEM SUPPORT
Item *Dialog_Get_Item(Dialog *d, int32 tag);
void Dialog_Change_Item_Prompt(Dialog *d, const char *newPrompt, Item *myItem, int32 tag);
-bool Dialog_Remove_Item(Dialog *d, Item *myItem, int32 tag);
void Dialog_Refresh_Item(Dialog *d, Item *myItem, int32 tag);
void Dialog_KeyMouseCollision();
-void Dialog_SystemError(char *s);
-
bool sizeofGUIelement_border(int16 el_type, int32 *w, int32 *h);
bool sizeofGUIelement_interior(ButtonDrawRec *bdr, M4Rect *myRect);
bool drawGUIelement(ButtonDrawRec *bdr, M4Rect *myRect);
-bool custom_drawGUIelement(ButtonDrawRec *bdr, M4Rect *myRect);
-bool custom_sizeofGUIelement_border(int16 el_type, int32 *w, int32 *h);
-bool custom_sizeofGUIelement_interior(ButtonDrawRec *bdr, M4Rect *myRect);
-
//----------------------------------------------------------------------------------------
//TEXTSCRN STUFF...
TextScrn *TextScrn_Create(int32 x1, int32 y1, int32 x2, int32 y2, int32 luminance, uint32 scrnFlags,
@@ -172,13 +128,10 @@ TextScrn *TextScrn_Create(int32 x1, int32 y1, int32 x2, int32 y2, int32 luminanc
void vmng_TextScrn_Destroy(TextScrn *myTextScrn);
void TextScrn_Destroy(TextScrn *myTextScrn);
void TextScrn_Activate(TextScrn *myTextScrn);
-bool TextScrn_Add_Key(TextScrn *myTextScrn, long myKey, HotkeyCB cb);
bool TextScrn_Add_TextItem(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
int32 justification, const char *prompt, M4CALLBACK callback);
bool TextScrn_Add_Message(TextScrn *myTextScrn, int32 x, int32 y, int32 tag,
int32 justification, const char *prompt);
-void TextScrn_Change_TextItem(TextScrn *myTextScrn, int32 tag, char *prompt, uint8 color);
-void TextScrn_Delete_TextItem(TextScrn *myTextScrn, int32 tag);
} // End of namespace M4
diff --git a/engines/m4/gui/gui_vmng_screen.cpp b/engines/m4/gui/gui_vmng_screen.cpp
index 6fa178f5aa6..15054554486 100644
--- a/engines/m4/gui/gui_vmng_screen.cpp
+++ b/engines/m4/gui/gui_vmng_screen.cpp
@@ -213,20 +213,6 @@ static void vmng_black_out_video(int32 x1, int32 y1, int32 x2, int32 y2) {
g_system->fillScreen(r, 0);
}
-bool AddScreenHotkey(void *scrnContent, int32 myKey, HotkeyCB callback) {
- ScreenContext *myScreen = vmng_screen_find(scrnContent, nullptr);
- if (myScreen == nullptr)
- return false;
-
- Hotkey *myHotkey = (Hotkey *)mem_alloc(sizeof(Hotkey), "hotkey");
-
- myHotkey->myKey = myKey;
- myHotkey->callback = callback;
- myHotkey->next = myScreen->scrnHotkeys;
- myScreen->scrnHotkeys = myHotkey;
- return true;
-}
-
bool RemoveScreenHotkey(void *scrnContent, int32 myKey) {
ScreenContext *myScreen = vmng_screen_find(scrnContent, nullptr);
if (myScreen == nullptr)
diff --git a/engines/m4/gui/gui_vmng_screen.h b/engines/m4/gui/gui_vmng_screen.h
index f348c3e5a8c..9dc34b05942 100644
--- a/engines/m4/gui/gui_vmng_screen.h
+++ b/engines/m4/gui/gui_vmng_screen.h
@@ -46,15 +46,6 @@ bool GetScreenCoords(void *scrnContent, int32 *x1, int32 *y1, int32 *x2, int32 *
*/
bool vmng_SetScreenRefresh(void *scrnContent, RefreshFunc redraw);
-/**
- * Add a "hot key" to a window.
- * @paramscrnContent The window identifier
- * @param myKey The "key" which, when pressed, will cause the callback function
- * to be executed.
- * @param callback The function to be executed when "myKey" is pressed
- */
-bool AddScreenHotkey(void *scrnContent, int32 myKey, HotkeyCB callback);
-
/**
* Remove a hot key
* @param scrnContent The window identifier
Commit: b48ac7ddcb3f161c94cbdda453af1b85deb0ba83
https://github.com/scummvm/scummvm/commit/b48ac7ddcb3f161c94cbdda453af1b85deb0ba83
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2026-02-13T12:07:50+01:00
Commit Message:
M4: Partial cleanup in gui
Changed paths:
engines/m4/gui/game_menu.h
engines/m4/gui/gui_buffer.cpp
engines/m4/gui/gui_buffer.h
engines/m4/gui/gui_cheapo.cpp
engines/m4/gui/gui_cheapo.h
diff --git a/engines/m4/gui/game_menu.h b/engines/m4/gui/game_menu.h
index 4389c36c5fb..ffc29748298 100644
--- a/engines/m4/gui/game_menu.h
+++ b/engines/m4/gui/game_menu.h
@@ -23,7 +23,6 @@
#ifndef M4_GUI_GUI_GAME_MENU_H
#define M4_GUI_GUI_GAME_MENU_H
-#include "m4/m4_types.h"
#include "m4/gui/gui_menu_items.h"
namespace M4 {
diff --git a/engines/m4/gui/gui_buffer.cpp b/engines/m4/gui/gui_buffer.cpp
index b4601805b1d..c3d043e38ab 100644
--- a/engines/m4/gui/gui_buffer.cpp
+++ b/engines/m4/gui/gui_buffer.cpp
@@ -32,48 +32,6 @@ bool gui_buffer_system_init() {
void gui_buffer_system_shutdown() {
}
-static void Buffer_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
- ScreenContext *myScreen = (ScreenContext *)s;
- RectList *myRectList = (RectList *)r;
- Buffer *destBuffer = (Buffer *)b;
- RectList *myRect;
-
- // Parameter verification
- if (!myScreen) return;
- Buffer *myBuffer = (Buffer *)(myScreen->scrnContent);
- if (!myBuffer)
- return;
-
- // If no destBuffer, then draw directly to video
- if (!destBuffer) {
- myRect = myRectList;
- while (myRect) {
- vmng_refresh_video(myRect->x1, myRect->y1, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
- myRect->x2 - myScreen->x1, myRect->y2 - myScreen->y1, myBuffer);
- myRect = myRect->next;
- }
- } else {
- // Draw to the dest buffer
- myRect = myRectList;
- while (myRect) {
- gr_buffer_rect_copy_2(myBuffer, destBuffer, myRect->x1 - myScreen->x1, myRect->y1 - myScreen->y1,
- destX, destY, myRect->x2 - myRect->x1 + 1, myRect->y2 - myRect->y1 + 1);
- myRect = myRect->next;
- }
- }
-}
-
-bool gui_buffer_register(int32 x1, int32 y1, Buffer *myBuf, uint32 scrnFlags, EventHandler evtHandler) {
- int32 x2 = x1 + myBuf->w - 1;
- int32 y2 = y1 + myBuf->h - 1;
-
- if (!vmng_screen_create(x1, y1, x2, y2, SCRN_BUF, scrnFlags | SF_OFFSCRN, (void *)myBuf,
- (RefreshFunc)Buffer_Show, evtHandler))
- return false;
-
- return true;
-}
-
void GrBuff_Show(void *s, void *r, void *b, int32 destX, int32 destY) {
ScreenContext *myScreen = (ScreenContext *)s;
RectList *myRectList = (RectList *)r;
@@ -138,8 +96,4 @@ void gui_buffer_activate(Buffer *myBuf) {
vmng_screen_show((void *)myBuf);
}
-bool gui_buffer_add_key(Buffer *myBuf, long myKey, HotkeyCB cb) {
- return AddScreenHotkey((void *)myBuf, myKey, cb);
-}
-
} // End of namespace M4
diff --git a/engines/m4/gui/gui_buffer.h b/engines/m4/gui/gui_buffer.h
index 6980c4383ad..ac1fa9449a4 100644
--- a/engines/m4/gui/gui_buffer.h
+++ b/engines/m4/gui/gui_buffer.h
@@ -40,10 +40,11 @@ bool gui_buffer_system_init();
void gui_buffer_system_shutdown();
/**
- * Register a Buffer with the view manager by creating a view mananger screen
+ * Register a Buffer with the view manager by creating a view manager screen
* @param x1 Where the screen should initially be placed, coords relative
to the top left hand monitor corner.
* @param y1 The screens initial "y" coord
+ * @param myBuf The Buffer specified
* @param scrnFlags Flags defining the screens: layer, transparency,
moveability, etc.
* @param evtHandler A pointer to the procedure to be executed when
@@ -52,12 +53,9 @@ void gui_buffer_system_shutdown();
* @remarks The user is responsible for keeping the Buffer *.
Any changes to the contents will be made by the user.
*/
-bool gui_buffer_register(int32 x1, int32 y1, Buffer *myBuf, uint32 scrnFlags, EventHandler evtHandler);
-void gui_buffer_deregister(void *myBuf);
-
bool gui_GrBuff_register(int32 x1, int32 y1, GrBuff *myBuf, uint32 scrnFlags, EventHandler evtHandler);
+void gui_buffer_deregister(void *myBuf);
void gui_buffer_activate(Buffer *myBuf);
-bool gui_buffer_add_key(Buffer *myBuf, long myKey, HotkeyCB cb);
/**
* Change which procedure will handle the events sent to the screen, which was
diff --git a/engines/m4/gui/gui_cheapo.cpp b/engines/m4/gui/gui_cheapo.cpp
index 7afe69c9b00..69c34eaddf1 100644
--- a/engines/m4/gui/gui_cheapo.cpp
+++ b/engines/m4/gui/gui_cheapo.cpp
@@ -25,7 +25,6 @@
#include "m4/graphics/gr_font.h"
#include "m4/graphics/gr_pal.h"
#include "m4/graphics/gr_series.h"
-#include "m4/adv_r/adv_trigger.h"
#include "m4/core/cstring.h"
#include "m4/core/errors.h"
#include "m4/m4.h"
@@ -114,7 +113,7 @@ void TextField::set_string(const char *string) {
return;
}
- int16 string_len = (int16)(cstrlen(string) + 1);
+ const int16 string_len = (int16)(cstrlen(string) + 1);
if (_string == nullptr) {
_string = (char *)mem_alloc(string_len, "string");
} else if (_string_len < string_len) {
@@ -271,12 +270,12 @@ ControlStatus ButtonClass::track(int32 eventType, int16 x, int16 y) {
if (!INTERFACE_VISIBLE)
return NOTHING;
- ButtonState old_state = _state;
+ const ButtonState old_state = _state;
ControlStatus result = NOTHING;
- bool button_clicked = (eventType == _ME_L_click) || (eventType == _ME_L_hold) || (eventType == _ME_L_drag);
+ const bool button_clicked = (eventType == _ME_L_click) || (eventType == _ME_L_hold) || (eventType == _ME_L_drag);
- int16 overTag = inside(x, y);
+ const int16 overTag = inside(x, y);
if (overTag == _tag) {
// if Button is pressed
@@ -374,12 +373,12 @@ ControlStatus Toggler::track(int32 eventType, int16 x, int16 y) {
if (!INTERFACE_VISIBLE)
return NOTHING;
- ButtonState old_state = _state;
+ const ButtonState old_state = _state;
ControlStatus result = NOTHING;
- bool button_clicked = (eventType == _ME_L_click) || (eventType == _ME_L_hold) || (eventType == _ME_L_drag);
+ const bool button_clicked = (eventType == _ME_L_click) || (eventType == _ME_L_hold) || (eventType == _ME_L_drag);
- int16 overTag = inside(x, y);
+ const int16 overTag = inside(x, y);
if (overTag == _tag) {
// if Button is pressed
@@ -437,8 +436,7 @@ int16 InterfaceBox::inside(int16 x, int16 y) const {
if (!RectClass::inside(x, y))
return -1;
- int16 iter;
- for (iter = 0; iter < _index; iter++) {
+ for (int16 iter = 0; iter < _index; iter++) {
if (_button[iter]->inside(x, y))
return _button[iter]->get_tag();
}
diff --git a/engines/m4/gui/gui_cheapo.h b/engines/m4/gui/gui_cheapo.h
index 120b799f014..4da720fb0a0 100644
--- a/engines/m4/gui/gui_cheapo.h
+++ b/engines/m4/gui/gui_cheapo.h
@@ -25,7 +25,6 @@
#include "common/str.h"
#include "m4/graphics/gr_buff.h"
-#include "m4/m4_types.h"
namespace M4 {
namespace GUI {
@@ -72,7 +71,7 @@ public:
~TextField();
void set_string(const char *string);
- void draw(GrBuff *interface_buffer);
+ void draw(GrBuff *myBuffer);
};
class ButtonClass : public RectClass {
@@ -104,7 +103,7 @@ public:
int16 relaxed, int16 over, int16 picked, int sprite);
~ButtonClass();
- void draw(GrBuff *interface_buffer);
+ void draw(GrBuff *myBuffer);
int16 inside(int16 x, int16 y) const override;
virtual ControlStatus track(int32 eventType, int16 x, int16 y);
@@ -147,12 +146,11 @@ public:
InterfaceBox(const RectClass &r);
~InterfaceBox();
- void draw(GrBuff *interface_buffer);
+ void draw(GrBuff *myBuffer);
int16 inside(int16 x, int16 y) const override;
ControlStatus track(int32 eventType, int16 x, int16 y);
void add(ButtonClass *b);
- int16 check_inventory(int16 x, int16 y);
void highlight_button(int16 index);
void set_selected(bool);
More information about the Scummvm-git-logs
mailing list