[Scummvm-git-logs] scummvm master -> 5a9aef36b21b8f2ed2452dfc50a9fa7466168035

mduggan mgithub at guarana.org
Thu Apr 23 08:14:03 UTC 2020


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:
5a9aef36b2 ULTIMA8: Make the shape viewer work nicely in lower resolution


Commit: 5a9aef36b21b8f2ed2452dfc50a9fa7466168035
    https://github.com/scummvm/scummvm/commit/5a9aef36b21b8f2ed2452dfc50a9fa7466168035
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-04-23T17:13:51+09:00

Commit Message:
ULTIMA8: Make the shape viewer work nicely in lower resolution

Changed paths:
    engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
    engines/ultima/ultima8/gumps/shape_viewer_gump.h


diff --git a/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp b/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
index e4692c187e..4c9f57ae27 100644
--- a/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
+++ b/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
@@ -44,6 +44,8 @@
 #include "ultima/ultima8/graphics/palette_manager.h"
 #include "ultima/ultima8/usecode/usecode.h"
 
+#include "ultima/ultima8/meta_engine.h"
+
 namespace Ultima {
 namespace Ultima8 {
 
@@ -55,10 +57,10 @@ ShapeViewerGump::ShapeViewerGump()
 
 }
 
-ShapeViewerGump::ShapeViewerGump(int width, int height,
+ShapeViewerGump::ShapeViewerGump(int x, int y, int width, int height,
                                  Std::vector<Std::pair<Std::string, ShapeArchive *> > &flexes,
                                  uint32 flags, int32 layer)
-		: ModalGump(50, 50, width, height, 0, flags, layer),
+		: ModalGump(x, y, width, height, 0, flags, layer),
 		_flexes(flexes), _curFlex(0), _curShape(0), _curFrame(0), _background(0) {
 	if (_flexes.size())
 		_flex = _flexes[0].second;
@@ -67,6 +69,12 @@ ShapeViewerGump::ShapeViewerGump(int width, int height,
 }
 
 ShapeViewerGump::~ShapeViewerGump() {
+	MetaEngine::setGameMenuActive(false);
+}
+
+void ShapeViewerGump::InitGump(Gump *newparent, bool take_focus) {
+	MetaEngine::setGameMenuActive(true);
+	ModalGump::InitGump(newparent, take_focus);
 }
 
 void ShapeViewerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*scaled*/) {
@@ -78,7 +86,7 @@ void ShapeViewerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*s
 	surf->Fill32(_background, 0, 0, _dims.w, _dims.h);
 
 	int32 posx = (_dims.w - _shapeW) / 2 + _shapeX;
-	int32 posy = (_dims.h - _shapeH) / 2 + _shapeY;
+	int32 posy = (_dims.h - _shapeH) / 2 + _shapeY - 25;
 
 	Shape *shape_ = _flex->getShape(_curShape);
 	if (shape_ && _curFrame < shape_->frameCount())
@@ -95,10 +103,10 @@ void ShapeViewerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*s
 	} else {
 		sprintf(buf1, "Frame %d of %d", _curFrame, shape_->frameCount());
 	}
-	sprintf(buf2, "%s\nShape %d, %s", _flexes[_curFlex].first.c_str(),
+	sprintf(buf2, "%s  :  Shape %d, %s", _flexes[_curFlex].first.c_str(),
 	        _curShape, buf1);
 	rendtext = font->renderText(buf2, remaining);
-	rendtext->draw(surf, 20, 20);
+	rendtext->draw(surf, 20, 10);
 	delete rendtext;
 
 	MainShapeArchive *mainshapes = p_dynamic_cast<MainShapeArchive *>(_flex);
@@ -110,16 +118,16 @@ void ShapeViewerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*s
 	char buf6[512];
 	ShapeInfo *info = mainshapes->getShapeInfo(_curShape);
 	if (info) {
-		sprintf(buf3, "x = %d, y = %d, z = %d\n flags = 0x%04X, family = %d",
+		sprintf(buf3, "x: %d, y: %d, z: %d\n flags: 0x%04X, family: %d",
 		        info->_x, info->_y, info->_z, info->_flags, info->_family);
-		sprintf(buf4, "equip type = %d\n unknown flags = 0x%02X\n weight = %d",
+		sprintf(buf4, "equip type: %d, unk. flags: 0x%02X\n weight: %d",
 		        info->_equipType, info->_unknown, info->_weight);
-		sprintf(buf5, "volume = %d\n animtype = %d, animdata = %d",
-		        info->_animType, info->_animData, info->_volume);
-		sprintf(buf6, "ShapeInfo:\n %s\n %s, %s\nUsecode: %s",
+		sprintf(buf5, "vol: %d\n animtype: %d, animdata: %d",
+		        info->_volume, info->_animType, info->_animData);
+		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, 300, 20);
+		rendtext->draw(surf, 20, _dims.h - 58);
 		delete rendtext;
 	}
 }
@@ -267,7 +275,12 @@ void ShapeViewerGump::U8ShapeViewer() {
 	Rect res;
 	desktopGump->GetDims(res);
 
-	ModalGump *gump = new ShapeViewerGump((res.w * 3) / 4, (res.h * 3) / 4, _flexes);
+	int width = (res.w * 4) / 5;
+	int height = (res.h * 5) / 6;
+	int xoff = res.w / 10;
+	int yoff = res.h / 12;
+
+	ModalGump *gump = new ShapeViewerGump(xoff, yoff, width, height, _flexes);
 	gump->InitGump(0);
 }
 
diff --git a/engines/ultima/ultima8/gumps/shape_viewer_gump.h b/engines/ultima/ultima8/gumps/shape_viewer_gump.h
index 92183e3857..877ee0c7b6 100644
--- a/engines/ultima/ultima8/gumps/shape_viewer_gump.h
+++ b/engines/ultima/ultima8/gumps/shape_viewer_gump.h
@@ -39,7 +39,7 @@ public:
 	ENABLE_RUNTIME_CLASSTYPE()
 
 	ShapeViewerGump();
-	ShapeViewerGump(int width, int height,
+	ShapeViewerGump(int x, int y, int width, int height,
 	                Std::vector<Std::pair<Std::string, ShapeArchive *> > &flexes,
 	                uint32 flags = 0, int32 layer = LAYER_MODAL);
 	~ShapeViewerGump() override;
@@ -49,6 +49,9 @@ public:
 	bool OnKeyDown(int key, int mod) override;
 	bool OnTextInput(int unicode) override;
 
+	// Init the gump, call after construction
+	void InitGump(Gump *newparent, bool take_focus = true) override;
+
 	static void U8ShapeViewer();
 
 	bool loadData(Common::ReadStream *rs);




More information about the Scummvm-git-logs mailing list