[Scummvm-git-logs] scummvm master -> 15d1e49801f992e89af062ab0c3d10b7538d4c20

mduggan mgithub at guarana.org
Tue May 12 08:15:25 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:
1bcc529895 ULTIMA8: Output pixel data in shape viewer
de432dd5d8 ULTIMA8: Tiny cleanups
15d1e49801 ULTIMA8: Add xform blend data for Crusader


Commit: 1bcc5298957ea0cdd48914b7c4daa91522b10888
    https://github.com/scummvm/scummvm/commit/1bcc5298957ea0cdd48914b7c4daa91522b10888
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-05-12T17:15:13+09:00

Commit Message:
ULTIMA8: Output pixel data in shape viewer

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


diff --git a/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp b/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
index 24ca38adde..ddc9858e9d 100644
--- a/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
+++ b/engines/ultima/ultima8/gumps/shape_viewer_gump.cpp
@@ -27,6 +27,7 @@
 #include "ultima/ultima8/graphics/render_surface.h"
 #include "ultima/ultima8/ultima8.h"
 #include "ultima/ultima8/graphics/shape.h"
+#include "ultima/ultima8/graphics/shape_frame.h"
 #include "ultima/ultima8/graphics/shape_info.h"
 
 #include "ultima/ultima8/graphics/fonts/rendered_text.h"
@@ -97,7 +98,7 @@ void ShapeViewerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*s
 	Shape *shape_ = _flex->getShape(_curShape);
 	if (shape_ && _curFrame < shape_->frameCount())
 		surf->Paint(shape_, _curFrame, posx, posy);
-
+	
 	RenderedText *rendtext;
 	Font *font = FontManager::get_instance()->getGameFont(_fontNo, true);
 	if (!font)
