[Scummvm-git-logs] scummvm master -> 6bb3efb024afb2ec4f7341112701eaaa8ce9f381

mduggan mgithub at guarana.org
Mon Dec 7 08:47:09 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:
5403a8f2f3 ULTIMA8: JANITORIAL: remove redundant brackets
e294530282 ULTIMA8: Set correct global for No Regret
37224b21dd ULTIMA8: Wire up pause and unpause intrinsics for No Regret
6eb4d5db19 ULTIMA8: JANITORIAL: Fix comments
6bb3efb024 ULTIMA8: Correct some more usecode event triggers for Crusader


Commit: 5403a8f2f3fa14bca4c4e11d36f75d5b5d7c816a
    https://github.com/scummvm/scummvm/commit/5403a8f2f3fa14bca4c4e11d36f75d5b5d7c816a
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-12-07T17:27:55+09:00

Commit Message:
ULTIMA8: JANITORIAL: remove redundant brackets

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


diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index d4ce99005a..8e9285503c 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -910,7 +910,7 @@ void Actor::receiveHitCru(uint16 other, Direction dir, int damage, uint16 damage
 
 void Actor::tookHitCru() {
 	Animation::Sequence lastanim = getLastAnim();
-	if ((lastanim == Animation::unknownAnim30) || (lastanim == Animation::startRunWithLargeWeapon)) {
+	if (lastanim == Animation::unknownAnim30 || lastanim == Animation::startRunWithLargeWeapon) {
 		//uint16 controllednpc = World::get_instance()->getControlledNPCNum();
 		bool canseecontrolled = true; //this->canSee(controllednpc);
 		if (canseecontrolled) {


Commit: e294530282e9fa519e8d941d8137593e7e6fcfe9
    https://github.com/scummvm/scummvm/commit/e294530282e9fa519e8d941d8137593e7e6fcfe9
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-12-07T17:27:55+09:00

Commit Message:
ULTIMA8: Set correct global for No Regret

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 8f49ed5b4d..89e3ae56fd 100644
--- a/engines/ultima/ultima8/usecode/uc_machine.cpp
+++ b/engines/ultima/ultima8/usecode/uc_machine.cpp
@@ -133,9 +133,12 @@ void UCMachine::reset() {
 	// clear _globals
 	_globals->setSize(0x1000);
 
-	if (GAME_IS_CRUSADER) {
-		// slight hack: set global 003C to start as avatar number.
+	// slight HACK: set global 003C (remorse) / 001E (regret)
+	// to start as avatar number.
+	if (GAME_IS_REMORSE) {
 		_globals->setEntries(0x3C, 2, 1);
+	} else if (GAME_IS_REGRET) {
+		_globals->setEntries(0x1E, 2, 1);
 	}
 
 	// clear strings, lists


Commit: 37224b21ddbe49231e80e50b1f6e57d0f92397f4
    https://github.com/scummvm/scummvm/commit/37224b21ddbe49231e80e50b1f6e57d0f92397f4
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-12-07T17:27:55+09:00

Commit Message:
ULTIMA8: Wire up pause and unpause intrinsics for No Regret

Changed paths:
    engines/ultima/ultima8/audio/music_process.cpp


diff --git a/engines/ultima/ultima8/audio/music_process.cpp b/engines/ultima/ultima8/audio/music_process.cpp
index 6f81033714..dc7b2845ba 100644
--- a/engines/ultima/ultima8/audio/music_process.cpp
+++ b/engines/ultima/ultima8/audio/music_process.cpp
@@ -62,14 +62,14 @@ uint32 MusicProcess::I_playMusic(const uint8 *args,
 uint32 MusicProcess::I_pauseMusic(const uint8 *args,
 								 unsigned int /*argsize*/) {
 	// This is only used in Crusader: No Regret.
-	warning("TODO: MusicProcess::I_pauseMusic Implement me");
+	if (_theMusicProcess) _theMusicProcess->pauseMusic();
 	return 0;
 }
 
 uint32 MusicProcess::I_unpauseMusic(const uint8 *args,
 								 unsigned int /*argsize*/) {
 	// This is only used in Crusader: No Regret.
-	warning("TODO: MusicProcess::I_unpauseMusic Implement me");
+	if (_theMusicProcess) _theMusicProcess->unpauseMusic();
 	return 0;
 }
 


Commit: 6eb4d5db193937399ecf939913963a690ae5e63c
    https://github.com/scummvm/scummvm/commit/6eb4d5db193937399ecf939913963a690ae5e63c
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-12-07T17:27:55+09:00

Commit Message:
ULTIMA8: JANITORIAL: Fix comments

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


diff --git a/engines/ultima/ultima8/world/egg_hatcher_process.cpp b/engines/ultima/ultima8/world/egg_hatcher_process.cpp
index f4f5187b0f..fac50d9311 100644
--- a/engines/ultima/ultima8/world/egg_hatcher_process.cpp
+++ b/engines/ultima/ultima8/world/egg_hatcher_process.cpp
@@ -76,8 +76,8 @@ void EggHatcherProcess::run() {
 
 		// 'justTeleported':
 		// if the avatar teleports, set the 'justTeleported' flag.
-		// if this is set, don't hatch any teleport _eggs
-		// unset it when you're out of range of any teleport _eggs
+		// if this is set, don't hatch any teleport eggs
+		// unset it when you're out of range of any teleport eggs
 		TeleportEgg *tegg = dynamic_cast<TeleportEgg *>(egg);
 
 		if (x1 <= ax && ax - axs < x2 && y1 <= ay && ay - ays < y2 &&
@@ -103,7 +103,7 @@ void EggHatcherProcess::saveData(Common::WriteStream *ws) {
 bool EggHatcherProcess::loadData(Common::ReadStream *rs, uint32 version) {
 	if (!Process::loadData(rs, version)) return false;
 
-	// the _eggs will be re-added to the EggHatcherProcess when they're
+	// the eggs will be re-added to the EggHatcherProcess when they're
 	// re-added to the CurrentMap
 
 	return true;


Commit: 6bb3efb024afb2ec4f7341112701eaaa8ce9f381
    https://github.com/scummvm/scummvm/commit/6bb3efb024afb2ec4f7341112701eaaa8ce9f381
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-12-07T17:27:55+09:00

Commit Message:
ULTIMA8: Correct some more usecode event triggers for Crusader

Fixes a few things:
* Music is played automatically (can remove manual trigger)
* Mission 1 movie is shown automatically
* valueboxes have the correct values, so passcodes are not 0

Changed paths:
    engines/ultima/ultima8/games/start_crusader_process.cpp
    engines/ultima/ultima8/world/current_map.cpp
    engines/ultima/ultima8/world/current_map.h
    engines/ultima/ultima8/world/item.cpp


diff --git a/engines/ultima/ultima8/games/start_crusader_process.cpp b/engines/ultima/ultima8/games/start_crusader_process.cpp
index 02433e2fae..b89ef76375 100644
--- a/engines/ultima/ultima8/games/start_crusader_process.cpp
+++ b/engines/ultima/ultima8/games/start_crusader_process.cpp
@@ -25,8 +25,6 @@
 #include "ultima/ultima8/games/start_crusader_process.h"
 #include "ultima/ultima8/games/game.h"
 #include "ultima/ultima8/games/remorse_game.h"
-#include "ultima/ultima8/world/loop_script.h"
-#include "ultima/ultima8/usecode/uc_list.h"
 #include "ultima/ultima8/world/current_map.h"
 #include "ultima/ultima8/world/egg.h"
 #include "ultima/ultima8/world/camera_process.h"
@@ -115,11 +113,8 @@ void StartCrusaderProcess::run() {
 		Kernel::get_instance()->addProcess(fader);
 	}
 
-	MusicProcess::get_instance()->playMusic(1);
-
 	Ultima8Engine::get_instance()->setAvatarInStasis(false);
 
-
 	terminate();
 }
 
diff --git a/engines/ultima/ultima8/world/current_map.cpp b/engines/ultima/ultima8/world/current_map.cpp
index 79d54158f5..fcf9307dd1 100644
--- a/engines/ultima/ultima8/world/current_map.cpp
+++ b/engines/ultima/ultima8/world/current_map.cpp
@@ -126,7 +126,7 @@ void CurrentMap::writeback() {
 				// item is being removed from the CurrentMap item lists
 				item->clearExtFlag(Item::EXT_INCURMAP);
 
-				// delete all _fast only and disposable _items
+				// delete all fast only and disposable _items
 				if (item->hasFlags(Item::FLG_FAST_ONLY | Item::FLG_DISPOSABLE)) {
 					delete item;
 					continue;
@@ -161,14 +161,14 @@ void CurrentMap::writeback() {
 	_eggHatcher = 0;
 }
 
-void CurrentMap::loadItems(Std::list<Item *> itemlist, bool callCacheIn) {
-	item_list::iterator iter;
+void CurrentMap::loadItems(const Std::list<Item *> &itemlist, bool callCacheIn) {
+	item_list::const_iterator iter;
 	for (iter = itemlist.begin(); iter != itemlist.end(); ++iter) {
 		Item *item = *iter;
 
 		item->assignObjId();
 
-		// No _fast area for you!
+		// No fast area for you!
 		item->clearFlag(Item::FLG_FASTAREA);
 
 		// add item to internal object list
@@ -180,14 +180,16 @@ void CurrentMap::loadItems(Std::list<Item *> itemlist, bool callCacheIn) {
 }
 
 void CurrentMap::loadMap(Map *map) {
-	// don't call the cachein events at startup or when loading a savegame
-	bool callCacheIn = (_currentMap != nullptr);
+	// Don't call the cachein events at startup or when loading a savegame
+	// in u8.  Always call them in Crusader.
+	// TODO: This may not work for loading games in Crusader - need to check.
+	bool callCacheIn = (_currentMap != nullptr || GAME_IS_CRUSADER);
 
 	_currentMap = map;
 
 	createEggHatcher();
 
-	// Clear _fast area
+	// Clear fast area
 	for (unsigned int i = 0; i < MAP_NUM_CHUNKS; i++) {
 		Std::memset(_fast[i], false, sizeof(uint32)*MAP_NUM_CHUNKS / 32);
 	}
@@ -199,7 +201,7 @@ void CurrentMap::loadMap(Map *map) {
 	loadItems(map->_fixedItems, callCacheIn);
 	loadItems(map->_dynamicItems, callCacheIn);
 
-	// we take control of the _items in map, so clear the pointers
+	// we take control of the items in map, so clear the pointers
 	map->_fixedItems.clear();
 	map->_dynamicItems.clear();
 
@@ -217,11 +219,9 @@ void CurrentMap::loadMap(Map *map) {
 		if (actor->getMapNum() == getNum()) {
 			addItemToEnd(actor);
 
-#if 0
-			// the avatar's cachein function is very strange; disabled for now
-			if (callCacheIn)
+			// the avatar's cachein function is very strange in U8; disabled for now
+			if (callCacheIn && GAME_IS_CRUSADER)
 				actor->callUsecodeEvent_cachein();
-#endif
 		}
 	}
 }
@@ -474,9 +474,9 @@ void CurrentMap::updateFastArea(int32 from_x, int32 from_y, int32 from_z, int32
 			if (want_fast == currently_fast)
 				continue;
 
-			// leave _fast area
+			// leave fast area
 			if (!want_fast) unsetChunkFast(cx, cy);
-			// Enter _fast area
+			// Enter fast area
 			else setChunkFast(cx, cy);
 		}
 	}
diff --git a/engines/ultima/ultima8/world/current_map.h b/engines/ultima/ultima8/world/current_map.h
index ed5d3251ec..c0726a8164 100644
--- a/engines/ultima/ultima8/world/current_map.h
+++ b/engines/ultima/ultima8/world/current_map.h
@@ -217,7 +217,7 @@ public:
 	INTRINSIC(I_canExistAtPoint);
 
 private:
-	void loadItems(Std::list<Item *> itemlist, bool callCacheIn);
+	void loadItems(const Std::list<Item *> &itemlist, bool callCacheIn);
 	void createEggHatcher();
 
 	//! clip the given map chunk numbers to iterate over them safely
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index 69f2d51157..9db234fce9 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -1381,13 +1381,17 @@ unsigned int Item::countNearby(uint32 shape, uint16 range) {
 uint32 Item::callUsecodeEvent(uint32 event, const uint8 *args, int argsize) {
 	uint32  class_id = _shape;
 
-	// Non-monster NPCs use _objId/_npcNum + 1024
+	// Non-monster NPCs use _objId/_npcNum + 1024 (2048 in crusader)
 	// Note: in the original, a non-monster NPC is specified with
 	// the FAST_ONLY flag. However, this causes some summoned monster which
 	// do not receive the FAST_ONLY flag to behave strangely. (Confirmed that
 	// happens in the original as well.) -wjp 20050128
-	if (_objId < 256 && (_extendedFlags & EXT_PERMANENT_NPC))
-		class_id = _objId + 1024;
+	if (_objId < 256 && (_extendedFlags & EXT_PERMANENT_NPC)) {
+		if (GAME_IS_U8)
+			class_id = _objId + 1024;
+		else
+			class_id = _objId + 2048;
+	}
 
 	// CHECKME: to make Pentagram behave as much like the original as possible,
 	// don't call any usecode if the original would call the wrong class




More information about the Scummvm-git-logs mailing list