[Scummvm-git-logs] scummvm master -> 7a412c67b08fd5a803c0a077f12229344133dc6e
mduggan
noreply at scummvm.org
Sun Jan 16 08:54:32 UTC 2022
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:
9f15aa226a ULTIMA8: Add debug logs to Crusader attack process
90991f3d19 ULTIMA8: Add workaround for No Regret damage data
7a412c67b0 ULTIMA8: Add comment
Commit: 9f15aa226a2e6f61d1bcb750e8479672dc28d5f8
https://github.com/scummvm/scummvm/commit/9f15aa226a2e6f61d1bcb750e8479672dc28d5f8
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2022-01-16T17:54:18+09:00
Commit Message:
ULTIMA8: Add debug logs to Crusader attack process
This does not change the code unless WATCHACTOR is defined. Should help debug
any remaining differences for Bug #12750.
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 5fbad9bfd3d..05a8dec3333 100644
--- a/engines/ultima/ultima8/world/actors/attack_process.cpp
+++ b/engines/ultima/ultima8/world/actors/attack_process.cpp
@@ -40,6 +40,8 @@
namespace Ultima {
namespace Ultima8 {
+//#define WATCHACTOR 3
+
DEFINE_RUNTIME_CLASSTYPE_CODE(AttackProcess)
// These sound number arrays are in the order they appear in the original exes
@@ -551,6 +553,11 @@ void AttackProcess::genericAttack() {
return;
}
+#ifdef WATCHACTOR
+ if (_itemNum == WATCHACTOR)
+ debug("Attack: actor %d genericAttack (not busy or pathfinding)", _itemNum);
+#endif
+
// This should never be running on the controlled npc.
if (_itemNum == World::get_instance()->getControlledNPCNum()) {
terminate();
@@ -576,11 +583,20 @@ void AttackProcess::genericAttack() {
_target = controlledNPC;
}
+#ifdef WATCHACTOR
+ if (_itemNum == WATCHACTOR)
+ debug("Attack: genericAttack chose target %d", _target);
+#endif
+
Actor *target = getActor(_target);
if (!target || !target->isOnScreen() || target->isDead()) {
// Walk around randomly in hope of finding target
_target = 0;
if (!_isActivity9orB) {
+#ifdef WATCHACTOR
+ if (_itemNum == WATCHACTOR)
+ debug("Attack: genericAttack walking around looking for target %d", _target);
+#endif
int32 x, y, z;
a->getLocation(x, y, z);
x += -0x1ff + randomOf(0x400);
@@ -604,9 +620,17 @@ void AttackProcess::genericAttack() {
}
DirectionMode standDirMode = a->animDirMode(anim);
if (_timer3set) {
+#ifdef WATCHACTOR
+ if (_itemNum == WATCHACTOR)
+ debug("Attack: _timer3set");
+#endif
if (_timer3 >= ticknow) {
if (a->isInCombat()) {
if (randomOf(3) != 0) {
+#ifdef WATCHACTOR
+ if (_itemNum == WATCHACTOR)
+ debug("Attack: toggle weapon state");
+#endif
const Animation::Sequence lastanim = a->getLastAnim();
if ((lastanim != Animation::unreadyWeapon) && (lastanim != Animation::unreadyLargeWeapon))
a->doAnim(Animation::unreadyWeapon, dir_current);
@@ -643,6 +667,11 @@ void AttackProcess::genericAttack() {
if (_timer4 == 0)
_timer4 = ticknow;
+#ifdef WATCHACTOR
+ if (_itemNum == WATCHACTOR)
+ debug("Attack: firing weapon at tick %d!", ticknow);
+#endif
+
const ProcId animpid = a->doAnim(Animation::attack, dir_current); // fire small weapon.
if (animpid == 0) {
return;
@@ -672,10 +701,18 @@ void AttackProcess::genericAttack() {
const int32 zdiff = abs(a->getZ() - target->getZ());
const bool onscreen = a->isPartlyOnScreen(); // note: original uses "isMajorityOnScreen", this is close enough.
if ((!_isActivity9orB && !onscreen) || (dist <= zdiff)) {
+#ifdef WATCHACTOR
+ if (_itemNum == WATCHACTOR)
+ debug("Attack: Not 9/B and actor not onscreen or dist %d < zdiff %d, pathfinding", dist, zdiff);
+#endif
pathfindToItemInNPCData();
return;
}
if (targetdir == curdir) {
+#ifdef WATCHACTOR
+ if (_itemNum == WATCHACTOR)
+ debug("Attack: targetdir == currentdir");
+#endif
const uint16 rnd = randomOf(10);
const uint32 frameno = Kernel::get_instance()->getFrameNum();
const uint32 timeoutfinish = target->getAttackMoveTimeoutFinishFrame();
@@ -759,6 +796,10 @@ void AttackProcess::genericAttack() {
return;
}
} else {
+#ifdef WATCHACTOR
+ if (_itemNum == WATCHACTOR)
+ debug("Attack: targetdir != currentdir");
+#endif
bool ready;
if (!timer4and5Update(ticknow) && !_field7f) {
if (standDirMode != dirmode_16dirs) {
@@ -956,6 +997,10 @@ uint16 AttackProcess::getAttackData(uint16 off) const {
}
void AttackProcess::pathfindToItemInNPCData() {
+#ifdef WATCHACTOR
+ if (_itemNum == WATCHACTOR)
+ debug("Attack: pathfindToItemInNPCData");
+#endif
_doubleDelay = false;
_timer2set = false;
_field96 = true;
@@ -979,6 +1024,12 @@ bool AttackProcess::timer4and5Update(int now) {
delay = 240;
}
+#ifdef WATCHACTOR
+ if (_itemNum == WATCHACTOR)
+ debug("Attack: timer4and5Update (doubledelay=%d, timer4=%d, timer5=%d)",
+ _doubleDelay, _timer4, _timer5);
+#endif
+
if (_timer4) {
_timer5 = _timer4;
if (_timer4 + delay >= now) {
@@ -1017,6 +1068,10 @@ void AttackProcess::setTimer3() {
void AttackProcess::sleep(int ticks) {
// waiting less than 2 ticks can cause a tight loop
+#ifdef WATCHACTOR
+ if (_itemNum == WATCHACTOR)
+ debug("Attack: sleeping for %d", ticks);
+#endif
ticks = MAX(ticks, 2);
Process *delayProc = new DelayProcess(ticks);
ProcId pid = Kernel::get_instance()->addProcess(delayProc);
Commit: 90991f3d19e1156d989682c02728ca6a08312bfb
https://github.com/scummvm/scummvm/commit/90991f3d19e1156d989682c02728ca6a08312bfb
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2022-01-16T17:54:18+09:00
Commit Message:
ULTIMA8: Add workaround for No Regret damage data
I spent all day looking at decompilation and I still don't understand why these
items are not destroyed in the original game, but they shouldn't be destroyed.
Changed paths:
engines/ultima/ultima8/graphics/type_flags.cpp
diff --git a/engines/ultima/ultima8/graphics/type_flags.cpp b/engines/ultima/ultima8/graphics/type_flags.cpp
index 42ace130465..85e4605a8b1 100644
--- a/engines/ultima/ultima8/graphics/type_flags.cpp
+++ b/engines/ultima/ultima8/graphics/type_flags.cpp
@@ -135,6 +135,12 @@ void TypeFlags::load(Common::SeekableReadStream *rs) {
si._animData = data[5] & 0x0F;
si._animSpeed = data[5] >> 4;
+ if (si._animType != 0 && si._animSpeed == 0) {
+ // avoid invalid speeds.
+ warning("fixing anim speed 0 for shape %d", i);
+ si._animSpeed = 1;
+ }
+
if (data[6] & 0x01) si._flags |= ShapeInfo::SI_EDITOR;
if (data[6] & 0x02) si._flags |= ShapeInfo::SI_CRU_SELECTABLE;
if (data[6] & 0x04) si._flags |= ShapeInfo::SI_CRU_PRELOAD;
@@ -450,6 +456,19 @@ void TypeFlags::loadDamageDat(Common::SeekableReadStream *rs) {
if (damagedata[0] == 0)
continue;
+ if (GAME_IS_REGRET && damagedata[0] == 1 && !damagedata[1] &&
+ !damagedata[2] && !damagedata[3] &&
+ !damagedata[4] && !damagedata[5]) {
+ // WORKAROUND: No Regret has 3 shapes with this data pattern
+ // which doesn't seem to be correct - eg, the elevator buttons
+ // can be destroyed by gunshots which breaks the game.
+ // Just ignore this pattern.
+ // In No Remorse these maybe this pattern should be ignored too,
+ // but there on some shapes that don't break the game.
+ debug("Ignoring weird damage dat, shape %d (1 flag and rest 0s)", i);
+ continue;
+ }
+
DamageInfo *di = new DamageInfo(damagedata);
_shapeInfo[i]._damageInfo = di;
}
Commit: 7a412c67b08fd5a803c0a077f12229344133dc6e
https://github.com/scummvm/scummvm/commit/7a412c67b08fd5a803c0a077f12229344133dc6e
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2022-01-16T17:54:18+09:00
Commit Message:
ULTIMA8: Add comment
Changed paths:
engines/ultima/ultima8/world/item_factory.cpp
diff --git a/engines/ultima/ultima8/world/item_factory.cpp b/engines/ultima/ultima8/world/item_factory.cpp
index cf7db431a08..b7b644de9b6 100644
--- a/engines/ultima/ultima8/world/item_factory.cpp
+++ b/engines/ultima/ultima8/world/item_factory.cpp
@@ -99,7 +99,8 @@ Item *ItemFactory::createItem(uint32 shape, uint32 frame, uint16 quality,
if (GAME_IS_CRUSADER) {
if (info->_damageInfo && info->_damageInfo->takesDamage()) {
item->setDamagePoints(info->_damageInfo->damagePoints());
- }
+ } // else damage points is default 1 (set in Item constructor)
+
if (info->_family == ShapeInfo::SF_CRUWEAPON && info->_weaponInfo &&
info->_weaponInfo->_clipSize) {
item->setQuality(info->_weaponInfo->_clipSize);
More information about the Scummvm-git-logs
mailing list