[Scummvm-git-logs] scummvm master -> b01c4fe4a7976d45d688d1203b0a0c0e39b09303

mduggan mgithub at guarana.org
Thu Jul 2 07:01:26 UTC 2020


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

Summary:
e66a6e7f28 ULTIMA8: Update crusader reticle when things move
aefc4e4022 DEVTOOLS: ULTIMA8: Add base ini files for Remorse
f404e22e61 ULTIMA8: Add function to replicate remorse NPC weapon difficulty
b01c4fe4a7 ULTIMA8: Support Crusader weapon table data


Commit: e66a6e7f28be34694293d4ddd4f89a207afdc11b
    https://github.com/scummvm/scummvm/commit/e66a6e7f28be34694293d4ddd4f89a207afdc11b
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-07-02T15:59:55+09:00

Commit Message:
ULTIMA8: Update crusader reticle when things move

Changed paths:
    engines/ultima/ultima8/world/actors/actor.cpp
    engines/ultima/ultima8/world/item.cpp
    engines/ultima/ultima8/world/item.h
    engines/ultima/ultima8/world/sprite_process.cpp
    engines/ultima/ultima8/world/sprite_process.h
    engines/ultima/ultima8/world/target_reticle_process.cpp
    engines/ultima/ultima8/world/target_reticle_process.h


diff --git a/engines/ultima/ultima8/world/actors/actor.cpp b/engines/ultima/ultima8/world/actors/actor.cpp
index 83f93494b6..c5e83b43ba 100644
--- a/engines/ultima/ultima8/world/actors/actor.cpp
+++ b/engines/ultima/ultima8/world/actors/actor.cpp
@@ -50,6 +50,7 @@
 #include "ultima/ultima8/world/actors/surrender_process.h"
 #include "ultima/ultima8/audio/audio_process.h"
 #include "ultima/ultima8/world/sprite_process.h"
+#include "ultima/ultima8/world/target_reticle_process.h"
 #include "ultima/ultima8/world/actors/main_actor.h"
 #include "ultima/ultima8/audio/music_process.h"
 #include "ultima/ultima8/world/get_object.h"
@@ -1102,8 +1103,10 @@ void Actor::clearInCombat() {
 int32 Actor::collideMove(int32 x, int32 y, int32 z, bool teleport, bool force,
 						 ObjId *hititem, uint8 *dirs) {
 	int32 result = Item::collideMove(x, y, z, teleport, force, hititem, dirs);
-	if (GAME_IS_CRUSADER)
+	if (_objId == 1 && GAME_IS_CRUSADER) {
 		notifyNearbyItems();
+		TargetReticleProcess::getProcess()->avatarMoved();
+	}
 	return result;
 }
 
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index 2a10668493..051dfb5300 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -57,6 +57,7 @@
 #include "ultima/ultima8/gumps/slider_gump.h"
 #include "ultima/ultima8/usecode/uc_process.h"
 #include "ultima/ultima8/world/destroy_item_process.h"
+#include "ultima/ultima8/world/target_reticle_process.h"
 #include "ultima/ultima8/audio/audio_process.h"
 #include "ultima/ultima8/games/game_info.h"
 #include "ultima/ultima8/world/actors/main_actor.h"
@@ -240,6 +241,9 @@ void Item::move(int32 X, int32 Y, int32 Z) {
 	// Note that we don't need to
 	if (_extendedFlags & EXT_CAMERA)
 		CameraProcess::GetCameraProcess()->ItemMoved();
+
+	if (_extendedFlags & EXT_TARGET)
+		TargetReticleProcess::getProcess()->itemMoved(this);
 }
 
 bool Item::moveToContainer(Container *container, bool checkwghtvol) {
diff --git a/engines/ultima/ultima8/world/item.h b/engines/ultima/ultima8/world/item.h
index 88280d7044..0f4bf761f6 100644
--- a/engines/ultima/ultima8/world/item.h
+++ b/engines/ultima/ultima8/world/item.h
@@ -636,6 +636,7 @@ public:
 		EXT_SPRITE       = 0x0040,  //!< Item is a sprite
 		EXT_TRANSPARENT  = 0x0080,  //!< Item should be painted transparent
 		EXT_PERMANENT_NPC = 0x0100, //!< Item is a permanent NPC
+		EXT_TARGET 		 = 0x0200,  //!< Item is the current reticle target in Crusader
 		EXT_FEMALE       = 0x8000	//!< Item is Crusader Female NPC (controls sfx)
 	};
 };
