[Scummvm-git-logs] scummvm master -> f42092f85819b53955acd287f40437197f7e76aa
OMGPizzaGuy
48367439+OMGPizzaGuy at users.noreply.github.com
Sun Aug 9 17:08:46 UTC 2020
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8377cfb1c0 ULTIMA8: Add width and height accessor methods to Ulitima8::Rect and use where possible.
f42092f858 Merge remote-tracking branch 'upstream/master'
Commit: 8377cfb1c0ab46c29f4987f53d7b950eff1be1ea
https://github.com/scummvm/scummvm/commit/8377cfb1c0ab46c29f4987f53d7b950eff1be1ea
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2020-08-09T12:07:07-05:00
Commit Message:
ULTIMA8: Add width and height accessor methods to Ulitima8::Rect and use where possible.
The goal is to make Ultima8::Rect extend Common::Rect or possible be replaced altogether. These methods provide a easy first step.
Changed paths:
engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp
engines/ultima/ultima8/graphics/fonts/tt_font.cpp
engines/ultima/ultima8/graphics/soft_render_surface.inl
engines/ultima/ultima8/gumps/ask_gump.cpp
engines/ultima/ultima8/gumps/bark_gump.cpp
engines/ultima/ultima8/gumps/computer_gump.cpp
engines/ultima/ultima8/gumps/container_gump.cpp
engines/ultima/ultima8/gumps/cru_ammo_gump.cpp
engines/ultima/ultima8/gumps/cru_inventory_gump.cpp
engines/ultima/ultima8/gumps/cru_pickup_gump.cpp
engines/ultima/ultima8/gumps/cru_status_gump.cpp
engines/ultima/ultima8/gumps/desktop_gump.cpp
engines/ultima/ultima8/gumps/game_map_gump.cpp
engines/ultima/ultima8/gumps/gump.cpp
engines/ultima/ultima8/gumps/inverter_gump.cpp
engines/ultima/ultima8/gumps/item_relative_gump.cpp
engines/ultima/ultima8/gumps/menu_gump.cpp
engines/ultima/ultima8/gumps/message_box_gump.cpp
engines/ultima/ultima8/gumps/paperdoll_gump.cpp
engines/ultima/ultima8/gumps/readable_gump.cpp
engines/ultima/ultima8/gumps/remorse_menu_gump.cpp
engines/ultima/ultima8/gumps/scaler_gump.cpp
engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
engines/ultima/ultima8/gumps/u8_save_gump.cpp
engines/ultima/ultima8/gumps/widgets/button_widget.cpp
engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
engines/ultima/ultima8/gumps/widgets/text_widget.cpp
engines/ultima/ultima8/kernel/mouse.cpp
engines/ultima/ultima8/misc/rect.h
engines/ultima/ultima8/ultima8.cpp
engines/ultima/ultima8/world/current_map.cpp
engines/ultima/ultima8/world/snap_process.cpp
diff --git a/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp b/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
index 8a16a95109..5b994dcaff 100644
--- a/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
+++ b/engines/ultima/ultima8/graphics/base_soft_render_surface.cpp
@@ -500,7 +500,7 @@ void BaseSoftRenderSurface::SetFlipped(bool wantFlipped) {
// We keep the 'origin' in the same position relative to the clipping window
_oy -= _clipWindow.y;
- _clipWindow.y = _height - (_clipWindow.y + _clipWindow.h);
+ _clipWindow.setHeight(_height - _clipWindow.y + _clipWindow.height());
_oy += _clipWindow.y;
_pitch = -_pitch;
diff --git a/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp b/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
index 3b262c1cce..687d1b7fa5 100644
--- a/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/jp_rendered_text.cpp
@@ -71,7 +71,7 @@ void JPRenderedText::draw(RenderSurface *surface, int x, int y, bool /*destmaske
if (i == iter->_cursor) {
surface->Fill32(0xFF000000, line_x, line_y - _font->getBaseline(),
- 1, iter->_dims.h);
+ 1, iter->_dims.height());
}
line_x += (_font->getFrame(u8char))->_width - _font->getHlead();
@@ -79,7 +79,7 @@ void JPRenderedText::draw(RenderSurface *surface, int x, int y, bool /*destmaske
if (iter->_cursor == textsize) {
surface->Fill32(0xFF000000, line_x, line_y - _font->getBaseline(),
- 1, iter->_dims.h);
+ 1, iter->_dims.height());
}
}
diff --git a/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp b/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp
index 6da95e4832..0d1060b4d3 100644
--- a/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/shape_rendered_text.cpp
@@ -58,7 +58,7 @@ void ShapeRenderedText::draw(RenderSurface *surface, int x, int y, bool /*destma
if (i == iter->_cursor) {
surface->Fill32(0xFF000000, line_x, line_y - _font->getBaseline(),
- 1, iter->_dims.h);
+ 1, iter->_dims.height());
}
line_x += _font->getWidth(iter->_text[i]) - _font->getHlead();
@@ -66,7 +66,7 @@ void ShapeRenderedText::draw(RenderSurface *surface, int x, int y, bool /*destma
if (iter->_cursor == textsize) {
surface->Fill32(0xFF000000, line_x, line_y - _font->getBaseline(),
- 1, iter->_dims.h);
+ 1, iter->_dims.height());
}
}
}
diff --git a/engines/ultima/ultima8/graphics/fonts/tt_font.cpp b/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
index b5160b24b6..8e708f569f 100644
--- a/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
+++ b/engines/ultima/ultima8/graphics/fonts/tt_font.cpp
@@ -256,7 +256,7 @@ RenderedText *TTFont::renderText(const Std::string &text, unsigned int &remainin
int w = _ttfFont->getStringWidth(unicodeText);
- for (int y = 0; y < iter->_dims.h; y++) {
+ for (int y = 0; y < iter->_dims.height(); y++) {
uint32 *bufrow = texBuf + (iter->_dims.y + y) * resultWidth;
bufrow[iter->_dims.x + w + _borderSize] = 0xFF000000;
// if (_borderSize > 0)
diff --git a/engines/ultima/ultima8/graphics/soft_render_surface.inl b/engines/ultima/ultima8/graphics/soft_render_surface.inl
index 2a7dbd19a5..9c6cf90409 100644
--- a/engines/ultima/ultima8/graphics/soft_render_surface.inl
+++ b/engines/ultima/ultima8/graphics/soft_render_surface.inl
@@ -113,8 +113,8 @@ const int32 neg = (FLIP_CONDITIONAL)?-1:0;
//
#else
- const int scrn_width = _clipWindow.w;
- const int scrn_height = _clipWindow.h;
+ const int scrn_width = _clipWindow.width();
+ const int scrn_height = _clipWindow.height();
#define LINE_END_ASSIGN const uintX *dst_line_end = dst_line_start + scrn_width
#define NOT_CLIPPED_X (dstpix >= dst_line_start && dstpix < dst_line_end)
diff --git a/engines/ultima/ultima8/gumps/ask_gump.cpp b/engines/ultima/ultima8/gumps/ask_gump.cpp
index 63eb2786db..336114d0be 100644
--- a/engines/ultima/ultima8/gumps/ask_gump.cpp
+++ b/engines/ultima/ultima8/gumps/ask_gump.cpp
@@ -70,18 +70,20 @@ void AskGump::InitGump(Gump *newparent, bool take_focus) {
Rect cd;
child->GetDims(cd);
if (i + 1 < _answers->getSize())
- cd.h += child->getVlead();
+ cd.setHeight(cd.height() + child->getVlead());
- if (px + cd.w > 160 && px != 0) {
- py = _dims.h;
+ if (px + cd.width() > 160 && px != 0) {
+ py = _dims.height();
px = 0;
child->Move(px, py);
}
- if (cd.w + px > _dims.w) _dims.w = cd.w + px;
- if (cd.h + py > _dims.h) _dims.h = cd.h + py;
+ if (cd.width() + px > _dims.width())
+ _dims.setWidth(cd.width() + px);
+ if (cd.height() + py > _dims.height())
+ _dims.setHeight(cd.height() + py);
- px += cd.w + 4;
+ px += cd.width() + 4;
}
// Wait with ItemRelativeGump initialization until we calculated our size.
@@ -116,8 +118,8 @@ bool AskGump::loadData(Common::ReadStream *rs, uint32 version) {
// HACK ALERT
int px = 0, py = 0;
- _dims.w = 0;
- _dims.h = 0;
+ _dims.setWidth(0);
+ _dims.setHeight(0);
for (unsigned int i = 0; i < _answers->getSize(); ++i) {
@@ -136,16 +138,18 @@ bool AskGump::loadData(Common::ReadStream *rs, uint32 version) {
Rect cd;
child->GetDims(cd);
- if (px + cd.w > 160 && px != 0) {
- py = _dims.h;
+ if (px + cd.width() > 160 && px != 0) {
+ py = _dims.height();
px = 0;
}
child->Move(px, py);
- if (cd.w + px > _dims.w) _dims.w = cd.w + px;
- if (cd.h + py > _dims.h) _dims.h = cd.h + py;
+ if (cd.width() + px > _dims.width())
+ _dims.setWidth(cd.width() + px);
+ if (cd.height() + py > _dims.height())
+ _dims.setHeight(cd.height() + py);
- px += cd.w + 4;
+ px += cd.width() + 4;
}
return true;
diff --git a/engines/ultima/ultima8/gumps/bark_gump.cpp b/engines/ultima/ultima8/gumps/bark_gump.cpp
index 7449720918..a425a81daf 100644
--- a/engines/ultima/ultima8/gumps/bark_gump.cpp
+++ b/engines/ultima/ultima8/gumps/bark_gump.cpp
@@ -90,10 +90,10 @@ void BarkGump::InitGump(Gump *newparent, bool take_focus) {
// First we count the total height of all text blocks.
Rect d;
widget->GetDims(d);
- _totalTextHeight = d.h;
+ _totalTextHeight = d.height();
while (widget->setupNextText()) {
widget->GetDims(d);
- _totalTextHeight += d.h;
+ _totalTextHeight += d.height();
}
widget->rewind();
}
@@ -103,12 +103,12 @@ void BarkGump::InitGump(Gump *newparent, bool take_focus) {
Rect d;
widget->GetDims(d);
if (_speechLength && _totalTextHeight) {
- _counter = (d.h * _speechLength) / _totalTextHeight;
+ _counter = (d.height() * _speechLength) / _totalTextHeight;
} else {
- _counter = d.h * _textDelay;
+ _counter = d.height() * _textDelay;
}
- _dims.h = d.h;
- _dims.w = d.w;
+ _dims.setHeight(d.height());
+ _dims.setWidth(d.width());
// Wait with ItemRelativeGump initialization until we calculated our size.
ItemRelativeGump::InitGump(newparent, take_focus);
@@ -122,12 +122,12 @@ bool BarkGump::NextText() {
Rect d;
widget->GetDims(d);
if (_speechLength && _totalTextHeight) {
- _counter = (d.h * _speechLength) / _totalTextHeight;
+ _counter = (d.height() * _speechLength) / _totalTextHeight;
} else {
- _counter = d.h * _textDelay;
+ _counter = d.height() * _textDelay;
}
- _dims.h = d.h;
- _dims.w = d.w;
+ _dims.setHeight(d.height());
+ _dims.setWidth(d.width());
return true;
}
@@ -218,9 +218,9 @@ bool BarkGump::loadData(Common::ReadStream *rs, uint32 version) {
// This is just a hack
Rect d;
widget->GetDims(d);
- _counter = d.h * _textDelay;
- _dims.h = d.h;
- _dims.w = d.w;
+ _counter = d.height() * _textDelay;
+ _dims.setHeight(d.height());
+ _dims.setWidth(d.width());
return true;
}
diff --git a/engines/ultima/ultima8/gumps/computer_gump.cpp b/engines/ultima/ultima8/gumps/computer_gump.cpp
index ff7a10c0fb..27621ab709 100644
--- a/engines/ultima/ultima8/gumps/computer_gump.cpp
+++ b/engines/ultima/ultima8/gumps/computer_gump.cpp
@@ -74,10 +74,10 @@ void ComputerGump::InitGump(Gump *newparent, bool take_focus) {
return;
}
- _dims.w = topFrame->_width;
- _dims.h = topFrame->_height + botFrame->_height;
_dims.x = 0;
_dims.y = 0;
+ _dims.setWidth(topFrame->_width);
+ _dims.setHeight(topFrame->_height + botFrame->_height);
Gump *topGump = new Gump(0, 0, topFrame->_width, topFrame->_height);
topGump->SetShape(shape, 0);
@@ -86,7 +86,7 @@ void ComputerGump::InitGump(Gump *newparent, bool take_focus) {
botGump->SetShape(shape, 1);
botGump->InitGump(this, false);
- _textWidget = new TextWidget(41, 38, _text, true, COMPUTER_FONT, _dims.w - 100, 0, Font::TEXT_LEFT);
+ _textWidget = new TextWidget(41, 38, _text, true, COMPUTER_FONT, _dims.width() - 100, 0, Font::TEXT_LEFT);
_textWidget->InitGump(this);
AudioProcess *audio = AudioProcess::get_instance();
diff --git a/engines/ultima/ultima8/gumps/container_gump.cpp b/engines/ultima/ultima8/gumps/container_gump.cpp
index d0b37e6d00..b244051352 100644
--- a/engines/ultima/ultima8/gumps/container_gump.cpp
+++ b/engines/ultima/ultima8/gumps/container_gump.cpp
@@ -93,8 +93,8 @@ void ContainerGump::getItemCoords(Item *item, int32 &itemx, int32 &itemy) {
// randomize position
// TODO: maybe try to put it somewhere where it doesn't overlap others?
- itemx = getRandom() % _itemArea.w;
- itemy = getRandom() % _itemArea.h;
+ itemx = getRandom() % _itemArea.width();
+ itemy = getRandom() % _itemArea.height();
item->setGumpLocation(itemx, itemy);
}
@@ -247,8 +247,8 @@ void ContainerGump::GetItemLocation(int32 lerp_factor) {
if (_parent) _parent->ScreenSpaceToGump(gx, gy);
// Set x and y, and center us over it
- _ix = gx - _dims.w / 2;
- _iy = gy - _dims.h;
+ _ix = gx - _dims.width() / 2;
+ _iy = gy - _dims.height();
}
void ContainerGump::Close(bool no_del) {
@@ -409,9 +409,9 @@ bool ContainerGump::DraggingItem(Item *item, int mx, int my) {
assert(fr);
if (_draggingX - fr->_xoff < 0 ||
- _draggingX - fr->_xoff + fr->_width > _itemArea.w ||
+ _draggingX - fr->_xoff + fr->_width > _itemArea.width() ||
_draggingY - fr->_yoff < 0 ||
- _draggingY - fr->_yoff + fr->_height > _itemArea.h) {
+ _draggingY - fr->_yoff + fr->_height > _itemArea.height()) {
_displayDragging = false;
return false;
}
@@ -539,8 +539,8 @@ void ContainerGump::saveData(Common::WriteStream *ws) {
ws->writeUint32LE(static_cast<uint32>(_itemArea.x));
ws->writeUint32LE(static_cast<uint32>(_itemArea.y));
- ws->writeUint32LE(static_cast<uint32>(_itemArea.w));
- ws->writeUint32LE(static_cast<uint32>(_itemArea.h));
+ ws->writeUint32LE(static_cast<uint32>(_itemArea.width()));
+ ws->writeUint32LE(static_cast<uint32>(_itemArea.height()));
}
bool ContainerGump::loadData(Common::ReadStream *rs, uint32 version) {
diff --git a/engines/ultima/ultima8/gumps/cru_ammo_gump.cpp b/engines/ultima/ultima8/gumps/cru_ammo_gump.cpp
index bbfc1cf588..998e971421 100644
--- a/engines/ultima/ultima8/gumps/cru_ammo_gump.cpp
+++ b/engines/ultima/ultima8/gumps/cru_ammo_gump.cpp
@@ -90,7 +90,7 @@ void CruAmmoGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
const Std::string bulletstr = Std::string::format("%d", bullets);
if (!bulletstr.equals(_bulletsText->getText())) {
RemoveChild(_bulletsText);
- _bulletsText = new TextWidget(22, _dims.h / 2 - 3, bulletstr, true, 15);
+ _bulletsText = new TextWidget(22, _dims.height() / 2 - 3, bulletstr, true, 15);
_bulletsText->InitGump(this, false);
}
@@ -106,7 +106,7 @@ void CruAmmoGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
const Std::string clipstr = Std::string::format("%d", clips);
if (!clipstr.equals(_clipsText->getText())) {
RemoveChild(_clipsText);
- _clipsText = new TextWidget(_dims.w / 2 + 22, _dims.h / 2 - 3, clipstr, true, 15);
+ _clipsText = new TextWidget(_dims.width() / 2 + 22, _dims.height() / 2 - 3, clipstr, true, 15);
_clipsText->InitGump(this, false);
}
diff --git a/engines/ultima/ultima8/gumps/cru_inventory_gump.cpp b/engines/ultima/ultima8/gumps/cru_inventory_gump.cpp
index e909a70d0a..ce626f8951 100644
--- a/engines/ultima/ultima8/gumps/cru_inventory_gump.cpp
+++ b/engines/ultima/ultima8/gumps/cru_inventory_gump.cpp
@@ -136,7 +136,7 @@ void CruInventoryGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool sc
const Std::string ¤ttext = _inventoryText->getText();
if (!qtext.equals(currenttext)) {
RemoveChild(_inventoryText);
- _inventoryText = new TextWidget(_dims.w / 2 + 22, _dims.h / 2 + 3, qtext, true, INVENTORY_TEXT_FONT);
+ _inventoryText = new TextWidget(_dims.width() / 2 + 22, _dims.height() / 2 + 3, qtext, true, INVENTORY_TEXT_FONT);
_inventoryText->InitGump(this, false);
}
} else {
diff --git a/engines/ultima/ultima8/gumps/cru_pickup_gump.cpp b/engines/ultima/ultima8/gumps/cru_pickup_gump.cpp
index 9e01a9fbf9..789fb43607 100644
--- a/engines/ultima/ultima8/gumps/cru_pickup_gump.cpp
+++ b/engines/ultima/ultima8/gumps/cru_pickup_gump.cpp
@@ -107,8 +107,8 @@ void CruPickupGump::InitGump(Gump *newparent, bool take_focus) {
gump->SetShape(bfgrameid, false);
gump->InitGump(this, false);
}
- _dims.w = bgframe->_width * 5;
- _dims.h = bgframe->_height;
+ _dims.setWidth(bgframe->_width * 5);
+ _dims.setHeight(bgframe->_height);
// Paint the item name text
TextWidget *text = new TextWidget(ITEM_AREA_WIDTH, bgframe->_height / 2 - 5, _itemName, true, ITEM_TEXT_FONT);
@@ -117,17 +117,17 @@ void CruPickupGump::InitGump(Gump *newparent, bool take_focus) {
// Paint the count if needed
if (_q > 1) {
Std::string qstr = Std::string::format("%d", _q);
- TextWidget *count = new TextWidget(ITEM_AREA_WIDTH / 2 + 22, _dims.h / 2 + 3, qstr, true, COUNT_TEXT_FONT);
+ TextWidget *count = new TextWidget(ITEM_AREA_WIDTH / 2 + 22, _dims.height() / 2 + 3, qstr, true, COUNT_TEXT_FONT);
count->InitGump(this, false);
}
// Paint the item in the mid-left item area.
const ShapeFrame *itemframe = itemshape->getFrame(_gumpFrameNo);
- Gump *itemgump = new Gump(0, _dims.h / 2 - itemframe->_height / 2, itemframe->_width, itemframe->_height, 0, 0, LAYER_ABOVE_NORMAL);
+ Gump *itemgump = new Gump(0, _dims.height() / 2 - itemframe->_height / 2, itemframe->_width, itemframe->_height, 0, 0, LAYER_ABOVE_NORMAL);
itemgump->SetShape(itemshape, _gumpFrameNo);
itemgump->InitGump(this, false);
itemgump->UpdateDimsFromShape();
- itemgump->Move(ITEM_AREA_WIDTH / 2 - itemframe->_width / 2, _dims.h / 2 - itemframe->_height / 2);
+ itemgump->Move(ITEM_AREA_WIDTH / 2 - itemframe->_width / 2, _dims.height() / 2 - itemframe->_height / 2);
}
void CruPickupGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
diff --git a/engines/ultima/ultima8/gumps/cru_status_gump.cpp b/engines/ultima/ultima8/gumps/cru_status_gump.cpp
index c14f8ae85e..16ca66c029 100644
--- a/engines/ultima/ultima8/gumps/cru_status_gump.cpp
+++ b/engines/ultima/ultima8/gumps/cru_status_gump.cpp
@@ -87,8 +87,8 @@ void CruStatusGump::InitGump(Gump *newparent, bool take_focus) {
Gump *energyGump = new CruEnergyGump(frameShape, xoff + (w + PX_GAP) * 4);
energyGump->InitGump(this);
- _dims.w = w * 5 + PX_GAP * 4;
- _dims.h = h;
+ _dims.setWidth(w * 5 + PX_GAP * 4);
+ _dims.setHeight(h);
setRelativePosition(BOTTOM_LEFT, PX_FROM_LEFT, -PX_FROM_BOTTOM);
}
diff --git a/engines/ultima/ultima8/gumps/desktop_gump.cpp b/engines/ultima/ultima8/gumps/desktop_gump.cpp
index 1345b5ad87..359bffdd01 100644
--- a/engines/ultima/ultima8/gumps/desktop_gump.cpp
+++ b/engines/ultima/ultima8/gumps/desktop_gump.cpp
@@ -63,7 +63,7 @@ void DesktopGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool sca
// Background is partially transparent
if (_fadedModal && dynamic_cast<ModalGump *>(g) &&
!dynamic_cast<TargetGump *>(g) && !g->IsHidden())
- surf->FillBlended(0x7F000000, 0, 0, _dims.w, _dims.h);
+ surf->FillBlended(0x7F000000, 0, 0, _dims.width(), _dims.height());
g->Paint(surf, lerp_factor, scaled);
}
@@ -93,8 +93,8 @@ void DesktopGump::RenderSurfaceChanged(RenderSurface *surf) {
// Resize the desktop gump to match the RenderSurface
Rect new_dims;
surf->GetSurfaceDims(new_dims);
- _dims.w = new_dims.w;
- _dims.h = new_dims.h;
+ _dims.setWidth(new_dims.width());
+ _dims.setHeight(new_dims.height());
Gump::RenderSurfaceChanged();
}
@@ -103,8 +103,8 @@ void DesktopGump::RenderSurfaceChanged() {
// Resize the desktop gump to match the parent
Rect new_dims;
_parent->GetDims(new_dims);
- _dims.w = new_dims.w;
- _dims.h = new_dims.h;
+ _dims.setWidth(new_dims.width());
+ _dims.setHeight(new_dims.height());
Gump::RenderSurfaceChanged();
}
diff --git a/engines/ultima/ultima8/gumps/game_map_gump.cpp b/engines/ultima/ultima8/gumps/game_map_gump.cpp
index 82423055b4..028bc5efc8 100644
--- a/engines/ultima/ultima8/gumps/game_map_gump.cpp
+++ b/engines/ultima/ultima8/gumps/game_map_gump.cpp
@@ -69,8 +69,8 @@ GameMapGump::GameMapGump(int x, int y, int width, int height) :
_displayList(0), _displayDragging(false), _draggingShape(0), _draggingFrame(0),
_draggingFlags(0) {
// Offset the gump. We want 0,0 to be the centre
- _dims.x -= _dims.w / 2;
- _dims.y -= _dims.h / 2;
+ _dims.x -= _dims.width() / 2;
+ _dims.y -= _dims.height() / 2;
pout << "Create _displayList ItemSorter object" << Std::endl;
_displayList = new ItemSorter();
@@ -567,17 +567,17 @@ void GameMapGump::DropItem(Item *item, int mx, int my) {
}
void GameMapGump::RenderSurfaceChanged() {
- _dims.x += _dims.w / 2;
- _dims.y += _dims.h / 2;
+ _dims.x += _dims.width() / 2;
+ _dims.y += _dims.height() / 2;
// Resize the desktop gump to match the parent
Rect new_dims;
_parent->GetDims(new_dims);
- _dims.w = new_dims.w;
- _dims.h = new_dims.h;
+ _dims.setWidth(new_dims.width());
+ _dims.setHeight(new_dims.height());
- _dims.x -= _dims.w / 2;
- _dims.y -= _dims.h / 2;
+ _dims.x -= _dims.width() / 2;
+ _dims.y -= _dims.height() / 2;
Gump::RenderSurfaceChanged();
}
diff --git a/engines/ultima/ultima8/gumps/gump.cpp b/engines/ultima/ultima8/gumps/gump.cpp
index 7db6e3c310..4d4239500f 100644
--- a/engines/ultima/ultima8/gumps/gump.cpp
+++ b/engines/ultima/ultima8/gumps/gump.cpp
@@ -90,10 +90,10 @@ void Gump::SetShape(FrameID frame, bool adjustsize) {
void Gump::UpdateDimsFromShape() {
const ShapeFrame *sf = _shape->getFrame(_frameNum);
assert(sf);
- _dims.w = sf->_width;
- _dims.h = sf->_height;
_dims.x = -sf->_xoff;
_dims.y = -sf->_yoff;
+ _dims.setWidth(sf->_width);
+ _dims.setHeight(sf->_height);
}
void Gump::CreateNotifier() {
@@ -307,7 +307,7 @@ void Gump::PaintCompositing(RenderSurface *surf, int32 lerp_factor,
surf->GetClippingRect(old_rect);
// Set new clipping rect
- int32 cx = _dims.x, cy = _dims.y, cw = _dims.w, ch = _dims.h;
+ int32 cx = _dims.x, cy = _dims.y, cw = _dims.width(), ch = _dims.height();
GumpRectToScreenSpace(cx, cy, cw, ch, ROUND_OUTSIDE);
Rect new_rect(cx, cy, cw, ch);
new_rect.Intersect(old_rect);
@@ -372,26 +372,26 @@ void Gump::setRelativePosition(Gump::Position pos, int xoffset, int yoffset) {
switch (pos) {
case CENTER:
- Move(rect.w / 2 - _dims.w / 2 + xoffset,
- rect.h / 2 - _dims.h / 2 + yoffset);
+ Move(rect.width() / 2 - _dims.width() / 2 + xoffset,
+ rect.height() / 2 - _dims.height() / 2 + yoffset);
break;
case TOP_LEFT:
Move(xoffset, yoffset);
break;
case TOP_RIGHT:
- Move(rect.w - _dims.w + xoffset, yoffset);
+ Move(rect.width() - _dims.width() + xoffset, yoffset);
break;
case BOTTOM_LEFT:
- Move(xoffset, rect.h - _dims.h + yoffset);
+ Move(xoffset, rect.height() - _dims.height() + yoffset);
break;
case BOTTOM_RIGHT:
- Move(rect.w - _dims.w + xoffset, rect.h - _dims.h + yoffset);
+ Move(rect.width() - _dims.width() + xoffset, rect.height() - _dims.height() + yoffset);
break;
case TOP_CENTER:
- Move(rect.w / 2 - _dims.w / 2 + xoffset, yoffset);
+ Move(rect.width() / 2 - _dims.width() / 2 + xoffset, yoffset);
break;
case BOTTOM_CENTER:
- Move(rect.w / 2 - _dims.w / 2 + xoffset, rect.h - _dims.h + yoffset);
+ Move(rect.width() / 2 - _dims.width() / 2 + xoffset, rect.height() - _dims.height() + yoffset);
break;
default:
break;
@@ -786,8 +786,8 @@ void Gump::saveData(Common::WriteStream *ws) {
ws->writeUint32LE(static_cast<uint32>(_y));
ws->writeUint32LE(static_cast<uint32>(_dims.x));
ws->writeUint32LE(static_cast<uint32>(_dims.y));
- ws->writeUint32LE(static_cast<uint32>(_dims.w));
- ws->writeUint32LE(static_cast<uint32>(_dims.h));
+ ws->writeUint32LE(static_cast<uint32>(_dims.width()));
+ ws->writeUint32LE(static_cast<uint32>(_dims.height()));
ws->writeUint32LE(_flags);
ws->writeUint32LE(static_cast<uint32>(_layer));
ws->writeUint32LE(static_cast<uint32>(_index));
diff --git a/engines/ultima/ultima8/gumps/inverter_gump.cpp b/engines/ultima/ultima8/gumps/inverter_gump.cpp
index aaef63f86f..2c499b5a3d 100644
--- a/engines/ultima/ultima8/gumps/inverter_gump.cpp
+++ b/engines/ultima/ultima8/gumps/inverter_gump.cpp
@@ -90,7 +90,7 @@ void InverterGump::PaintChildren(RenderSurface *surf, int32 lerp_factor, bool sc
return;
}
- int width = _dims.w, height = _dims.h;
+ int width = _dims.width(), height = _dims.height();
// need a backbuffer
@@ -117,7 +117,7 @@ void InverterGump::ParentToGump(int32 &px, int32 &py, PointRoundDir) {
px -= _x;
px += _dims.x;
py -= _y;
- if (Ultima8Engine::get_instance()->isInverted()) py = _dims.h - py - 1;
+ if (Ultima8Engine::get_instance()->isInverted()) py = _dims.height() - py - 1;
py += _dims.y;
}
@@ -126,7 +126,7 @@ void InverterGump::GumpToParent(int32 &gx, int32 &gy, PointRoundDir) {
gx -= _dims.x;
gx += _x;
gy -= _dims.y;
- if (Ultima8Engine::get_instance()->isInverted()) gy = _dims.h - gy - 1;
+ if (Ultima8Engine::get_instance()->isInverted()) gy = _dims.height() - gy - 1;
gy += _y;
}
diff --git a/engines/ultima/ultima8/gumps/item_relative_gump.cpp b/engines/ultima/ultima8/gumps/item_relative_gump.cpp
index bf40104654..2c0ab1015d 100644
--- a/engines/ultima/ultima8/gumps/item_relative_gump.cpp
+++ b/engines/ultima/ultima8/gumps/item_relative_gump.cpp
@@ -65,9 +65,9 @@ void ItemRelativeGump::MoveOnScreen() {
// get rectangle that gump occupies in scalerGump's coordinate space
int32 left, right, top, bottom;
left = -_dims.x;
- right = left + _dims.w;
+ right = left + _dims.width();
top = -_dims.y;
- bottom = top + _dims.h;
+ bottom = top + _dims.height();
GumpToParent(left, top);
GumpToParent(right, bottom);
@@ -75,13 +75,13 @@ void ItemRelativeGump::MoveOnScreen() {
if (left < -sd.x)
movex = -sd.x - left;
- else if (right > -sd.x + sd.w)
- movex = -sd.x + sd.w - right;
+ else if (right > -sd.x + sd.width())
+ movex = -sd.x + sd.width() - right;
if (top < -sd.y)
movey = -sd.y - top;
- else if (bottom > -sd.y + sd.h)
- movey = -sd.y + sd.h - bottom;
+ else if (bottom > -sd.y + sd.height())
+ movey = -sd.y + sd.height() - bottom;
Move(left + movex, top + movey);
}
@@ -155,9 +155,9 @@ void ItemRelativeGump::GetItemLocation(int32 lerp_factor) {
if (_parent) _parent->ScreenSpaceToGump(gx, gy);
// Set x and y, and center us over it
- _ix = gx - _dims.w / 2;
+ _ix = gx - _dims.width() / 2;
// _iy = gy-_dims.h-it->getShapeInfo()->z*8-16;
- _iy = gy - _dims.h;
+ _iy = gy - _dims.height();
if (_flags & FLAG_KEEP_VISIBLE)
diff --git a/engines/ultima/ultima8/gumps/menu_gump.cpp b/engines/ultima/ultima8/gumps/menu_gump.cpp
index 7cec4070bd..823006f894 100644
--- a/engines/ultima/ultima8/gumps/menu_gump.cpp
+++ b/engines/ultima/ultima8/gumps/menu_gump.cpp
@@ -125,7 +125,7 @@ void MenuGump::InitGump(Gump *newparent, bool take_focus) {
settingman->get("endgame", endgame);
settingman->get("quotes", quotes);
- int x_ = _dims.w / 2 + 14;
+ int x_ = _dims.width() / 2 + 14;
int y_ = 18;
for (int i = 0; i < 8; ++i) {
if ((quotes || i != 6) && (endgame || i != 7)) {
@@ -151,20 +151,20 @@ void MenuGump::InitGump(Gump *newparent, bool take_focus) {
Gump *widget = new TextWidget(0, 0, name, true, 6);
widget->InitGump(this, false);
widget->GetDims(rect);
- widget->Move(90 - rect.w / 2, _dims.h - 40);
+ widget->Move(90 - rect.width() / 2, _dims.height() - 40);
}
} else {
Gump *widget;
widget = new TextWidget(0, 0, _TL_("Give thy name:"), true, 6); // CONSTANT!
widget->InitGump(this, false);
- widget->Move(_dims.w / 2 + 6, 10);
+ widget->Move(_dims.width() / 2 + 6, 10);
Rect textdims;
widget->GetDims(textdims);
widget = new EditWidget(0, 0, "", true, 6, 110, 40, 15); // CONSTANTS!
widget->InitGump(this, true);
- widget->Move(_dims.w / 2 + 6, 10 + textdims.h);
+ widget->Move(_dims.width() / 2 + 6, 10 + textdims.height());
widget->MakeFocus();
}
}
diff --git a/engines/ultima/ultima8/gumps/message_box_gump.cpp b/engines/ultima/ultima8/gumps/message_box_gump.cpp
index a3c5db2694..1518d8fe7e 100644
--- a/engines/ultima/ultima8/gumps/message_box_gump.cpp
+++ b/engines/ultima/ultima8/gumps/message_box_gump.cpp
@@ -89,11 +89,11 @@ void MessageBoxGump::InitGump(Gump *newparent, bool take_focus) {
// Message size
font->getTextSize(_message, width, height, rem);
- _dims.w = MBG_PADDING + width + MBG_PADDING;
- if (_dims.w < MBG_PADDING + title_w + MBG_PADDING) _dims.w = MBG_PADDING + title_w + MBG_PADDING;
- if (_dims.w < buttons_w) _dims.w = buttons_w;
+ _dims.setWidth(MBG_PADDING + width + MBG_PADDING);
+ if (_dims.width() < MBG_PADDING + title_w + MBG_PADDING) _dims.setWidth(MBG_PADDING + title_w + MBG_PADDING);
+ if (_dims.width() < buttons_w) _dims.setWidth(buttons_w);
- _dims.h = 23 + MBG_PADDING + height + MBG_PADDING + 28;
+ _dims.setHeight(23 + MBG_PADDING + height + MBG_PADDING + 28);
// Title
Gump *w = new TextWidget(MBG_PADDING, 2, _title, false, 0);
@@ -104,9 +104,9 @@ void MessageBoxGump::InitGump(Gump *newparent, bool take_focus) {
w->InitGump(this, false);
// Buttons (right aligned)
- int off = _dims.w - buttons_w;
+ int off = _dims.width() - buttons_w;
for (size_t i = 0; i < _buttons.size(); i++) {
- w = new ButtonWidget(off, _dims.h - 23, _buttons[i], false, 1, 0x80D000D0);
+ w = new ButtonWidget(off, _dims.height() - 23, _buttons[i], false, 1, 0x80D000D0);
w->SetIndex(static_cast<int32>(i));
w->InitGump(this, false);
width = height = 0;
@@ -128,26 +128,26 @@ void MessageBoxGump::Close(bool no_del) {
void MessageBoxGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*scaled*/) {
// Background is partially transparent
- surf->FillBlended(0x80000000, 0, 0, _dims.w, _dims.h);
+ surf->FillBlended(0x80000000, 0, 0, _dims.width(), _dims.height());
uint32 line_colour = 0xFFFFFFFF;
if (!IsFocus()) line_colour = 0xFF7F7F7F;
// outer border
- surf->Fill32(line_colour, 0, 0, _dims.w, 1);
- surf->Fill32(line_colour, 0, 0, 1, _dims.h);
- surf->Fill32(line_colour, 0, _dims.h - 1, _dims.w, 1);
- surf->Fill32(line_colour, _dims.w - 1, 0, 1, _dims.h);
+ surf->Fill32(line_colour, 0, 0, _dims.width(), 1);
+ surf->Fill32(line_colour, 0, 0, 1, _dims.height());
+ surf->Fill32(line_colour, 0, _dims.height() - 1, _dims.width(), 1);
+ surf->Fill32(line_colour, _dims.width() - 1, 0, 1, _dims.height());
// line above _buttons
- surf->Fill32(line_colour, 0, _dims.h - 28, _dims.w, 1);
+ surf->Fill32(line_colour, 0, _dims.height() - 28, _dims.width(), 1);
// line below _title
- surf->Fill32(line_colour, 0, 23, _dims.w, 1);
+ surf->Fill32(line_colour, 0, 23, _dims.width(), 1);
// Highlight behind _message..
- if (IsFocus()) surf->Fill32(_titleColour, 1, 1, _dims.w - 2, 22);
- else surf->Fill32(0xFF000000, 1, 1, _dims.w - 2, 22);
+ if (IsFocus()) surf->Fill32(_titleColour, 1, 1, _dims.width() - 2, 22);
+ else surf->Fill32(0xFF000000, 1, 1, _dims.width() - 2, 22);
}
void MessageBoxGump::ChildNotify(Gump *child, uint32 msg) {
diff --git a/engines/ultima/ultima8/gumps/paperdoll_gump.cpp b/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
index 311f0bf36e..163541d0df 100644
--- a/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
+++ b/engines/ultima/ultima8/gumps/paperdoll_gump.cpp
@@ -351,8 +351,8 @@ bool PaperdollGump::DraggingItem(Item *item, int mx, int my) {
return false;
}
- _draggingX = _backpackRect.x + _backpackRect.w / 2;
- _draggingY = _backpackRect.y + _backpackRect.h / 2;
+ _draggingX = _backpackRect.x + _backpackRect.width() / 2;
+ _draggingY = _backpackRect.y + _backpackRect.height() / 2;
}
return true;
diff --git a/engines/ultima/ultima8/gumps/readable_gump.cpp b/engines/ultima/ultima8/gumps/readable_gump.cpp
index 4674d7415f..47fbef6b08 100644
--- a/engines/ultima/ultima8/gumps/readable_gump.cpp
+++ b/engines/ultima/ultima8/gumps/readable_gump.cpp
@@ -78,7 +78,7 @@ void ReadableGump::InitGump(Gump *newparent, bool take_focus) {
}
}
- Gump *widget = new TextWidget(0, 0, _text, true, _fontNum, _dims.w - 16, 0, Font::TEXT_CENTER);
+ Gump *widget = new TextWidget(0, 0, _text, true, _fontNum, _dims.width() - 16, 0, Font::TEXT_CENTER);
widget->InitGump(this);
widget->setRelativePosition(CENTER);
}
diff --git a/engines/ultima/ultima8/gumps/remorse_menu_gump.cpp b/engines/ultima/ultima8/gumps/remorse_menu_gump.cpp
index 1792c12aca..f665d06abb 100644
--- a/engines/ultima/ultima8/gumps/remorse_menu_gump.cpp
+++ b/engines/ultima/ultima8/gumps/remorse_menu_gump.cpp
@@ -126,10 +126,10 @@ void RemorseMenuGump::InitGump(Gump *newparent, bool take_focus) {
return;
}
- _dims.w = tlFrame->_width + trFrame->_width;
- _dims.h = tlFrame->_height + brFrame->_height;
_dims.x = 0;
_dims.y = 0;
+ _dims.setWidth(tlFrame->_width + trFrame->_width);
+ _dims.setHeight(tlFrame->_height + brFrame->_height);
Gump *tlGump = new Gump(0, 0, tlFrame->_width, tlFrame->_height);
tlGump->SetShape(topLeft, 0);
diff --git a/engines/ultima/ultima8/gumps/scaler_gump.cpp b/engines/ultima/ultima8/gumps/scaler_gump.cpp
index b4f45e7209..40862dccbd 100644
--- a/engines/ultima/ultima8/gumps/scaler_gump.cpp
+++ b/engines/ultima/ultima8/gumps/scaler_gump.cpp
@@ -44,7 +44,7 @@ ScalerGump::ScalerGump(int32 x, int32 y, int32 width, int32 height) :
setupScaling();
if (_buffer1)
- _buffer1->Fill32(0, 0, 0, _dims.w, _dims.h);
+ _buffer1->Fill32(0, 0, 0, _dims.width(), _dims.height());
}
ScalerGump::~ScalerGump() {
@@ -136,13 +136,13 @@ void ScalerGump::DoScalerBlit(Texture *src, int swidth, int sheight, RenderSurfa
// Convert a parent relative point to a gump point
void ScalerGump::ParentToGump(int32 &px, int32 &py, PointRoundDir r) {
px -= _x;
- px *= _dims.w;
+ px *= _dims.width();
if (px < 0 && r == ROUND_TOPLEFT) px -= (_width - 1);
if (px > 0 && r == ROUND_BOTTOMRIGHT) px += (_width - 1);
px /= _width;
py -= _y;
- py *= _dims.h;
+ py *= _dims.height();
if (py < 0 && r == ROUND_TOPLEFT) py -= (_height - 1);
if (py > 0 && r == ROUND_BOTTOMRIGHT) py += (_height - 1);
py /= _height;
@@ -151,15 +151,15 @@ void ScalerGump::ParentToGump(int32 &px, int32 &py, PointRoundDir r) {
// Convert a gump point to parent relative point
void ScalerGump::GumpToParent(int32 &gx, int32 &gy, PointRoundDir r) {
gx *= _width;
- if (gx < 0 && r == ROUND_TOPLEFT) gx -= (_dims.w - 1);
- if (gx > 0 && r == ROUND_BOTTOMRIGHT) gx += (_dims.w - 1);
- gx /= _dims.w;
+ if (gx < 0 && r == ROUND_TOPLEFT) gx -= (_dims.width() - 1);
+ if (gx > 0 && r == ROUND_BOTTOMRIGHT) gx += (_dims.width() - 1);
+ gx /= _dims.width();
gx += _x;
gy *= _height;
- if (gy < 0 && r == ROUND_TOPLEFT) gy -= (_dims.h - 1);
- if (gy > 0 && r == ROUND_BOTTOMRIGHT) gy += (_dims.h - 1);
- gy /= _dims.h;
+ if (gy < 0 && r == ROUND_TOPLEFT) gy -= (_dims.height() - 1);
+ if (gy > 0 && r == ROUND_BOTTOMRIGHT) gy += (_dims.height() - 1);
+ gy /= _dims.height();
gy += _y;
}
@@ -168,8 +168,8 @@ void ScalerGump::RenderSurfaceChanged() {
Rect new_dims;
_parent->GetDims(new_dims);
- _width = new_dims.w;
- _height = new_dims.h;
+ _width = new_dims.width();
+ _height = new_dims.height();
setupScaling();
@@ -206,8 +206,8 @@ void ScalerGump::setupScaling() {
if (_sheight2 < 0) _sheight2 = -_sheight2;
else if (_sheight2 != 0 && _sheight2 < 100) _sheight2 = _height / _sheight2;
- _dims.w = _swidth1;
- _dims.h = _sheight1;
+ _dims.setWidth(_swidth1);
+ _dims.setHeight(_sheight1);
// We don't care, we are not going to support filters, at least not at the moment
if (_swidth1 == _width && _sheight1 == _height) return;
diff --git a/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp b/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
index 60a9533954..9417549ba9 100644
--- a/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
+++ b/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
@@ -90,10 +90,10 @@ void ShapeViewerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*s
return;
}
- surf->Fill32(_background, 0, 0, _dims.w, _dims.h);
+ surf->Fill32(_background, 0, 0, _dims.width(), _dims.height());
- int32 posx = (_dims.w - _shapeW) / 2 + _shapeX;
- int32 posy = (_dims.h - _shapeH) / 2 + _shapeY - 25;
+ int32 posx = (_dims.width() - _shapeW) / 2 + _shapeX;
+ int32 posy = (_dims.height() - _shapeH) / 2 + _shapeY - 25;
Shape *shape_ = _flex->getShape(_curShape);
if (shape_ && _curFrame < shape_->frameCount())
@@ -174,7 +174,7 @@ void ShapeViewerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*s
sprintf(buf6, "ShapeInfo: %s\n %s, %s\nUsecode: %s",
buf3, buf4, buf5, GameData::get_instance()->getMainUsecode()->get_class_name(_curShape));
rendtext = font->renderText(buf6, remaining);
- rendtext->draw(surf, 20, _dims.h - 58);
+ rendtext->draw(surf, 20, _dims.height() - 58);
delete rendtext;
}
}
@@ -333,10 +333,10 @@ void ShapeViewerGump::U8ShapeViewer() {
Rect res;
desktopGump->GetDims(res);
- int width = (res.w * 4) / 5;
- int height = (res.h * 5) / 6;
- int xoff = res.w / 10;
- int yoff = res.h / 12;
+ int width = (res.width() * 4) / 5;
+ int height = (res.height() * 5) / 6;
+ int xoff = res.width() / 10;
+ int yoff = res.height() / 12;
ModalGump *gump = new ShapeViewerGump(xoff, yoff, width, height, _flexes);
gump->InitGump(0);
diff --git a/engines/ultima/ultima8/gumps/u8_save_gump.cpp b/engines/ultima/ultima8/gumps/u8_save_gump.cpp
index 8f2709ebe2..0d8d1d4b73 100644
--- a/engines/ultima/ultima8/gumps/u8_save_gump.cpp
+++ b/engines/ultima/ultima8/gumps/u8_save_gump.cpp
@@ -59,8 +59,8 @@ U8SaveGump::~U8SaveGump() {
void U8SaveGump::InitGump(Gump *newparent, bool take_focus) {
Gump::InitGump(newparent, take_focus);
- _dims.w = 220;
- _dims.h = 170;
+ _dims.setWidth(220);
+ _dims.setHeight(170);
FrameID entry_id(GameData::GUMPS, 46, 0);
entry_id = _TL_SHP_(entry_id);
@@ -82,7 +82,7 @@ void U8SaveGump::InitGump(Gump *newparent, bool take_focus) {
int xbase = 3;
int yi = i;
if (i >= 3) {
- xbase += _dims.w / 2 + 9;
+ xbase += _dims.width() / 2 + 9;
yi -= 3;
}
@@ -180,7 +180,7 @@ void U8SaveGump::onMouseClick(int button, int32 mx, int32 my) {
int x_;
if (mx >= 3 && mx <= 100)
x_ = 0;
- else if (mx >= _dims.w / 2 + 10)
+ else if (mx >= _dims.width() / 2 + 10)
x_ = 1;
else
return;
diff --git a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
index 34ec221d66..45e9071632 100644
--- a/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/button_widget.cpp
@@ -183,18 +183,18 @@ void ButtonWidget::saveData(Common::WriteStream *ws) {
// HACK ALERT
int w = 0, h = 0;
if (_textWidget != 0) {
- w = _dims.w;
- h = _dims.h;
- _dims.w = _origW;
- _dims.h = _origH;
+ w = _dims.width();
+ h = _dims.height();
+ _dims.setWidth(_origW);
+ _dims.setHeight(_origH);
}
Gump::saveData(ws);
// HACK ALERT
if (_textWidget != 0) {
- _dims.w = w;
- _dims.h = h;
+ _dims.setWidth(w);
+ _dims.setHeight(h);
}
uint16 flex = 0;
diff --git a/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp b/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
index 16b6e3248d..f8e0a1581f 100644
--- a/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/edit_widget.cpp
@@ -90,8 +90,8 @@ bool EditWidget::textFits(Std::string &t) {
unsigned int remaining;
int32 width, height;
- int32 max_width = _multiLine ? _dims.w : 0;
- int32 max_height = _dims.h;
+ int32 max_width = _multiLine ? _dims.width() : 0;
+ int32 max_height = _dims.height();
if (_gameFont && font->isHighRes()) {
int32 x_ = 0, y_ = 0;
GumpRectToScreenSpace(x_, y_, max_width, max_height, ROUND_INSIDE);
@@ -109,7 +109,7 @@ bool EditWidget::textFits(Std::string &t) {
if (_multiLine)
return (remaining >= t.size());
else
- return (width <= _dims.w);
+ return (width <= _dims.width());
}
void EditWidget::renderText() {
@@ -132,8 +132,8 @@ void EditWidget::renderText() {
if (!_cachedText) {
Font *font = getFont();
- int32 max_width = _multiLine ? _dims.w : 0;
- int32 max_height = _dims.h;
+ int32 max_width = _multiLine ? _dims.width() : 0;
+ int32 max_height = _dims.height();
if (_gameFont && font->isHighRes()) {
int32 x_ = 0, y_ = 0;
GumpRectToScreenSpace(x_, y_, max_width, max_height, ROUND_INSIDE);
@@ -154,7 +154,7 @@ void EditWidget::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
renderText();
if (scaled && _gameFont && getFont()->isHighRes()) {
- surf->FillAlpha(0xFF, _dims.x, _dims.y, _dims.w, _dims.h);
+ surf->FillAlpha(0xFF, _dims.x, _dims.y, _dims.width(), _dims.height());
return;
}
@@ -174,7 +174,7 @@ void EditWidget::PaintComposited(RenderSurface *surf, int32 lerp_factor, int32 s
x_ = _dims.x;
y_ = _dims.y;
- int32 w = _dims.w, h = _dims.h;
+ int32 w = _dims.width(), h = _dims.height();
GumpRectToScreenSpace(x_, y_, w, h, ROUND_OUTSIDE);
surf->FillAlpha(0x00, x_, y_, w, h);
}
diff --git a/engines/ultima/ultima8/gumps/widgets/text_widget.cpp b/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
index ee4649d84f..2ca9b08899 100644
--- a/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
+++ b/engines/ultima/ultima8/gumps/widgets/text_widget.cpp
@@ -76,8 +76,8 @@ void TextWidget::InitGump(Gump *newparent, bool take_focus) {
// _targetWidth/_targetHeight zero if they already were.
GumpRectToScreenSpace(tx_, ty_, _targetWidth, _targetHeight, ROUND_OUTSIDE);
- _dims.w = _targetWidth;
- _dims.h = _targetHeight;
+ _dims.setWidth(_targetWidth);
+ _dims.setHeight(_targetHeight);
x_ = 0;
y_ = 0;
ScreenSpaceToGumpRect(x_, y_, _dims.w, _dims.h, ROUND_OUTSIDE);
@@ -119,10 +119,10 @@ bool TextWidget::setupNextText() {
_targetWidth, _targetHeight, _textAlign, true);
- _dims.w = _tx;
- _dims.h = _ty;
_dims.y = -font->getBaseline();
_dims.x = 0;
+ _dims.setWidth(_tx);
+ _dims.setHeight(_ty);
_currentEnd = _currentStart + remaining;
delete _cachedText;
@@ -169,7 +169,7 @@ void TextWidget::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
renderText();
if (scaled && _gameFont && getFont()->isHighRes()) {
- surf->FillAlpha(0xFF, _dims.x, _dims.y, _dims.w, _dims.h);
+ surf->FillAlpha(0xFF, _dims.x, _dims.y, _dims.width(), _dims.height());
return;
}
@@ -201,7 +201,7 @@ void TextWidget::PaintComposited(RenderSurface *surf, int32 lerp_factor, int32 s
x = _dims.x;
y = _dims.y;
- int32 w = _dims.w, h = _dims.h;
+ int32 w = _dims.width(), h = _dims.height();
GumpRectToScreenSpace(x, y, w, h, ROUND_OUTSIDE);
surf->FillAlpha(0x00, x, y, w, h);
}
@@ -261,8 +261,8 @@ bool TextWidget::loadData(Common::ReadStream *rs, uint32 version) {
// Y offset is always baseline
_dims.y = -font->getBaseline();
- _dims.w = tx_;
- _dims.h = ty_;
+ _dims.setWidth(tx_);
+ _dims.setHeight(ty_);
_currentEnd = _currentStart + remaining;
return true;
diff --git a/engines/ultima/ultima8/kernel/mouse.cpp b/engines/ultima/ultima8/kernel/mouse.cpp
index b9a7a8a569..572e3fa329 100644
--- a/engines/ultima/ultima8/kernel/mouse.cpp
+++ b/engines/ultima/ultima8/kernel/mouse.cpp
@@ -145,8 +145,8 @@ int Mouse::getMouseLength(int mx, int my) {
screen->GetSurfaceDims(dims);
// For now, reference point is (near) the center of the screen
- int dx = abs(mx - dims.w / 2);
- int dy = abs((dims.h / 2 + (dims.h * 14 / 200)) - my); //! constant
+ int dx = abs(mx - dims.width() / 2);
+ int dy = abs((dims.height() / 2 + (dims.height() * 14 / 200)) - my); //! constant
//
// The original game switches cursors from small -> medium -> large on
@@ -156,10 +156,10 @@ int Mouse::getMouseLength(int mx, int my) {
// Modern players may be in a window so give them a little bit more
// space to make the large cursor without having to hit the edge.
//
- int xshort = (dims.w * 30 / 320);
- int xmed = (dims.w * 100 / 320);
- int yshort = (dims.h * 30 / 320);
- int ymed = (dims.h * 100 / 320);
+ int xshort = (dims.width() * 30 / 320);
+ int xmed = (dims.width() * 100 / 320);
+ int yshort = (dims.height() * 30 / 320);
+ int ymed = (dims.height() * 100 / 320);
// determine length of arrow
if (dx > xmed || dy > ymed) {
@@ -177,8 +177,8 @@ Direction Mouse::getMouseDirectionWorld(int mx, int my) {
screen->GetSurfaceDims(dims);
// For now, reference point is (near) the center of the screen
- int dx = mx - dims.w / 2;
- int dy = (dims.h / 2 + (dims.h * 14 / 200)) - my; //! constant
+ int dx = mx - dims.width() / 2;
+ int dy = (dims.height() / 2 + (dims.height() * 14 / 200)) - my; //! constant
return Direction_Get(dy * 2, dx, dirmode_8dirs);
}
@@ -279,13 +279,13 @@ void Mouse::setMouseCoords(int mx, int my) {
if (mx < dims.x)
mx = dims.x;
- else if (mx > dims.w)
- mx = dims.w;
+ else if (mx > dims.width())
+ mx = dims.width();
if (my < dims.y)
my = dims.y;
- else if (my > dims.h)
- my = dims.h;
+ else if (my > dims.height())
+ my = dims.height();
_mousePos.x = mx;
_mousePos.y = my;
diff --git a/engines/ultima/ultima8/misc/rect.h b/engines/ultima/ultima8/misc/rect.h
index 2247bd17c7..96d9009f1b 100644
--- a/engines/ultima/ultima8/misc/rect.h
+++ b/engines/ultima/ultima8/misc/rect.h
@@ -33,6 +33,20 @@ struct Rect {
Rect() : x(0), y(0), w(0), h(0) {}
Rect(int nx, int ny, int nw, int nh) : x(nx), y(ny), w(nw), h(nh) {}
+ bool operator==(const Rect &rhs) const { return equals(rhs); }
+ bool operator!=(const Rect &rhs) const { return !equals(rhs); }
+
+ int32 width() const { return w; }
+ int32 height() const { return h; }
+
+ void setWidth(int32 aWidth) {
+ w = aWidth;
+ }
+
+ void setHeight(int32 aHeight) {
+ h = aHeight;
+ }
+
void Set(int nx, int ny, int nw, int nh) {
x = nx;
y = ny;
@@ -164,7 +178,7 @@ struct Rect {
return (result += o);
}
- bool operator == (const Rect &o) const {
+ bool equals(const Rect &o) const {
return x == o.x && y == o.y && w == o.w && h == o.h;
}
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index 56881ce979..faefa8652c 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -431,20 +431,20 @@ void Ultima8Engine::shutdownGame(bool reloading) {
_screen->GetSurfaceDims(dims);
debugN(MM_INFO, "Creating Desktop...\n");
- _desktopGump = new DesktopGump(0, 0, dims.w, dims.h);
+ _desktopGump = new DesktopGump(0, 0, dims.width(), dims.height());
_desktopGump->InitGump(0);
_desktopGump->MakeFocus();
if (GAME_IS_U8) {
debugN(MM_INFO, "Creating _scalerGump...\n");
- _scalerGump = new ScalerGump(0, 0, dims.w, dims.h);
+ _scalerGump = new ScalerGump(0, 0, dims.width(), dims.height());
_scalerGump->InitGump(0);
Rect scaled_dims;
_scalerGump->GetDims(scaled_dims);
debugN(MM_INFO, "Creating Inverter...\n");
- _inverterGump = new InverterGump(0, 0, scaled_dims.w, scaled_dims.h);
+ _inverterGump = new InverterGump(0, 0, scaled_dims.width(), scaled_dims.height());
_inverterGump->InitGump(0);
}
}
@@ -621,7 +621,7 @@ void Ultima8Engine::GraphicSysInit() {
if (_screen) {
Rect old_dims;
_screen->GetSurfaceDims(old_dims);
- if (width == old_dims.w && height == old_dims.h)
+ if (width == old_dims.width() && height == old_dims.height())
return;
bpp = RenderSurface::_format.bpp();
@@ -681,7 +681,7 @@ void Ultima8Engine::GraphicSysInit() {
Rect scaled_dims;
_scalerGump->GetDims(scaled_dims);
- _inverterGump = new InverterGump(0, 0, scaled_dims.w, scaled_dims.h);
+ _inverterGump = new InverterGump(0, 0, scaled_dims.width(), scaled_dims.height());
_inverterGump->InitGump(0);
}
@@ -1064,27 +1064,27 @@ void Ultima8Engine::setupCoreGumps() {
_screen->GetSurfaceDims(dims);
debugN(MM_INFO, "Creating Desktop...\n");
- _desktopGump = new DesktopGump(0, 0, dims.w, dims.h);
+ _desktopGump = new DesktopGump(0, 0, dims.width(), dims.height());
_desktopGump->InitGump(0);
_desktopGump->MakeFocus();
if (GAME_IS_U8) {
debugN(MM_INFO, "Creating ScalerGump...\n");
- _scalerGump = new ScalerGump(0, 0, dims.w, dims.h);
+ _scalerGump = new ScalerGump(0, 0, dims.width(), dims.height());
_scalerGump->InitGump(0);
Rect scaled_dims;
_scalerGump->GetDims(scaled_dims);
debugN(MM_INFO, "Creating Inverter...\n");
- _inverterGump = new InverterGump(0, 0, scaled_dims.w, scaled_dims.h);
+ _inverterGump = new InverterGump(0, 0, scaled_dims.width(), scaled_dims.height());
_inverterGump->InitGump(0);
debugN(MM_INFO, "Creating GameMapGump...\n");
- _gameMapGump = new GameMapGump(0, 0, scaled_dims.w, scaled_dims.h);
+ _gameMapGump = new GameMapGump(0, 0, scaled_dims.width(), scaled_dims.height());
_gameMapGump->InitGump(0);
} else {
- _gameMapGump = new GameMapGump(0, 0, dims.w, dims.h);
+ _gameMapGump = new GameMapGump(0, 0, dims.width(), dims.height());
_gameMapGump->InitGump(0);
}
diff --git a/engines/ultima/ultima8/world/current_map.cpp b/engines/ultima/ultima8/world/current_map.cpp
index 8af84898f7..22aa88ff88 100644
--- a/engines/ultima/ultima8/world/current_map.cpp
+++ b/engines/ultima/ultima8/world/current_map.cpp
@@ -412,8 +412,8 @@ static inline void CalcFastAreaLimits(int32 &sx_limit,
// By default the fastArea is the screensize plus a border of no more
// than 256 pixels wide and 384 pixels high
// dims.w and dims.h need to be divided by 2 for crusader
- sx_limit = dims.w / 256 + 3;
- sy_limit = dims.h / 128 + 7;
+ sx_limit = dims.width() / 256 + 3;
+ sy_limit = dims.height() / 128 + 7;
xy_limit = (sy_limit + sx_limit) / 2;
}
@@ -431,10 +431,10 @@ void CurrentMap::updateFastArea(int32 from_x, int32 from_y, int32 from_z, int32
Rect dims;
Ultima8Engine::get_instance()->getGameMapGump()->GetDims(dims);
- int32 sleft = ((x_min - y_min) / 4) - (dims.w / 2 + _mapChunkSize / 4);
- int32 stop = ((x_min + y_min) / 8 - z_max) - (dims.h / 2 + _mapChunkSize / 8);
- int32 sright = ((x_max - y_max) / 4) + (dims.w / 2 + _mapChunkSize / 4);
- int32 sbot = ((x_max + y_max) / 8 - z_min) + (dims.h / 2 + _mapChunkSize / 8);
+ int32 sleft = ((x_min - y_min) / 4) - (dims.width() / 2 + _mapChunkSize / 4);
+ int32 stop = ((x_min + y_min) / 8 - z_max) - (dims.height() / 2 + _mapChunkSize / 8);
+ int32 sright = ((x_max - y_max) / 4) + (dims.width() / 2 + _mapChunkSize / 4);
+ int32 sbot = ((x_max + y_max) / 8 - z_min) + (dims.height() / 2 + _mapChunkSize / 8);
// Don't do anything IF the regions are the same
if (_fastXMin == sleft && _fastYMin == stop &&
diff --git a/engines/ultima/ultima8/world/snap_process.cpp b/engines/ultima/ultima8/world/snap_process.cpp
index e368d11e7b..af83464138 100644
--- a/engines/ultima/ultima8/world/snap_process.cpp
+++ b/engines/ultima/ultima8/world/snap_process.cpp
@@ -138,8 +138,8 @@ void SnapProcess::getSnapEggRange(const Item *item, Rect &rect) const {
rect.x = x - xrange + xoff;
rect.y = y - yrange + yoff;
- rect.w = xrange * 2;
- rect.h = yrange * 2;
+ rect.setWidth(xrange * 2);
+ rect.setHeight(yrange * 2);
}
void SnapProcess::saveData(Common::WriteStream *ws) {
Commit: f42092f85819b53955acd287f40437197f7e76aa
https://github.com/scummvm/scummvm/commit/f42092f85819b53955acd287f40437197f7e76aa
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2020-08-09T12:08:10-05:00
Commit Message:
Merge remote-tracking branch 'upstream/master'
Changed paths:
R backends/platform/ds/logoa.bmp
R backends/platform/ds/logob.bmp
R backends/platform/ds/logoc.bmp
R backends/platform/ds/logod.bmp
R backends/platform/ds/logoe.bmp
R backends/platform/ds/logof.bmp
R backends/platform/ds/logog.bmp
R backends/platform/ds/logoh.bmp
R backends/platform/ds/logoi.bmp
R backends/platform/ds/logoj.bmp
R backends/platform/ds/logok.bmp
audio/soundfont/vgmcoll.cpp
backends/platform/ds/arm9/makefile
backends/platform/ds/ds.mk
backends/platform/ds/logo.bmp
backends/platform/ds/setup-builddirs.sh
More information about the Scummvm-git-logs
mailing list