[Scummvm-git-logs] scummvm master -> 7a7282415aef599bda6e2e75deae73d4057e3f4c
OMGPizzaGuy
noreply at scummvm.org
Sat Nov 19 03:23:25 UTC 2022
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:
4f8f94be24 ULTIMA8: Avoid updating minimap location is player is dead.
7a7282415a ULTIMA8: Avoid updating minimap when location has not changed
Commit: 4f8f94be24617cbeab14eb58b3900c7c0c2b6b9c
https://github.com/scummvm/scummvm/commit/4f8f94be24617cbeab14eb58b3900c7c0c2b6b9c
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2022-11-18T17:52:11-06:00
Commit Message:
ULTIMA8: Avoid updating minimap location is player is dead.
If the player dies by drowning, their location changes but the camera does not. This would jump the minimap to an invalid location, often blank.
Changed paths:
engines/ultima/ultima8/gumps/minimap_gump.cpp
engines/ultima/ultima8/gumps/minimap_gump.h
diff --git a/engines/ultima/ultima8/gumps/minimap_gump.cpp b/engines/ultima/ultima8/gumps/minimap_gump.cpp
index c1323c7cbc8..ecadabecc46 100644
--- a/engines/ultima/ultima8/gumps/minimap_gump.cpp
+++ b/engines/ultima/ultima8/gumps/minimap_gump.cpp
@@ -38,12 +38,12 @@ static const int MINMAPGUMP_SCALE = 8;
MiniMapGump::MiniMapGump(int x, int y) :
Gump(x, y, MAP_NUM_CHUNKS * 2 + 2, MAP_NUM_CHUNKS * 2 + 2, 0,
- FLAG_DRAGGABLE, LAYER_NORMAL), _minimap(), _lastMapNum(0) {
+ FLAG_DRAGGABLE, LAYER_NORMAL), _minimap(), _lastMapNum(0), _ax(0), _ay(0) {
_minimap.create((MAP_NUM_CHUNKS * MINMAPGUMP_SCALE), (MAP_NUM_CHUNKS * MINMAPGUMP_SCALE),
Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
}
-MiniMapGump::MiniMapGump() : Gump() , _lastMapNum(0){
+MiniMapGump::MiniMapGump() : Gump(), _minimap(), _lastMapNum(0), _ax(0), _ay(0) {
_minimap.create((MAP_NUM_CHUNKS * MINMAPGUMP_SCALE), (MAP_NUM_CHUNKS * MINMAPGUMP_SCALE),
Graphics::PixelFormat(4, 8, 8, 8, 8, 24, 16, 8, 0));
}
@@ -63,6 +63,15 @@ void MiniMapGump::run() {
_minimap.clear();
}
+ MainActor *av = getMainActor();
+ if (av && !av->isDead()) {
+ int32 ax, ay, az;
+ av->getLocation(ax, ay, az);
+
+ _ax = ax / (mapChunkSize / MINMAPGUMP_SCALE);
+ _ay = ay / (mapChunkSize / MINMAPGUMP_SCALE);
+ }
+
// Draw into the map surface
for (int x = 0; x < _minimap.w; x++) {
for (int y = 0; y < _minimap.h; y++) {
@@ -87,10 +96,6 @@ void MiniMapGump::run() {
}
void MiniMapGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled) {
- World *world = World::get_instance();
- CurrentMap *currentmap = world->getCurrentMap();
- int mapChunkSize = currentmap->getChunkSize();
-
// Draw the yellow border
surf->Fill32(0xFFFFAF00, 0, 0, _dims.width(), 1);
surf->Fill32(0xFFFFAF00, 0, 1, 1, _dims.height());
@@ -105,15 +110,8 @@ void MiniMapGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
surf->Fill32(0xFF000000, dims.left, dims.top, dims.width(), dims.height());
// Center on avatar
- MainActor *av = getMainActor();
- int32 ax, ay, az;
- av->getLocation(ax, ay, az);
-
- ax = ax / (mapChunkSize / MINMAPGUMP_SCALE);
- ay = ay / (mapChunkSize / MINMAPGUMP_SCALE);
-
- int sx = ax - dims.width() / 2;
- int sy = ay - dims.height() / 2;
+ int sx = _ax - dims.width() / 2;
+ int sy = _ay - dims.height() / 2;
int dx = 1;
int dy = 1;
@@ -139,8 +137,8 @@ void MiniMapGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool scaled)
surf->Blit(_minimap, r, dx, dy);
}
- ax = ax - sx;
- ay = ay - sy;
+ int32 ax = _ax - sx;
+ int32 ay = _ay - sy;
// Paint the avatar position marker
surf->Fill32(0xFFFFFF00, 1 + ax - 2, 1 + ay + 0, 2, 1);
diff --git a/engines/ultima/ultima8/gumps/minimap_gump.h b/engines/ultima/ultima8/gumps/minimap_gump.h
index 18ffbdb54c1..90b6dc3a02b 100644
--- a/engines/ultima/ultima8/gumps/minimap_gump.h
+++ b/engines/ultima/ultima8/gumps/minimap_gump.h
@@ -34,6 +34,7 @@ class MiniMapGump : public Gump {
private:
Graphics::ManagedSurface _minimap;
unsigned int _lastMapNum;
+ int32 _ax, _ay;
uint32 sampleAtPoint(CurrentMap *map, int x, int y);
uint32 sampleAtPoint(const Item *item, int x, int y);
Commit: 7a7282415aef599bda6e2e75deae73d4057e3f4c
https://github.com/scummvm/scummvm/commit/7a7282415aef599bda6e2e75deae73d4057e3f4c
Author: Matthew Jimenez (matthew.jimenez at outlook.com)
Date: 2022-11-18T21:22:42-06:00
Commit Message:
ULTIMA8: Avoid updating minimap when location has not changed
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 ecadabecc46..1f2beda6de8 100644
--- a/engines/ultima/ultima8/gumps/minimap_gump.cpp
+++ b/engines/ultima/ultima8/gumps/minimap_gump.cpp
@@ -63,14 +63,22 @@ void MiniMapGump::run() {
_minimap.clear();
}
- MainActor *av = getMainActor();
- if (av && !av->isDead()) {
- int32 ax, ay, az;
- av->getLocation(ax, ay, az);
+ MainActor *actor = getMainActor();
+ if (!actor || actor->isDead())
+ return;
- _ax = ax / (mapChunkSize / MINMAPGUMP_SCALE);
- _ay = ay / (mapChunkSize / MINMAPGUMP_SCALE);
- }
+ int32 ax, ay, az;
+ actor->getLocation(ax, ay, az);
+
+ ax = ax / (mapChunkSize / MINMAPGUMP_SCALE);
+ ay = ay / (mapChunkSize / MINMAPGUMP_SCALE);
+
+ // Skip map update if location has not changed
+ if (ax == _ax && ay == _ay)
+ return;
+
+ _ax = ax;
+ _ay = ay;
// Draw into the map surface
for (int x = 0; x < _minimap.w; x++) {
More information about the Scummvm-git-logs
mailing list