diff --git a/engines/ultima/ultima8/world/sprite_process.cpp b/engines/ultima/ultima8/world/sprite_process.cpp
index 44246700c5..f9e5abf4ec 100644
--- a/engines/ultima/ultima8/world/sprite_process.cpp
+++ b/engines/ultima/ultima8/world/sprite_process.cpp
@@ -64,6 +64,16 @@ SpriteProcess::~SpriteProcess(void) {
 	if (item) item->destroy();
 }
 
+void SpriteProcess::move(int x, int y, int z) {
+	_x = x;
+	_y = y;
+	_z = z;
+
+	Item *item = getItem(_itemNum);
+	if (item)
+		item->move(_x, _y, _z);
+}
+
 void SpriteProcess::run() {
 	if (!_initialized) init();
 
diff --git a/engines/ultima/ultima8/world/sprite_process.h b/engines/ultima/ultima8/world/sprite_process.h
index cb37447352..b4682aa454 100644
--- a/engines/ultima/ultima8/world/sprite_process.h
+++ b/engines/ultima/ultima8/world/sprite_process.h
@@ -63,6 +63,9 @@ public:
 	//! The SpriteProcess destructor
 	~SpriteProcess(void) override;
 
+	//! Move the sprite to a new location
+	void move(int x, int y, int z);
+
 	//! The SpriteProcess run function
 	void run() override;
 
diff --git a/engines/ultima/ultima8/world/target_reticle_process.cpp b/engines/ultima/ultima8/world/target_reticle_process.cpp
index 3210ef8446..9b8e4f6ec3 100644
--- a/engines/ultima/ultima8/world/target_reticle_process.cpp
+++ b/engines/ultima/ultima8/world/target_reticle_process.cpp
@@ -34,11 +34,14 @@
 namespace Ultima {
 namespace Ultima8 {
 
+TargetReticleProcess *TargetReticleProcess::_instance;
+
 // p_dynamic_cast stuff
 DEFINE_RUNTIME_CLASSTYPE_CODE(TargetReticleProcess)
 
 TargetReticleProcess::TargetReticleProcess() : Process(), _reticleEnabled(true),
-	_lastUpdate(0), _reticleSpriteProcess(0), _lastTargetDir(0x10), _lastTargetItem(0) {
+		_lastUpdate(0), _reticleSpriteProcess(0), _lastTargetDir(0x10), _lastTargetItem(0) {
+	_instance = this;
 }
 
 void TargetReticleProcess::run() {
@@ -62,27 +65,17 @@ void TargetReticleProcess::run() {
 		return;
 	}
 
-	Item *item = findTargetItem();
-	if (item && item->getObjId() != _lastTargetItem) {
-		if (spriteProc)
-			spriteProc->terminate();
-		putTargetReticleOnItem(item);
-	} else if (!item) {
-		debug("New reticle target: NONE");
-		if (spriteProc)
-			spriteProc->terminate();
-		_reticleSpriteProcess = 0;
-		_lastTargetItem = 0;
-		_lastTargetDir = 0x10;
-	}
-	// else, already targeting the right thing. do nothing.
-
+	bool changed = findTargetItem();
+	if (spriteProc && changed)
+		// Terminate the old process.
+		spriteProc->terminate();
 	_lastUpdate = frameno;
 }
 
-Item *TargetReticleProcess::findTargetItem() {
+bool TargetReticleProcess::findTargetItem() {
 	MainActor *mainactor = getMainActor();
 	CurrentMap *currentmap = World::get_instance()->getCurrentMap();
+	bool changed = false;
 
 	if (!mainactor || !currentmap)
 		return nullptr;
@@ -93,7 +86,30 @@ Item *TargetReticleProcess::findTargetItem() {
 	mainactor->getCentre(x, y, z);
 
 	Item *item = currentmap->findBestTargetItem(x, y, dir);
-	return item;
+
+	if (item && item->getObjId() != _lastTargetItem) {
+		Item *lastItem = getItem(_lastTargetItem);
+		if (lastItem)
+			lastItem->clearExtFlag(Item::EXT_TARGET);
+		putTargetReticleOnItem(item);
+		_lastTargetDir = dir;
+		changed = true;
+	} else if (!item) {
+		debug("New reticle target: NONE");
+		if (_lastTargetItem) {
+			Item *lastItem = getItem(_lastTargetItem);
+			if (lastItem)
+				lastItem->clearExtFlag(Item::EXT_TARGET);
+		}
+		clearSprite();
+		changed = true;
+	}
+	// else, already targeting the right thing. do nothing.
+	return changed;
+}
+
+void TargetReticleProcess::avatarMoved() {
+	_lastUpdate = 0;
 }
 
 void TargetReticleProcess::putTargetReticleOnItem(Item *item) {
@@ -107,9 +123,52 @@ void TargetReticleProcess::putTargetReticleOnItem(Item *item) {
 
 	_reticleSpriteProcess = Kernel::get_instance()->addProcess(p);
 	_lastTargetItem = item->getObjId();
+	item->setExtFlag(Item::EXT_TARGET);
 	debug("New reticle target: %d (%d, %d, %d)", _lastTargetItem, x, y, z);
 }
 
+void TargetReticleProcess::itemMoved(Item *item) {
+	assert(item);
+	if (!_reticleSpriteProcess || item->getObjId() != _lastTargetItem) {
+		// Shouldn't happen, but to be sure..
+		warning("TargetReticleProcess: no active reticle or notified by the wrong item (%d, expected %d, process %d)",
+				item->getObjId(), _lastTargetItem, _reticleSpriteProcess);
+		clearSprite();
+		return;
+	}
+
+	int32 x, y, z;
+	item->getCentre(x, y, z);
+
+	MainActor *mainactor = getMainActor();
+	int actordir = -1;
+	int dirtoitem = -2;
+	if (!mainactor) {
+		actordir = mainactor->getDir();
+		dirtoitem = mainactor->getDirToItemCentre(*item);
+	}
+
+	SpriteProcess *spriteproc = dynamic_cast<SpriteProcess *>(Kernel::get_instance()->getProcess(_reticleSpriteProcess));
+
+	// TODO: If the item moved outside the direction we're targeting,
+	// the process should be terminated.
+
+	if (spriteproc) {
+		if (actordir != _lastTargetDir || dirtoitem != _lastTargetDir) {
+			spriteproc->terminate();
+			clearSprite();
+		}
+	} else {
+		spriteproc->move(x, y, z);
+	}
+}
+
+void TargetReticleProcess::clearSprite() {
+	_reticleSpriteProcess = 0;
+	_lastTargetItem = 0;
+	_lastTargetDir = 0x10;
+}
+
 void TargetReticleProcess::saveData(Common::WriteStream *ws) {
 	Process::saveData(ws);
 
diff --git a/engines/ultima/ultima8/world/target_reticle_process.h b/engines/ultima/ultima8/world/target_reticle_process.h
index 8a0403f441..b69239c0ce 100644
--- a/engines/ultima/ultima8/world/target_reticle_process.h
+++ b/engines/ultima/ultima8/world/target_reticle_process.h
@@ -44,18 +44,31 @@ public:
 
 	void run() override;
 
+	//!< Notify this process that the item we're targetting has moved
+	void itemMoved(Item *item);
+
+	//!< Avatar direction changed - force update of finding a new item next frame.
+	void avatarMoved();
+
 	bool loadData(Common::ReadStream *rs, uint32 version);
 	void saveData(Common::WriteStream *ws) override;
 
+	static TargetReticleProcess *getProcess() {
+		return _instance;
+	}
+
 private:
-	Item *findTargetItem();
+	bool findTargetItem();
 	void putTargetReticleOnItem(Item *);
+	void clearSprite();
 
     bool _reticleEnabled;
 	int32 _lastUpdate;
 	uint16 _reticleSpriteProcess;
 	uint16 _lastTargetDir;
 	uint16 _lastTargetItem;
+
+	static TargetReticleProcess *_instance;
 };
 
 } // End of namespace Ultima8


Commit: aefc4e4022357aa923367221b1a58ec6f26ebe9e
    https://github.com/scummvm/scummvm/commit/aefc4e4022357aa923367221b1a58ec6f26ebe9e
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-07-02T15:59:55+09:00

Commit Message:
DEVTOOLS: ULTIMA8: Add base ini files for Remorse

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


diff --git a/devtools/create_ultima/files/ultima8/remorse.ini b/devtools/create_ultima/files/ultima8/remorse.ini
new file mode 100644
index 0000000000..fa57957ac5
--- /dev/null
+++ b/devtools/create_ultima/files/ultima8/remorse.ini
@@ -0,0 +1,2 @@
+[fontleads]
+6=0,3
diff --git a/devtools/create_ultima/files/ultima8/remorseweapons.ini b/devtools/create_ultima/files/ultima8/remorseweapons.ini
new file mode 100644
index 0000000000..b7464a8bb8
--- /dev/null
+++ b/devtools/create_ultima/files/ultima8/remorseweapons.ini
@@ -0,0 +1,77 @@
+[BA-40]
+shape=0x032E
+sound=0x2C
+ammo_type=0
+damage_type=0x0B
+
+[BA-41]
+shape=0x032F
+sound=0x2C
+ammo_type=1
+damage_type=0x0B
+
+[PA-21]
+shape=0x0330
+sound=0x8
+ammo_type=0
+damage_type=0x05
+
+[EM-4]
+shape=0x038C
+sound=0x43
+ammo_type=0
+damage_type=0x0F
+
+[SG-A1]
+shape=0x0332
+sound=0x55
+ammo_type=2
+damage_type=0x02
+
+[RP-22]
+shape=0x0333
+sound=0x2C
+ammo_type=3
+damage_type=0x01
+
+[RP-32]
+shape=0x0334
+sound=0x2C
+ammo_type=3
+damage_type=0x01
+
+[AR-7]
+shape=0x038E
+sound=0x2C
+ammo_type=4
+damage_type=0x0A
+
+[GL-303]
+shape=0x0388
+sound=0x64
+ammo_type=5
+damage_type=0x03
+
+[PA-31]
+shape=0x038A
+sound=0x2
+ammo_type=0
+damage_type=0x05
+
+[PL-1]
+shape=0x038D
+sound=0x47
+ammo_type=0
+damage_type=0x06
+
+[AC-88]
+shape=0x038B
+sound=0x55
+ammo_type=2
+damage_type=0x0D
+
+[UV-9]
+shape=0x0386
+sound=0x89
+ammo_type=0
+damage_type=0x0E


Commit: f404e22e611f06ec5c659a6594a9c8235ab6522f
    https://github.com/scummvm/scummvm/commit/f404e22e611f06ec5c659a6594a9c8235ab6522f
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-07-02T15:59:55+09:00

Commit Message:
ULTIMA8: Add function to replicate remorse NPC weapon difficulty

Changed paths:
    engines/ultima/ultima8/world/actors/npc_dat.cpp
    engines/ultima/ultima8/world/actors/npc_dat.h


diff --git a/engines/ultima/ultima8/world/actors/npc_dat.cpp b/engines/ultima/ultima8/world/actors/npc_dat.cpp
index b9e206ba42..a5d0927323 100644
--- a/engines/ultima/ultima8/world/actors/npc_dat.cpp
+++ b/engines/ultima/ultima8/world/actors/npc_dat.cpp
@@ -23,6 +23,7 @@
 #include "ultima/ultima8/misc/pent_include.h"
 #include "ultima/ultima8/world/actors/npc_dat.h"
 
+#include "ultima/ultima8/kernel/kernel.h"
 #include "common/memstream.h"
 
 namespace Ultima {
@@ -35,8 +36,10 @@ NPCDat::NPCDat(Common::SeekableReadStream &rs, Common::SeekableReadStream &namer
 
 	_minHp = rs.readUint16LE();
 	_maxHp = rs.readUint16LE();
-	// TODO: Read the other data.
-	rs.skip(22);
+	//
+	rs.skip(20);
+	// offset 0x18 (24): wpntable offset
+	/*uint16 _wpnTableOffset =*/ rs.readUint16LE();
 	// offset 0x1a (26): wpntype
 	_wpnType = rs.readUint16LE();
 	rs.skip(2);
@@ -54,8 +57,8 @@ NPCDat::NPCDat(Common::SeekableReadStream &rs, Common::SeekableReadStream &namer
 
 /*static*/
 Std::vector<NPCDat *> NPCDat::load(RawArchive *archive) {
-    Std::vector<NPCDat *> result;
-    assert(archive);
+	Std::vector<NPCDat *> result;
+	assert(archive);
 	if (archive->getCount() < 2) {
 		warning("NPCDat: Archive does not include the expected objects.");
 		return result;
@@ -76,5 +79,80 @@ Std::vector<NPCDat *> NPCDat::load(RawArchive *archive) {
 	return result;
 }
 
+/*static*/
+uint16 NPCDat::randomlyGetStrongerWeaponTypes(uint shapeno) {
+	// Apologies for the massive stack of constants, that's how
+	// it is in the original (fn at 10a0:3b10) :(
+
+	int rnd = getRandom();
+
+	switch (shapeno) {
+	case 899:	/* shape 899 - android */
+		if (rnd % 3 == 0)
+			return 10;
+		else
+			return 7;
+	case 0x2fd:
+	case 0x319: /* shape 793 - guardsq */
+		if (rnd % 4 == 0)
+			return 0xc;
+		else
+			return 3;
+	case 0x1b4:
+		if (rnd % 4 == 0)
+			return 0xd;
+		else
+			return 9;
+	case 0x2cb: /* shape 715 - roaming (robot) */
+		if (rnd % 2 == 0)
+			return 3;
+		else
+			return 7;
+	case 0x338: /* shape 824 - thermatr (robot) */
+		if (rnd % 3 == 0)
+			return 5;
+		else
+			return 7;
+	case 0x371:
+		if (rnd % 3 == 0)
+			return 9;
+		else
+			return 10;
+	case 0x4d1:
+		if (rnd % 2 == 0)
+			return 4;
+		else
+			return 0xb;
+	case 900:
+		if (rnd % 3 == 0)
+			return 5;
+		else
+			return 10;
+	case 0x385:
+		if (rnd % 4 == 0)
+			return 8;
+		else
+			return 9;
+	case 0x3ac:
+		if (rnd % 2 == 0)
+			return 9;
+		else
+			return 0xd;
+	case 0x4e6:
+		if (rnd % 3 == 0)
+			return 5;
+		else
+			return 0xb;
+	case 0x528:
+		if (rnd % 3 == 0)
+			return 9;
+		else
+			return 8;
+	default:
+		return 7;
+	}
+}
+
+
 } // End of namespace Ultima8
 } // End of namespace Ultima
diff --git a/engines/ultima/ultima8/world/actors/npc_dat.h b/engines/ultima/ultima8/world/actors/npc_dat.h
index d5af113163..cf4003f2a6 100644
--- a/engines/ultima/ultima8/world/actors/npc_dat.h
+++ b/engines/ultima/ultima8/world/actors/npc_dat.h
@@ -59,6 +59,9 @@ public:
 		return _defaultActivity[no];
 	}
 
+	//!< A function for randomly assigning stronger weapons for the highest difficulty level.
+	static uint16 randomlyGetStrongerWeaponTypes(uint shapeno);
+
 private:
     NPCDat(Common::SeekableReadStream &datars, Common::SeekableReadStream &namers);
 


Commit: b01c4fe4a7976d45d688d1203b0a0c0e39b09303
    https://github.com/scummvm/scummvm/commit/b01c4fe4a7976d45d688d1203b0a0c0e39b09303
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2020-07-02T15:59:55+09:00

Commit Message:
ULTIMA8: Support Crusader weapon table data

Changed paths:
    engines/ultima/ultima8/graphics/shape_info.h
    engines/ultima/ultima8/graphics/type_flags.cpp
    engines/ultima/ultima8/world/armour_info.h
    engines/ultima/ultima8/world/item_factory.cpp
    engines/ultima/ultima8/world/weapon_info.h


diff --git a/engines/ultima/ultima8/graphics/shape_info.h b/engines/ultima/ultima8/graphics/shape_info.h
index 825138b74d..3b95765694 100644
--- a/engines/ultima/ultima8/graphics/shape_info.h
+++ b/engines/ultima/ultima8/graphics/shape_info.h
@@ -69,10 +69,10 @@ public:
 		SF_MONSTEREGG  = 7,
 		SF_TELEPORTEGG = 8,
 		SF_REAGENT     = 9,
-		SF_10		   = 10, // Used in Crusader .. weapon?
-		SF_11		   = 11, // Used in Crusader .. inventory item?
-		SF_12		   = 12, // ?? Used in Crusader
-		SF_13		   = 13, // ?? Used in Crusader
+		SF_CRUWEAPON   = 10, // Used in Crusader
+		SF_CRUAMMO     = 11, // Used in Crusader
+		SF_CRUBOMB     = 12, // Used in Crusader
+		SF_CRUINVITEM  = 13, // Used in Crusader
 		SF_15          = 15
 	};
 
diff --git a/engines/ultima/ultima8/graphics/type_flags.cpp b/engines/ultima/ultima8/graphics/type_flags.cpp
index 56f0a28030..d550ac0232 100644
--- a/engines/ultima/ultima8/graphics/type_flags.cpp
+++ b/engines/ultima/ultima8/graphics/type_flags.cpp
@@ -131,12 +131,14 @@ void TypeFlags::load(Common::SeekableReadStream *rs) {
 			si._family = data[1] >> 4;
 			si._family += (data[2] & 1) << 4;
 
+			uint32 unk2data = (data[2] >> 1) & 0xF;
+
 			// (copied from old/viewer/ShapeManager.h)
 			si._x = ((data[3] << 3) | (data[2] >> 5)) & 0x1F;
 			si._y = (data[3] >> 2) & 0x1F;
 			si._z = ((data[4] << 1) | (data[3] >> 7)) & 0x1F;
 
-			si._unknown = ((data[4] & 0xF0) << 16) | (data[5] << 8) | data[8];
+			si._unknown = (unk2data << 24) + ((data[4] & 0xF0) << 16) | (data[5] << 8) | data[8];
 
 			// This seems to be how it's used..
 			si._weight = data[7];
@@ -194,7 +196,9 @@ void TypeFlags::loadWeaponInfo() {
 		const istring &k = *iter;
 		WeaponInfo *wi = new WeaponInfo;
 
-		int val;
+		int val = 0;
+
+		wi->_name = k;
 
 		config->get(k + "/shape", val);
 		wi->_shape = static_cast<uint32>(val);
@@ -211,14 +215,20 @@ void TypeFlags::loadWeaponInfo() {
 		config->get(k + "/base_damage", val);
 		wi->_baseDamage = static_cast<uint8>(val);
 
-		config->get(k + "/attack_dex", val);
-		wi->_dexAttackBonus = static_cast<uint8>(val);
+		if (config->get(k + "/attack_dex", val))
+			wi->_dexAttackBonus = static_cast<uint8>(val);
+		else
+			wi->_dexAttackBonus = 0;
 
-		config->get(k + "/defend_dex", val);
-		wi->_dexDefendBonus = static_cast<uint8>(val);
+		if (config->get(k + "/defend_dex", val))
+			wi->_dexDefendBonus = static_cast<uint8>(val);
+		else
+			wi->_dexDefendBonus = 0;
 
-		config->get(k + "/armour", val);
-		wi->_armourBonus = static_cast<uint8>(val);
+		if (config->get(k + "/armour", val))
+			wi->_armourBonus = static_cast<uint8>(val);
+		else
+			wi->_armourBonus = 0;
 
 		config->get(k + "/damage_type", val);
 		wi->_damageType = static_cast<uint16>(val);
@@ -228,6 +238,18 @@ void TypeFlags::loadWeaponInfo() {
 		else
 			wi->_treasureChance = 0;
 
+		// Crusader-specific fields:
+
+		if (config->get(k + "/ammo_type", val))
+			wi->_ammoType = static_cast<uint8>(val);
+		else
+			wi->_ammoType = 0;
+
+		if (config->get(k + "/sound", val))
+			wi->_sound = static_cast<uint8>(val);
+		else
+			wi->_sound = 0;
+
 		assert(wi->_shape < _shapeInfo.size());
 		_shapeInfo[wi->_shape]._weaponInfo = wi;
 	}
diff --git a/engines/ultima/ultima8/world/armour_info.h b/engines/ultima/ultima8/world/armour_info.h
index f58e92c4e2..15fafc34cf 100644
--- a/engines/ultima/ultima8/world/armour_info.h
+++ b/engines/ultima/ultima8/world/armour_info.h
@@ -23,6 +23,9 @@
 #ifndef ULTIMA8_WORLD_ARMOURINFO_H
 #define ULTIMA8_WORLD_ARMOURINFO_H
 
+namespace Ultima {
+namespace Ultima8 {
+
 struct ArmourInfo {
 	uint32 _shape;
 	uint32 _frame;
@@ -31,4 +34,7 @@ struct ArmourInfo {
 	uint16 _defenseType; // see WeaponInfo struct
 };
 
+} // End of namespace Ultima8
+} // End of namespace Ultima
+
 #endif
diff --git a/engines/ultima/ultima8/world/item_factory.cpp b/engines/ultima/ultima8/world/item_factory.cpp
index d7da73ced5..40241bc3a5 100644
--- a/engines/ultima/ultima8/world/item_factory.cpp
+++ b/engines/ultima/ultima8/world/item_factory.cpp
@@ -47,10 +47,10 @@ static Item *getItemForFamily(uint32 family) {
 	case ShapeInfo::SF_QUANTITY:
 	case ShapeInfo::SF_BREAKABLE:
 	case ShapeInfo::SF_REAGENT: // reagents need special handling too
-	case ShapeInfo::SF_10: // TODO: What's this? used in crusader levels
-	case ShapeInfo::SF_11: // TODO: What's this? used in crusader levels
-	case ShapeInfo::SF_12: // TODO: What's this? used in crusader levels
-	case ShapeInfo::SF_13: // TODO: What's this? used in crusader levels
+	case ShapeInfo::SF_CRUWEAPON:
+	case ShapeInfo::SF_CRUAMMO:
+	case ShapeInfo::SF_CRUBOMB:
+	case ShapeInfo::SF_CRUINVITEM:
 	case ShapeInfo::SF_15: // what's this?
 		// 'simple' item
 		return new Item();
diff --git a/engines/ultima/ultima8/world/weapon_info.h b/engines/ultima/ultima8/world/weapon_info.h
index b74f1dcbcb..ced62755c9 100644
--- a/engines/ultima/ultima8/world/weapon_info.h
+++ b/engines/ultima/ultima8/world/weapon_info.h
@@ -23,8 +23,13 @@
 #ifndef ULTIMA8_WORLD_WEAPONINFO_H
 #define ULTIMA8_WORLD_WEAPONINFO_H
 
+#include "ultima/shared/std/string.h"
+
+namespace Ultima {
+namespace Ultima8 {
 
 struct WeaponInfo {
+	Std::string _name;
 	uint32 _shape;
 	uint8 _overlayType;
 	uint32 _overlayShape;
@@ -36,6 +41,10 @@ struct WeaponInfo {
 	uint16 _damageType;
 	int _treasureChance;
 
+	// Crusader-specific fields:
+	uint16 _sound;
+	uint16 _ammoType;
+
 	enum DmgType {
 		DMG_NORMAL = 0x0001,
 		DMG_BLADE  = 0x0002,
@@ -49,5 +58,7 @@ struct WeaponInfo {
 	};
 };
 
+} // End of namespace Ultima8
+} // End of namespace Ultima
 
 #endif




More information about the Scummvm-git-logs mailing list