@@ -105,40 +106,78 @@ void ShapeViewerGump::PaintThis(RenderSurface *surf, int32 lerp_factor, bool /*s
 
 	unsigned int remaining;
 
-	char buf1[50];
-	char buf2[200];
-	if (!shape_) {
-		sprintf(buf1, "NULL");
-	} else {
-		sprintf(buf1, "Frame %d of %d", _curFrame+1, shape_->frameCount());
-	}
-	sprintf(buf2, "%s:  Shape %d, %s", _flexes[_curFlex].first.c_str(),
-	        _curShape, buf1);
-	rendtext = font->renderText(buf2, remaining);
-	rendtext->draw(surf, 20, 10);
-	delete rendtext;
-
-	MainShapeArchive *mainshapes = p_dynamic_cast<MainShapeArchive *>(_flex);
-	if (!mainshapes || !shape_) return;
-
-	char buf3[128];
-	char buf4[128];
-	char buf5[128];
-	char buf6[512];
-	ShapeInfo *info = mainshapes->getShapeInfo(_curShape);
-	if (info) {
-		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, unk. flags: 0x%02X\n weight: %d",
-		        info->_equipType, info->_unknown, info->_weight);
-		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, 20, _dims.h - 58);
+	{
+		// Basic shape/frame information
+		char buf1[50];
+		char buf2[200];
+		if (!shape_) {
+			sprintf(buf1, "NULL");
+		} else {
+			sprintf(buf1, "Frame %d of %d", _curFrame+1, shape_->frameCount());
+		}
+		sprintf(buf2, "%s:  Shape %d, %s", _flexes[_curFlex].first.c_str(),
+				_curShape, buf1);
+		rendtext = font->renderText(buf2, remaining);
+		rendtext->draw(surf, 20, 10);
 		delete rendtext;
 	}
+	
+	{
+		// Dump the pixel val under the mouse cursor:
+		int mx = 0;
+		int my = 0;
+		char buf2[200];
+
+		Mouse::get_instance()->getMouseCoords(mx, my);
+		ScreenSpaceToGump(mx, my);
+		
+		int relx = mx - (posx - _shapeX);
+		int rely = my - (posy - _shapeY);
+		if (shape_ && relx >= 0 && rely >= 0 && relx < _shapeW && rely < _shapeH) {
+			// get color
+			relx -= _shapeX;
+			rely -= _shapeY;
+			const ShapeFrame *frame = shape_->getFrame(_curFrame);
+			if (frame && frame->hasPoint(relx, rely)) {
+				uint8 rawpx = frame->getPixelAtPoint(relx, rely);
+				uint8 px_r = shape_->getPalette()->_palette[rawpx * 3];
+				uint8 px_g = shape_->getPalette()->_palette[rawpx * 3 + 1];
+				uint8 px_b = shape_->getPalette()->_palette[rawpx * 3 + 2];
+				
+				sprintf(buf2, "px: (%d, %d): %d (%d, %d, %d)", relx, rely, rawpx, px_r, px_g, px_b);
+				rendtext = font->renderText(buf2, remaining);
+				rendtext->draw(surf, 20, 25);
+				delete rendtext;
+			}
+		}
+
+		
+	}
+ 
+	{
+		// Additional shapeinfo (only in main shapes archive)
+		MainShapeArchive *mainshapes = p_dynamic_cast<MainShapeArchive *>(_flex);
+		if (!mainshapes || !shape_) return;
+
+		char buf3[128];
+		char buf4[128];
+		char buf5[128];
+		char buf6[512];
+		ShapeInfo *info = mainshapes->getShapeInfo(_curShape);
+		if (info) {
+			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, unk. flags: 0x%02X\n weight: %d",
+					info->_equipType, info->_unknown, info->_weight);
+			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, 20, _dims.h - 58);
+			delete rendtext;
+		}
+	}
 }
 
 bool ShapeViewerGump::OnKeyDown(int key, int mod) {


Commit: de432dd5d8b3a544d8ced711655cc18bb098b3ea
    https://github.com/scummvm/scummvm/commit/de432dd5d8b3a544d8ced711655cc18bb098b3ea
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-05-12T17:15:13+09:00

Commit Message:
ULTIMA8: Tiny cleanups

Changed paths:
    engines/ultima/ultima8/gumps/mini_stats_gump.cpp
    engines/ultima/ultima8/world/actors/avatar_mover_process.cpp


diff --git a/engines/ultima/ultima8/gumps/mini_stats_gump.cpp b/engines/ultima/ultima8/gumps/mini_stats_gump.cpp
index 181bad8514..f98cb67af4 100644
--- a/engines/ultima/ultima8/gumps/mini_stats_gump.cpp
+++ b/engines/ultima/ultima8/gumps/mini_stats_gump.cpp
@@ -128,9 +128,7 @@ void MiniStatsGump::saveData(Common::WriteStream *ws) {
 }
 
 bool MiniStatsGump::loadData(Common::ReadStream *rs, uint32 version) {
-	if (!Gump::loadData(rs, version)) return false;
-
-	return true;
+	return Gump::loadData(rs, version);
 }
 
 } // End of namespace Ultima8
diff --git a/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp b/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp
index 18e71e963e..1c41def18a 100644
--- a/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp
+++ b/engines/ultima/ultima8/world/actors/avatar_mover_process.cpp
@@ -618,7 +618,6 @@ void AvatarMoverProcess::step(Animation::Sequence action, int direction,
 }
 
 void AvatarMoverProcess::jump(Animation::Sequence action, int direction) {
-	Mouse *mouse = Mouse::get_instance();
 	MainActor *avatar = getMainActor();
 
 	// running jump
@@ -638,6 +637,7 @@ void AvatarMoverProcess::jump(Animation::Sequence action, int direction) {
 	SettingManager::get_instance()->get("targetedjump", targeting);
 
 	if (targeting) {
+		Mouse *mouse = Mouse::get_instance();
 		int32 coords[3];
 		int32 mx, my;
 		mouse->getMouseCoords(mx, my);


Commit: 15d1e49801f992e89af062ab0c3d10b7538d4c20
    https://github.com/scummvm/scummvm/commit/15d1e49801f992e89af062ab0c3d10b7538d4c20
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-05-12T17:15:13+09:00

Commit Message:
ULTIMA8: Add xform blend data for Crusader

Changed paths:
    engines/ultima/ultima8/graphics/xform_blend.cpp
    engines/ultima/ultima8/graphics/xform_blend.h


diff --git a/engines/ultima/ultima8/graphics/xform_blend.cpp b/engines/ultima/ultima8/graphics/xform_blend.cpp
index 76ee1a0d48..927bc92325 100644
--- a/engines/ultima/ultima8/graphics/xform_blend.cpp
+++ b/engines/ultima/ultima8/graphics/xform_blend.cpp
@@ -46,6 +46,26 @@ const uint8 U8XFormPal[1024] = {
 	0,  0,  0,  0
 };
 
+// TODO: Only eyeballed these, should try and make it more exact to original.
+const uint8 CruXFormPal[1024] = {
+	0,  0,  0,  0,
+	0,  0,  0,  0,
+	0,  0,  0,  0,
+	0,  0,  0,  0,
+	0,  0,  0,  0,
+	0,  0,  0,  0,
+	0,  0,  0,  0,
+	0,  0,  0,  0,
+	48, 48, 48, 80, // (green->dark grey)
+	24, 24, 24, 80, // (black->vdark grey)
+	64, 64, 24, 64, // (yellow)
+	80, 80, 80, 80,
+	48, 48, 48, 140, // (*->grey)
+	24, 24, 24, 140, // (*->dark grey) 13
+	10, 10, 10, 140, // (*->vdark grey) 14
+	0,  0,  0,  0
+};
+
 #if 0
 //
 // XFORM Blend Funcs
diff --git a/engines/ultima/ultima8/graphics/xform_blend.h b/engines/ultima/ultima8/graphics/xform_blend.h
index 8fc7fa0d4f..6f3b45a447 100644
--- a/engines/ultima/ultima8/graphics/xform_blend.h
+++ b/engines/ultima/ultima8/graphics/xform_blend.h
@@ -40,6 +40,7 @@ namespace Ultima8 {
 #endif
 
 extern const uint8 U8XFormPal[1024];
+extern const uint8 CruXFormPal[1024];
 
 inline uint32 P_FASTCALL BlendPreModulated(uint32 src, uint32 dst) {
 	uint32 r, g, b;




More information about the Scummvm-git-logs mailing list