[Scummvm-git-logs] scummvm master -> 5a5e1eafad1a089d3ec2c5b31ee1085b3526a024
OMGPizzaGuy
noreply at scummvm.org
Fri Nov 18 05:15:36 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5a5e1eafad ULTIMA8: Adjust minimap paint calculations to only blit when player is in normal map bounds
Commit: 5a5e1eafad1a089d3ec2c5b31ee1085b3526a024
https://github.com/scummvm/scummvm/commit/5a5e1eafad1a089d3ec2c5b31ee1085b3526a024
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2022-11-17T23:14:48-06:00
Commit Message:
ULTIMA8: Adjust minimap paint calculations to only blit when player is in normal map bounds
Changed paths:
engines/ultima/ultima8/gumps/minimap_gump.cpp
diff --git a/engines/ultima/ultima8/gumps/minimap_gump.cpp b/engines/ultima/ultima8/gumps/minimap_gump.cpp
index cb8fee61fa6..c1323c7cbc8 100644
--- a/engines/ultima/ultima8/gumps/minimap_gump.cpp
+++ b/engines/ultima/ultima8/gumps/minimap_gump.cpp
@@ -105,8 +105,6 @@ void MiniMapGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
surf->Fill32(0xFF000000, dims.left, dims.top, dims.width(), dims.height());
// Center on avatar
- int sx = 0, sy = 0, ox = 0, oy = 0, lx = 0, ly = 0;
-
MainActor *av = getMainActor();
int32 ax, ay, az;
av->getLocation(ax, ay, az);
@@ -114,25 +112,35 @@ void MiniMapGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
ax = ax / (mapChunkSize / MINMAPGUMP_SCALE);
ay = ay / (mapChunkSize / MINMAPGUMP_SCALE);
- sx = ax - (mapChunkSize / (4 * 2));
- sy = ay - (mapChunkSize / (4 * 2));
- ax = ax - sx;
- ay = ay - sy;
+ int sx = ax - dims.width() / 2;
+ int sy = ay - dims.height() / 2;
+ int dx = 1;
+ int dy = 1;
+
+ Common::Rect r(sx, sy, sx + dims.width(), sy + dims.height());
+
+ if (r.left < 0) {
+ dx -= r.left;
+ r.left = 0;
+ }
+ if (r.right > _minimap.w) {
+ r.right = _minimap.w;
+ }
- if (sx < 0) {
- ox = -sx;
- } else if ((sx + dims.width()) > _minimap.w) {
- lx = (sx + dims.width()) - _minimap.w;
+ if (r.top < 0) {
+ dy -= r.top;
+ r.top = 0;
+ }
+ if (r.bottom > _minimap.h) {
+ r.bottom = _minimap.h;
}
- if (sy < 0) {
- oy = -sy;
- } else if ((sy + dims.height()) > _minimap.h) {
- ly = (sy + dims.height()) - _minimap.h;
+ if (r.isValidRect()) {
+ surf->Blit(_minimap, r, dx, dy);
}
- Common::Rect srcRect(sx + ox, sy + oy, sx - lx + dims.width(), sy - ly + dims.height());
- surf->Blit(_minimap, srcRect, 1 + ox, 1 + oy);
+ ax = ax - sx;
+ ay = ay - sy;
// Paint the avatar position marker
surf->Fill32(0xFFFFFF00, 1 + ax - 2, 1 + ay + 0, 2, 1);
More information about the Scummvm-git-logs
mailing list