[Scummvm-git-logs] scummvm master -> 1bdbb527d603deafe581acd68e833f4aec96b790

mduggan mgithub at guarana.org
Sun Oct 18 06:48:28 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:
2e1880944d ULTIMA8: Fix build when DEBUG is defined
8cf85caca1 ULTIMA8: Call gotHit event with correct parameters for Crusader
374a369fa5 ULTIMA8: Correct name of intrinsic
613e89bdbd ULTIMA8: comment about correct sfx no
1bdbb527d6 ULTIMA8: Correct operand order for shift operators in Crusader games


Commit: 2e1880944dd0f1b8a6418b4d2b662db7d335434e
    https://github.com/scummvm/scummvm/commit/2e1880944dd0f1b8a6418b4d2b662db7d335434e
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-10-18T14:33:06+09:00

Commit Message:
ULTIMA8: Fix build when DEBUG is defined

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


diff --git a/engines/ultima/ultima8/world/actors/pathfinder.cpp b/engines/ultima/ultima8/world/actors/pathfinder.cpp
index dd1f8dd7de..6f8d502597 100644
--- a/engines/ultima/ultima8/world/actors/pathfinder.cpp
+++ b/engines/ultima/ultima8/world/actors/pathfinder.cpp
@@ -269,17 +269,17 @@ static void drawbox(const Item *item) {
 
 	int32 x0, y0, x1, y1, x2, y2, x3, y3;
 
-	x0 = (d.w / 2) + (ix - iy) / 2;
-	y0 = (d.h / 2) + (ix + iy) / 4 - iz * 2;
+	x0 = (d.width() / 2) + (ix - iy) / 2;
+	y0 = (d.height() / 2) + (ix + iy) / 4 - iz * 2;
 
-	x1 = (d.w / 2) + (ix - iy) / 2;
-	y1 = (d.h / 2) + (ix + iy) / 4 - (iz + zd) * 2;
+	x1 = (d.width() / 2) + (ix - iy) / 2;
+	y1 = (d.height() / 2) + (ix + iy) / 4 - (iz + zd) * 2;
 
-	x2 = (d.w / 2) + (ix - xd - iy) / 2;
-	y2 = (d.h / 2) + (ix - xd + iy) / 4 - iz * 2;
+	x2 = (d.width() / 2) + (ix - xd - iy) / 2;
+	y2 = (d.height() / 2) + (ix - xd + iy) / 4 - iz * 2;
 
-	x3 = (d.w / 2) + (ix - iy + yd) / 2;
-	y3 = (d.h / 2) + (ix + iy - yd) / 4 - iz * 2;
+	x3 = (d.width() / 2) + (ix - iy + yd) / 2;
+	y3 = (d.height() / 2) + (ix + iy - yd) / 4 - iz * 2;
 
 	screen->Fill32(0xFF0000FF, x0 - 1, y0 - 1, 3, 3);
 
@@ -300,12 +300,12 @@ static void drawdot(int32 x, int32 y, int32 Z, int size, uint32 rgb) {
 	y -= cy;
 	Z -= cz;
 	int32 x0, y0;
-	x0 = (d.w / 2) + (x - y) / 2;
-	y0 = (d.h / 2) + (x + y) / 4 - Z * 2;
+	x0 = (d.width() / 2) + (x - y) / 2;
+	y0 = (d.height() / 2) + (x + y) / 4 - Z * 2;
 	screen->Fill32(rgb, x0 - size, y0 - size, 2 * size + 1, 2 * size + 1);
 }
 
-static void drawedge(PathNode *from, PathNode *to, uint32 rgb) {
+static void drawedge(const PathNode *from, const PathNode *to, uint32 rgb) {
 	RenderSurface *screen = Ultima8Engine::get_instance()->getRenderScreen();
 	int32 cx, cy, cz;
 
@@ -320,8 +320,8 @@ static void drawedge(PathNode *from, PathNode *to, uint32 rgb) {
 	cy = from->state._y - cy;
 	cz = from->state._z - cz;
 
-	x0 = (d.w / 2) + (cx - cy) / 2;
-	y0 = (d.h / 2) + (cx + cy) / 4 - cz * 2;
+	x0 = (d.width() / 2) + (cx - cy) / 2;
+	y0 = (d.height() / 2) + (cx + cy) / 4 - cz * 2;
 
 	Ultima8Engine::get_instance()->getGameMapGump()->GetCameraLocation(cx, cy, cz);
 
@@ -329,8 +329,8 @@ static void drawedge(PathNode *from, PathNode *to, uint32 rgb) {
 	cy = to->state._y - cy;
 	cz = to->state._z - cz;
 
-	x1 = (d.w / 2) + (cx - cy) / 2;
-	y1 = (d.h / 2) + (cx + cy) / 4 - cz * 2;
+	x1 = (d.width() / 2) + (cx - cy) / 2;
+	y1 = (d.height() / 2) + (cx + cy) / 4 - cz * 2;
 
 	screen->DrawLine32(rgb, x0, y0, x1, y1);
 }


Commit: 8cf85caca112ac3c8e752144a0d46b6141fffd3f
    https://github.com/scummvm/scummvm/commit/8cf85caca112ac3c8e752144a0d46b6141fffd3f
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-10-18T15:45:09+09:00

Commit Message:
ULTIMA8: Call gotHit event with correct parameters for Crusader

Changed paths:
    engines/ultima/ultima8/world/item.cpp


diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index bcd2fb89fe..8bdd4ffdb4 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -1997,7 +1997,7 @@ void Item::receiveHitCru(uint16 other, Direction dir, int damage, uint16 type) {
 	uint8 shouldCallUsecode = 1;
 
 	if (shouldCallUsecode)
-		callUsecodeEvent_gotHit(other, 0);
+		callUsecodeEvent_gotHit(0x4000, (type << 8) | (damage & 0xff));
 
 	if (damageInfo) {
 		bool wasbroken = damageInfo->applyToItem(this, damage);


Commit: 374a369fa55a086f9036923da58145b142c75b7d
    https://github.com/scummvm/scummvm/commit/374a369fa55a086f9036923da58145b142c75b7d
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-10-18T15:46:21+09:00

Commit Message:
ULTIMA8: Correct name of intrinsic

Changed paths:
    engines/ultima/ultima8/convert/crusader/convert_usecode_crusader.h


diff --git a/engines/ultima/ultima8/convert/crusader/convert_usecode_crusader.h b/engines/ultima/ultima8/convert/crusader/convert_usecode_crusader.h
index d6166c480f..b328e7e8b8 100644
--- a/engines/ultima/ultima8/convert/crusader/convert_usecode_crusader.h
+++ b/engines/ultima/ultima8/convert/crusader/convert_usecode_crusader.h
@@ -97,7 +97,7 @@ const char* const ConvertUsecodeCrusader::_intrinsics[] = {
 	"void Item::I_receiveHit(Item *, other, dir, damage, damagetype)", // based on disasm
 	"byte Actor::I_isBusy(4 bytes)", // same code as U8
 	"int16 Item::I_getDirFromTo16(x1, y1, x2, y2)",
-	"byte Actor::I_getSomeFlagProbablyCrouch(Item *)",
+	"byte Actor::I_getIsKneeling(Item *)",
 	"int16 Actor::I_doAnim(12 bytes)", // v. similar code to U8
 	"byte MainActor::I_addItemCru(4 bytes)", // same coff as 0B8
 	"void AudioProcess::I_stopSFXCru(Item *, int16 sndno)",


Commit: 613e89bdbd522d2f51e97e43d64456145110aac4
    https://github.com/scummvm/scummvm/commit/613e89bdbd522d2f51e97e43d64456145110aac4
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-10-18T15:47:13+09:00

Commit Message:
ULTIMA8: comment about correct sfx no

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


diff --git a/engines/ultima/ultima8/world/actors/cru_healer_process.cpp b/engines/ultima/ultima8/world/actors/cru_healer_process.cpp
index eb6b11ca7e..fdb9ddaca7 100644
--- a/engines/ultima/ultima8/world/actors/cru_healer_process.cpp
+++ b/engines/ultima/ultima8/world/actors/cru_healer_process.cpp
@@ -47,6 +47,7 @@ CruHealerProcess::CruHealerProcess() : Process() {
 		_targetMaxHP = avatar->getMaxHP();
 		AudioProcess *audio = AudioProcess::get_instance();
 		if (audio) {
+			// Sound num is the same in both No Remorse and No Regret
 			audio->playSFX(0xdb, 0x80, _itemNum, 1, false);
 		}
 	}


Commit: 1bdbb527d603deafe581acd68e833f4aec96b790
    https://github.com/scummvm/scummvm/commit/1bdbb527d603deafe581acd68e833f4aec96b790
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-10-18T15:48:05+09:00

Commit Message:
ULTIMA8: Correct operand order for shift operators in Crusader games

Changed paths:
    engines/ultima/ultima8/usecode/uc_machine.cpp


diff --git a/engines/ultima/ultima8/usecode/uc_machine.cpp b/engines/ultima/ultima8/usecode/uc_machine.cpp
index b9955374f6..2022865189 100644
--- a/engines/ultima/ultima8/usecode/uc_machine.cpp
+++ b/engines/ultima/ultima8/usecode/uc_machine.cpp
@@ -620,7 +620,7 @@ void UCMachine::execProcess(UCProcess *p) {
 			// subtract two 16 bit integers
 			si16a = static_cast<int16>(p->_stack.pop2());
 			si16b = static_cast<int16>(p->_stack.pop2());
-			p->_stack.push2(static_cast<uint16>(si16b - si16a)); // !! order?
+			p->_stack.push2(static_cast<uint16>(si16b - si16a));
 			LOGPF(("sub\n"));
 			break;
 
@@ -629,7 +629,7 @@ void UCMachine::execProcess(UCProcess *p) {
 			// subtract two 32 bit integers
 			si32a = static_cast<int16>(p->_stack.pop4());
 			si32b = static_cast<int16>(p->_stack.pop4());
-			p->_stack.push4(static_cast<uint32>(si32b - si32a)); // !! order?
+			p->_stack.push4(static_cast<uint32>(si32b - si32a));
 			LOGPF(("sub long\n"));
 			break;
 
@@ -653,7 +653,7 @@ void UCMachine::execProcess(UCProcess *p) {
 
 		case 0x20:
 			// 20
-			// divide two 16 bit integers    (order?)
+			// divide two 16 bit integers
 			si16a = static_cast<int16>(p->_stack.pop2());
 			si16b = static_cast<int16>(p->_stack.pop2());
 			if (si16a != 0) {
@@ -667,7 +667,7 @@ void UCMachine::execProcess(UCProcess *p) {
 
 		case 0x21:
 			// 21
-			// divide two 32 bit integers    (order?)
+			// divide two 32 bit integers
 			si32a = static_cast<int16>(p->_stack.pop4());
 			si32b = static_cast<int16>(p->_stack.pop4());
 			if (si32a != 0) {
@@ -1026,22 +1026,32 @@ void UCMachine::execProcess(UCProcess *p) {
 		case 0x3C:
 			// 3C
 			// 16 bit left shift
-			// operand order?
-			si16a = static_cast<int16>(p->_stack.pop2());
-			ui16b = static_cast<int16>(p->_stack.pop2());
+			// operand order is different between U8 and crusader!
+			if (GAME_IS_U8) {
+				si16a = static_cast<int16>(p->_stack.pop2());
+				ui16b = static_cast<int16>(p->_stack.pop2());
+			} else {
+				ui16b = static_cast<int16>(p->_stack.pop2());
+				si16a = static_cast<int16>(p->_stack.pop2());
+			}
 			p->_stack.push2(static_cast<uint16>(si16a << ui16b));
-			LOGPF(("lsh\n"));
+			LOGPF(("lsh\t%04Xh >> %xh = %xh\n", si16a, ui16b, si16a << ui16b));
 			break;
 
 		case 0x3D:
 			// 3D
 			// 16 bit right shift
 			// !! sign-extend or not?
-			// operand order?
-			si16a = static_cast<int16>(p->_stack.pop2());
-			ui16b = static_cast<int16>(p->_stack.pop2());
+			// operand order is different between U8 and crusader!
+			if (GAME_IS_U8) {
+				si16a = static_cast<int16>(p->_stack.pop2());
+				ui16b = static_cast<int16>(p->_stack.pop2());
+			} else {
+				ui16b = static_cast<int16>(p->_stack.pop2());
+				si16a = static_cast<int16>(p->_stack.pop2());
+			}
 			p->_stack.push2(static_cast<uint16>(si16a >> ui16b));
-			LOGPF(("rsh\n"));
+			LOGPF(("rsh\t%04Xh >> %xh = %xh\n", si16a, ui16b, si16a >> ui16b));
 			break;
 
 		case 0x3E:




More information about the Scummvm-git-logs mailing list