[Scummvm-git-logs] scummvm master -> 283f96724ea0f8272695efdd7dd993129de4c30d

mduggan mgithub at guarana.org
Mon Nov 2 07:18:36 UTC 2020


This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
98de738012 ULTIMA8: Be more robust to empty vpaths
5048fcc298 ULTIMA8: Fix crusader weapon overlays
ef725b0965 ULTIMA8: Fix potential oob access
3d16e9e564 ULTIMA8: Set correct animations for large weapons
283f96724e ULTIMA8: Remove incorrect seek when loading overlay data


Commit: 98de73801251668936a584cf3d4dd778a4b66ee8
    https://github.com/scummvm/scummvm/commit/98de73801251668936a584cf3d4dd778a4b66ee8
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-11-02T16:18:02+09:00

Commit Message:
ULTIMA8: Be more robust to empty vpaths

Changed paths:
    engines/ultima/ultima8/filesys/file_system.cpp


diff --git a/engines/ultima/ultima8/filesys/file_system.cpp b/engines/ultima/ultima8/filesys/file_system.cpp
index 1992010c52..304ec5fa90 100644
--- a/engines/ultima/ultima8/filesys/file_system.cpp
+++ b/engines/ultima/ultima8/filesys/file_system.cpp
@@ -195,10 +195,10 @@ bool FileSystem::AddVirtualPath(const string &vpath, const string &realpath, con
 	string vp = vpath, rp = realpath;
 
 	// remove trailing slash
-	if (vp.rfind('/') == vp.size() - 1)
+	if (vp.size() && vp.rfind('/') == vp.size() - 1)
 		vp.erase(vp.rfind('/'));
 
-	if (rp.rfind('/') == rp.size() - 1)
+	if (rp.size() && rp.rfind('/') == rp.size() - 1)
 		rp.erase(rp.rfind('/'));
 
 	if (rp.find("..") != string::npos) {
@@ -242,7 +242,7 @@ bool FileSystem::RemoveVirtualPath(const string &vpath) {
 	string vp = vpath;
 
 	// remove trailing slash
-	if (vp.rfind('/') == vp.size() - 1)
+	if (vp.size() && vp.rfind('/') == vp.size() - 1)
 		vp.erase(vp.rfind('/'));
 
 	Std::map<Common::String, string>::iterator i = _virtualPaths.find(vp);


Commit: 5048fcc298d26f04737c69fce9834a4989e6042e
    https://github.com/scummvm/scummvm/commit/5048fcc298d26f04737c69fce9834a4989e6042e
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-11-02T16:18:02+09:00

Commit Message:
ULTIMA8: Fix crusader weapon overlays

Changed paths:
    devtools/create_ultima/files/ultima8/remorseweapons.ini


diff --git a/devtools/create_ultima/files/ultima8/remorseweapons.ini b/devtools/create_ultima/files/ultima8/remorseweapons.ini
index 36f73f5c9f..5720e6053f 100644
--- a/devtools/create_ultima/files/ultima8/remorseweapons.ini
+++ b/devtools/create_ultima/files/ultima8/remorseweapons.ini
@@ -29,7 +29,7 @@ damage_type=0x05
 display_shape=3
 display_frame=7
 overlay_shape=0x036D
-overlay=0
+overlay=1
 small=1
 
 [EM-4]
@@ -40,7 +40,7 @@ damage_type=0x0F
 display_shape=3
 display_frame=3
 overlay_shape=0x036F
-overlay=0
+overlay=2
 
 [SG-A1]
 shape=0x0332
@@ -50,7 +50,7 @@ damage_type=0x02
 display_shape=3
 display_frame=0
 overlay_shape=0x033B
-overlay=0
+overlay=4
 
 [RP-22]
 shape=0x0333
@@ -60,7 +60,7 @@ damage_type=0x01
 display_shape=3
 display_frame=6
 overlay_shape=0x036F
-overlay=0
+overlay=2
 
 [RP-32]
 shape=0x0334
@@ -70,7 +70,7 @@ damage_type=0x01
 display_shape=3
 display_frame=5
 overlay_shape=0x036F
-overlay=0
+overlay=2
 
 [AR-7]
 shape=0x038E
@@ -80,7 +80,7 @@ damage_type=0x0A
 display_shape=3
 display_frame=0xC
 overlay_shape=0x036E
-overlay=0
+overlay=3
 
 [GL-303]
 shape=0x0388
@@ -90,7 +90,7 @@ damage_type=0x03
 display_shape=3
 display_frame=8
 overlay_shape=0x036E
-overlay=0
+overlay=3
 
 [PA-31]
 shape=0x038A
@@ -100,7 +100,7 @@ damage_type=0x05
 display_shape=3
 display_frame=9
 overlay_shape=0x036F
-overlay=0
+overlay=2
 
 [PL-1]
 shape=0x038D
@@ -110,7 +110,7 @@ damage_type=0x06
 display_shape=3
 display_frame=0xA
 overlay_shape=0x036E
-overlay=0
+overlay=3
 
 [AC-88]
 shape=0x038B
@@ -120,7 +120,7 @@ damage_type=0x0D
 display_shape=3
 display_frame=4
 overlay_shape=0x036E
-overlay=0
+overlay=3
 
 [UV-9]
 shape=0x0386


Commit: ef725b0965f3790ec9f37c550d441d5495e86969
    https://github.com/scummvm/scummvm/commit/ef725b0965f3790ec9f37c550d441d5495e86969
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-11-02T16:18:02+09:00

Commit Message:
ULTIMA8: Fix potential oob access

Changed paths:
    engines/ultima/ultima8/world/actors/attack_process.cpp


diff --git a/engines/ultima/ultima8/world/actors/attack_process.cpp b/engines/ultima/ultima8/world/actors/attack_process.cpp
index 8117a9a3a9..5a46eec6ac 100644
--- a/engines/ultima/ultima8/world/actors/attack_process.cpp
+++ b/engines/ultima/ultima8/world/actors/attack_process.cpp
@@ -810,14 +810,14 @@ bool AttackProcess::checkTimer2PlusDelayElapsed(int now) {
 }
 
 void AttackProcess::setAttackData(uint16 off, uint16 val) {
-	if (off >= MAGIC_DATA_OFF && off < MAGIC_DATA_OFF + ARRAYSIZE(_dataArray))
+	if (off >= MAGIC_DATA_OFF && off < MAGIC_DATA_OFF + ARRAYSIZE(_dataArray) - 1)
 		_dataArray[off] = val;
 
 	warning("Invalid offset to setAttackDataArray %d %d", off, val);
 }
 
 uint16 AttackProcess::getAttackData(uint16 off) const {
-	if (off >= MAGIC_DATA_OFF && off < MAGIC_DATA_OFF + ARRAYSIZE(_dataArray))
+	if (off >= MAGIC_DATA_OFF && off < MAGIC_DATA_OFF + ARRAYSIZE(_dataArray) - 1)
 		return _dataArray[off];
 
 	warning("Invalid offset to getAttackDataArray: %d", off);


Commit: 3d16e9e564137225adb11e733bca45bf7f74a53d
    https://github.com/scummvm/scummvm/commit/3d16e9e564137225adb11e733bca45bf7f74a53d
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-11-02T16:18:02+09:00

Commit Message:
ULTIMA8: Set correct animations for large weapons

Changed paths:
    engines/ultima/ultima8/graphics/anim_dat.cpp
    engines/ultima/ultima8/world/actors/animation.h


diff --git a/engines/ultima/ultima8/graphics/anim_dat.cpp b/engines/ultima/ultima8/graphics/anim_dat.cpp
index c3bd24cc59..10a8c9f8da 100644
--- a/engines/ultima/ultima8/graphics/anim_dat.cpp
+++ b/engines/ultima/ultima8/graphics/anim_dat.cpp
@@ -29,6 +29,7 @@
 #include "ultima/ultima8/world/actors/anim_action.h"
 #include "ultima/ultima8/world/actors/animation.h"
 #include "ultima/ultima8/world/actors/actor.h"
+#include "ultima/ultima8/world/get_object.h"
 #include "ultima/ultima8/kernel/core_app.h"
 #include "ultima/ultima8/games/game_info.h"
 
@@ -63,12 +64,24 @@ uint32 AnimDat::getActionNumberForSequence(Animation::Sequence action, const Act
 	if (GAME_IS_U8) {
 		return static_cast<uint32>(action);
 	} else {
-		bool smallwpn = (actor && actor->activeWeaponIsSmall());
+		bool smallwpn = true;
+		bool altfire = false;
+		bool isavatar = (actor && actor->getShape() == 1);
+		if (isavatar && actor->getActiveWeapon()) {
+			const Item *wpn = getItem(actor->getActiveWeapon());
+			const ShapeInfo *shapeinfo = wpn->getShapeInfo();
+			const WeaponInfo *wpninfo = (shapeinfo ? shapeinfo->_weaponInfo : nullptr);
+			smallwpn = (wpninfo && wpninfo->_small);
+			altfire = (wpninfo && (wpninfo->_overlayShape == 0x36e || wpninfo->_overlayShape == 0x33b));
+		}
+
 		// For crusader the actions have different IDs.  Rather than
 		// rewrite everything, we just translate them here for all the ones
 		// we want to use programmatically.  There are more, but they are
 		// called from usecode so don't need translation.
 		//
+		// We also translate based on weapon.  See the function at 1128:2104
+		//
 		// TODO: Also handle kneeling weapon animations
 		switch (action) {
 		case Animation::stand:
@@ -78,9 +91,11 @@ uint32 AnimDat::getActionNumberForSequence(Animation::Sequence action, const Act
 		case Animation::walk:
 			return 1;
 		case Animation::retreat:
-			return 2; // TODO: 28 is also a retreat move, which is right?
+			return (smallwpn ? 2 : 45);
 		case Animation::run:
-			return 3;
+			return (smallwpn ? 3 : 49);
+		case Animation::combatRun:
+			return (smallwpn ? 48 : 49);
 		case Animation::combatStand:
 			return (smallwpn ? 4 : 37);
 		// Note: 5, 6, 9, 10 == nothing (for avatar)?
@@ -88,22 +103,29 @@ uint32 AnimDat::getActionNumberForSequence(Animation::Sequence action, const Act
 			return (smallwpn ? 11: 16);
 		case Animation::readyWeapon:
 			return (smallwpn ? 7 : 12);
-		case Animation::attack:
-			return (smallwpn ? 8 : 13);
+		case Animation::attack: {
+			if (smallwpn)
+				return 8;
+			return (altfire ? 54 : 13);
+		}
 		// Note: 14, 17, 21, 22, 29 == nothing for avatar
 		case Animation::fallBackwards:
 			return 18;
 		case Animation::die:
 			return 20; // maybe? falls over forwards
 		case Animation::advance:
-			return 36; // TODO: 44 is also advance
+			return (smallwpn ? 36 : 44);
 		case Animation::startKneeling:
 			return 40;
 		case Animation::stopKneeling:
 			return 41;
 		case Animation::kneel:
-			return 46; // 47 is knee with a larger weapon
-		// 48 is nothing for avatar
+			return (smallwpn ? 46 : 47);
+		case Animation::kneelAndFire: {
+			if (smallwpn)
+				return 42;
+			return (altfire ? 50 : 43);
+		}
 		case Animation::lookLeft:
 			return 0;
 		case Animation::lookRight:
diff --git a/engines/ultima/ultima8/world/actors/animation.h b/engines/ultima/ultima8/world/actors/animation.h
index adf7abfe69..628b43d02d 100644
--- a/engines/ultima/ultima8/world/actors/animation.h
+++ b/engines/ultima/ultima8/world/actors/animation.h
@@ -119,9 +119,9 @@ enum Sequence {
 	quickRetreat = 45,
 	kneelingWithSmallWeapon = 46,
 	kneelingWithLargeWeapon = 47,
-	run2 = 48,
-	runWithSmallWeapon = 49,
-	runWithLargeWeapon = 50,
+	combatRun = 48,
+	runWithLargeWeapon = 49,
+	runWithLargeWeapon2 = 50,
 	kneelingRetreat = 51,
 	kneelingAdvance = 52,
 	kneelingSlowRetreat = 53,


Commit: 283f96724ea0f8272695efdd7dd993129de4c30d
    https://github.com/scummvm/scummvm/commit/283f96724ea0f8272695efdd7dd993129de4c30d
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-11-02T16:18:08+09:00

Commit Message:
ULTIMA8: Remove incorrect seek when loading overlay data

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


diff --git a/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp b/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
index 00982d8716..fe933b0b7f 100644
--- a/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
+++ b/engines/ultima/ultima8/graphics/wpn_ovlay_dat.cpp
@@ -42,12 +42,6 @@ WpnOvlayDat::~WpnOvlayDat() {
 		delete _overlay[i];
 }
 
-const AnimWeaponOverlay *WpnOvlayDat::getAnimOverlay(uint32 action) const {
-	if (action >= _overlay.size())
-		return nullptr;
-	return _overlay[action];
-}
-
 const WeaponOverlayFrame *WpnOvlayDat::getOverlayFrame(uint32 action, int type,
         Direction direction,
         int frame) const {
@@ -60,8 +54,6 @@ const WeaponOverlayFrame *WpnOvlayDat::getOverlayFrame(uint32 action, int type,
 
 
 void WpnOvlayDat::load(RawArchive *overlaydat) {
-	WeaponOverlayFrame f;
-
 	MainShapeArchive *msf = GameData::get_instance()->getMainShapes();
 	assert(msf);
 
@@ -75,7 +67,7 @@ void WpnOvlayDat::load(RawArchive *overlaydat) {
 			// get Avatar's animation
 			const AnimAction *anim = msf->getAnim(1, action);
 			if (!anim) {
-				perr << "Skipping wpnovlay action " << action << " because animation doesn't exist." << Std::endl;
+				perr << "Skipping wpnovlay action " << action << " because avatar animation doesn't exist." << Std::endl;
 				continue;
 			}
 
@@ -95,9 +87,7 @@ void WpnOvlayDat::load(RawArchive *overlaydat) {
 				for (unsigned int dir = 0; dir < dircount; dir++) {
 					awo->_overlay[type]._frames[dir].resize(animlength);
 					for (unsigned int frame = 0; frame < animlength; frame++) {
-						unsigned int offset = type * 8 * animlength
-						                      + dir * animlength + frame;
-						rs->seek(4 * offset);
+						WeaponOverlayFrame f;
 						f._xOff = rs->readSByte();
 						f._yOff = rs->readSByte();
 						f._frame = rs->readUint16LE();
diff --git a/engines/ultima/ultima8/graphics/wpn_ovlay_dat.h b/engines/ultima/ultima8/graphics/wpn_ovlay_dat.h
index 4fe16d4c79..02c0d801fd 100644
--- a/engines/ultima/ultima8/graphics/wpn_ovlay_dat.h
+++ b/engines/ultima/ultima8/graphics/wpn_ovlay_dat.h
@@ -41,7 +41,6 @@ public:
 	//! NB: anim.dat must have already been read
 	void load(RawArchive *overlaydat);
 
-	const AnimWeaponOverlay *getAnimOverlay(uint32 action) const;
 	const WeaponOverlayFrame *getOverlayFrame(uint32 action, int type,
 	        Direction direction, int frame) const;
 




More information about the Scummvm-git-logs mailing list