[Scummvm-git-logs] scummvm master -> de8327361627153ca8f3b94943291a178cfceca5
dreammaster
paulfgilbert at gmail.com
Sun May 17 16:01:23 UTC 2020
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
b5642b82ba ULTIMA4: More properly implement drawSubRectOn
89f1f800a4 ULTIMA4: Fix unrolling map on title screen
de83273616 ULTIMA4: Mark detection entries as ready for testing
Commit: b5642b82ba23509b59df0729f0931b7184c12b7e
https://github.com/scummvm/scummvm/commit/b5642b82ba23509b59df0729f0931b7184c12b7e
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-17T08:55:41-07:00
Commit Message:
ULTIMA4: More properly implement drawSubRectOn
I'd previously gotten confused because in some cases the source rect
could be bigger than the src surface.. I thought it meant scaling
was needed. Turns out it was just poor code in the engine that could
have a negative left/top, and needed clipping
Changed paths:
engines/ultima/ultima4/gfx/image.cpp
engines/ultima/ultima4/views/dungeonview.cpp
diff --git a/engines/ultima/ultima4/gfx/image.cpp b/engines/ultima/ultima4/gfx/image.cpp
index 2cc6924939..5809e15336 100644
--- a/engines/ultima/ultima4/gfx/image.cpp
+++ b/engines/ultima/ultima4/gfx/image.cpp
@@ -433,18 +433,23 @@ void Image::drawOn(Image *d, int x, int y) const {
void Image::drawSubRectOn(Image *d, int x, int y, int rx, int ry, int rw, int rh) const {
Graphics::ManagedSurface *destSurface = getSurface(d);
- if (rw > _surface->w || rh > _surface->h) {
- // Blitting entire surface with stretching
- destSurface->transBlitFrom(*_surface,
- Common::Rect(0, 0, _surface->w, _surface->h),
- Common::Rect(x, y, x + rw, y + rh),
- (uint)-1
- );
+ Common::Rect srcRect(rx, ry, MIN(rx + rw, (int)_surface->w), MIN(ry + rh, (int)_surface->h));
+ Common::Point destPos(x, y);
- } else {
- // Blitting all or part of source surface
- destSurface->blitFrom(*_surface, Common::Rect(rx, ry, rx + rw, ry + rh), Common::Point(x, y));
+ // Handle when the source rect is off the surface
+ if (srcRect.left < 0) {
+ destPos.x += -srcRect.left;
+ srcRect.left = 0;
+ }
+
+ if (srcRect.top < 0) {
+ destPos.y += -srcRect.top;
+ srcRect.top = 0;
}
+
+ if (srcRect.isValidRect())
+ // Blit the surface
+ destSurface->blitFrom(*_surface, srcRect, destPos);
}
void Image::drawSubRectInvertedOn(Image *d, int x, int y, int rx, int ry, int rw, int rh) const {
diff --git a/engines/ultima/ultima4/views/dungeonview.cpp b/engines/ultima/ultima4/views/dungeonview.cpp
index 57fbbf13ca..691996e149 100644
--- a/engines/ultima/ultima4/views/dungeonview.cpp
+++ b/engines/ultima/ultima4/views/dungeonview.cpp
@@ -181,7 +181,8 @@ void DungeonView::drawInDungeon(Tile *tile, int x_offset, int distance, Directio
int y = SCALED((VIEWPORT_H * _tileHeight / 2) + _bounds.top + y_offset) - (scaled->height() / 8);
scaled->drawSubRectOn(this->_screen, x, y, 0, 0,
- scaled->width(), scaled->height());
+ SCALED(_tileWidth * VIEWPORT_W + _bounds.left) - x,
+ SCALED(_tileHeight * VIEWPORT_H + _bounds.top) - y);
}
delete scaled;
Commit: 89f1f800a4dce421eaabcc05a16f568c884dd5ed
https://github.com/scummvm/scummvm/commit/89f1f800a4dce421eaabcc05a16f568c884dd5ed
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-17T08:55:41-07:00
Commit Message:
ULTIMA4: Fix unrolling map on title screen
Changed paths:
engines/ultima/ultima4/controllers/intro_controller.cpp
engines/ultima/ultima4/controllers/intro_controller.h
engines/ultima/ultima4/views/tileview.cpp
engines/ultima/ultima4/views/tileview.h
diff --git a/engines/ultima/ultima4/controllers/intro_controller.cpp b/engines/ultima/ultima4/controllers/intro_controller.cpp
index 8c3ce8dc21..9e9b23b267 100644
--- a/engines/ultima/ultima4/controllers/intro_controller.cpp
+++ b/engines/ultima/ultima4/controllers/intro_controller.cpp
@@ -189,6 +189,10 @@ IntroController::IntroController() : Controller(1),
_useProfile(false) {
Common::fill(&_questionTree[0], &_questionTree[15], -1);
+ // Setup a separate image surface for rendering the animated map on
+ _mapScreen = Image::create(g_screen->w, g_screen->h, false, Image::HARDWARE);
+ _mapArea.setDest(_mapScreen);
+
// initialize menus
_confMenu.setTitle("XU4 Configuration:", 0, 0);
_confMenu.add(MI_CONF_VIDEO, "\010 Video Options", 2, 2,/*'v'*/ 2);
@@ -286,6 +290,10 @@ IntroController::IntroController() : Controller(1),
_interfaceMenu.setClosesMenu(CANCEL);
}
+IntroController::~IntroController() {
+ delete _mapScreen;
+}
+
bool IntroController::init() {
_justInitiatedNewGame = false;
@@ -512,6 +520,14 @@ void IntroController::drawMap() {
drawMapStatic();
drawMapAnimated();
+ _mapScreen->drawSubRect(
+ SCALED(8),
+ SCALED(13 * 8),
+ SCALED(8),
+ SCALED(13 * 8),
+ SCALED(38 * 8),
+ SCALED(10 * 8));
+
/* set sleep cycles */
_sleepCycles = _binData->_scriptTable[_scrPos] & 0xf;
_scrPos++;
@@ -1498,7 +1514,7 @@ void IntroController::getTitleSourceData() {
switch (_titles[i]._method) {
case SIGNATURE: {
// PLOT: "Lord British"
- srcData = g_intro->getSigData();
+ srcData = getSigData();
RGBA color = info->_image->setColor(0, 255, 255); // cyan for EGA
int x = 0, y = 0;
@@ -1810,16 +1826,13 @@ bool IntroController::updateTitle() {
SCALED(_title->_srcImage->height()));
- // create a destimage for the map tiles
+ // Create a destimage for the map tiles
int newtime = g_system->getMillis();
if (newtime > _title->_timeDuration + 250 / 4) {
- // grab the map from the screen
- Image *screen = imageMgr->get("screen")->_image;
-
- // draw the updated map display
- g_intro->drawMapStatic();
+ // Draw the updated map display
+ drawMapStatic();
- screen->drawSubRectOn(
+ _mapScreen->drawSubRectOn(
_title->_srcImage,
SCALED(8),
SCALED(8),
diff --git a/engines/ultima/ultima4/controllers/intro_controller.h b/engines/ultima/ultima4/controllers/intro_controller.h
index 6df677ab7a..242abe5837 100644
--- a/engines/ultima/ultima4/controllers/intro_controller.h
+++ b/engines/ultima/ultima4/controllers/intro_controller.h
@@ -82,6 +82,7 @@ public:
class IntroController : public Controller, public Observer<Menu *, MenuEvent &> {
public:
IntroController();
+ ~IntroController() override;
/**
* Initializes intro state and loads in introduction graphics, text
@@ -321,6 +322,7 @@ private:
TextView _extendedMenuArea;
TextView _questionArea;
TileView _mapArea;
+ Image *_mapScreen;
// menus
Menu _mainMenu;
diff --git a/engines/ultima/ultima4/views/tileview.cpp b/engines/ultima/ultima4/views/tileview.cpp
index 2361d20860..e9782d10a9 100644
--- a/engines/ultima/ultima4/views/tileview.cpp
+++ b/engines/ultima/ultima4/views/tileview.cpp
@@ -35,13 +35,15 @@
namespace Ultima {
namespace Ultima4 {
-TileView::TileView(int x, int y, int columns, int rows) : View(x, y, columns * TILE_WIDTH, rows * TILE_HEIGHT) {
+TileView::TileView(int x, int y, int columns, int rows) :
+ View(x, y, columns * TILE_WIDTH, rows * TILE_HEIGHT) {
_columns = columns;
_rows = rows;
_tileWidth = TILE_WIDTH;
_tileHeight = TILE_HEIGHT;
_tileSet = g_tileSets->get("base");
_animated = Image::create(SCALED(_tileWidth), SCALED(_tileHeight), false, Image::HARDWARE);
+ _dest = nullptr;
}
TileView::TileView(int x, int y, int columns, int rows, const Common::String &tileset) :
@@ -52,6 +54,7 @@ TileView::TileView(int x, int y, int columns, int rows, const Common::String &ti
_tileHeight = TILE_HEIGHT;
_tileSet = g_tileSets->get(tileset);
_animated = Image::create(SCALED(_tileWidth), SCALED(_tileHeight), false, Image::HARDWARE);
+ _dest = nullptr;
}
TileView::~TileView() {
@@ -90,7 +93,7 @@ void TileView::drawTile(MapTile &mapTile, bool focus, int x, int y) {
_animated->fillRect(0, 0, SCALED(_tileWidth), SCALED(_tileHeight), 0, 0, 0, 255);
// Draw blackness on the tile.
- _animated->drawSubRect(SCALED(x * _tileWidth + _bounds.left),
+ _animated->drawSubRectOn(_dest, SCALED(x * _tileWidth + _bounds.left),
SCALED(y * _tileHeight + _bounds.top), 0, 0,
SCALED(_tileWidth), SCALED(_tileHeight));
@@ -103,11 +106,11 @@ void TileView::drawTile(MapTile &mapTile, bool focus, int x, int y) {
tile->getAnim()->draw(_animated, tile, mapTile, DIR_NONE);
// Then draw it to the screen
- _animated->drawSubRect(SCALED(x * _tileWidth + _bounds.left),
+ _animated->drawSubRectOn(_dest, SCALED(x * _tileWidth + _bounds.left),
SCALED(y * _tileHeight + _bounds.top), 0, 0,
SCALED(_tileWidth), SCALED(_tileHeight));
} else {
- image->drawSubRect(SCALED(x * _tileWidth + _bounds.left),
+ image->drawSubRectOn(_dest, SCALED(x * _tileWidth + _bounds.left),
SCALED(y * _tileHeight + _bounds.top),
0, SCALED(_tileHeight * mapTile._frame),
SCALED(_tileWidth), SCALED(_tileHeight));
@@ -124,7 +127,7 @@ void TileView::drawTile(Std::vector<MapTile> &tiles, bool focus, int x, int y) {
// Clear tile contents
_animated->fillRect(0, 0, SCALED(_tileWidth), SCALED(_tileHeight), 0, 0, 0, 255);
- _animated->drawSubRect(
+ _animated->drawSubRectOn(_dest,
SCALED(x * _tileWidth + _bounds.left), SCALED(y * _tileHeight + _bounds.top),
0, 0,
SCALED(_tileWidth), SCALED(_tileHeight)
@@ -158,7 +161,7 @@ void TileView::drawTile(Std::vector<MapTile> &tiles, bool focus, int x, int y) {
}
// Then draw it to the screen
- _animated->drawSubRect(SCALED(x * _tileWidth + _bounds.left),
+ _animated->drawSubRectOn(_dest, SCALED(x * _tileWidth + _bounds.left),
SCALED(y * _tileHeight + _bounds.top), 0, 0,
SCALED(_tileWidth), SCALED(_tileHeight)
);
diff --git a/engines/ultima/ultima4/views/tileview.h b/engines/ultima/ultima4/views/tileview.h
index 2c8cf946ef..2cd46fc187 100644
--- a/engines/ultima/ultima4/views/tileview.h
+++ b/engines/ultima/ultima4/views/tileview.h
@@ -57,11 +57,15 @@ public:
void loadTile(MapTile &mapTile);
void setTileset(Tileset *tileset);
+ void setDest(Image *dest) {
+ _dest = dest;
+ }
protected:
int _columns, _rows;
int _tileWidth, _tileHeight;
Tileset *_tileSet;
Image *_animated; /**< a scratchpad image for drawing animations */
+ Image *_dest; // Dest surface, nullptr by default for screen
};
} // End of namespace Ultima4
Commit: de8327361627153ca8f3b94943291a178cfceca5
https://github.com/scummvm/scummvm/commit/de8327361627153ca8f3b94943291a178cfceca5
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-05-17T08:58:07-07:00
Commit Message:
ULTIMA4: Mark detection entries as ready for testing
Changed paths:
engines/ultima/detection_tables.h
diff --git a/engines/ultima/detection_tables.h b/engines/ultima/detection_tables.h
index d91aa700c3..eda02dc677 100644
--- a/engines/ultima/detection_tables.h
+++ b/engines/ultima/detection_tables.h
@@ -85,7 +85,7 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
AD_ENTRY1s("britain.ult", "304fe52ce5f34b9181052363d74d7505", 1280),
Common::EN_ANY,
Common::kPlatformDOS,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUIO1(GUIO_NOSPEECH)
},
GAME_ULTIMA4,
@@ -100,7 +100,7 @@ static const UltimaGameDescription GAME_DESCRIPTIONS[] = {
AD_ENTRY1s("britain.ult", "304fe52ce5f34b9181052363d74d7505", 1280),
Common::EN_ANY,
Common::kPlatformDOS,
- ADGF_UNSTABLE,
+ ADGF_TESTING,
GUIO1(GUIO_NOSPEECH)
},
GAME_ULTIMA4,
More information about the Scummvm-git-logs
mailing list