[Scummvm-git-logs] scummvm master -> 02b66bebb62a4a84286e1ef04bde7989c118b932
mduggan
mgithub at guarana.org
Thu Apr 8 01:06:51 UTC 2021
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:
b5f3a83bae ULTIMA8: Remove outdated comment
9408b5de08 ULTIMA8: Update Crusader targetable status when shapes change
02b66bebb6 ULTIMA8: Make item animation more exact to original
Commit: b5f3a83baed4548ad3757e68b140a77423337d35
https://github.com/scummvm/scummvm/commit/b5f3a83baed4548ad3757e68b140a77423337d35
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-08T09:07:54+09:00
Commit Message:
ULTIMA8: Remove outdated comment
Changed paths:
engines/ultima/ultima8/usecode/remorse_intrinsics.h
diff --git a/engines/ultima/ultima8/usecode/remorse_intrinsics.h b/engines/ultima/ultima8/usecode/remorse_intrinsics.h
index 72828a379c..f3cb28b37d 100644
--- a/engines/ultima/ultima8/usecode/remorse_intrinsics.h
+++ b/engines/ultima/ultima8/usecode/remorse_intrinsics.h
@@ -100,7 +100,7 @@ Intrinsic RemorseIntrinsics[] = {
Item::I_setQLo,
Item::I_getFamily,
Container::I_destroyContents,
- Item::I_fall, // FIXME: Not really the same as the U8 version.. does this work?
+ Item::I_fall,
Egg::I_getEggId, // void Intrinsic03F(4 bytes)
// 0x040
CameraProcess::I_moveTo, // void Intrinsic040(8 bytes)
Commit: 9408b5de08c62aa02e73c7329ece4a2de20a4224
https://github.com/scummvm/scummvm/commit/9408b5de08c62aa02e73c7329ece4a2de20a4224
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-08T09:07:54+09:00
Commit Message:
ULTIMA8: Update Crusader targetable status when shapes change
Changed paths:
engines/ultima/ultima8/graphics/shape_info.h
engines/ultima/ultima8/world/item.cpp
diff --git a/engines/ultima/ultima8/graphics/shape_info.h b/engines/ultima/ultima8/graphics/shape_info.h
index dd302a30f0..4156a55e18 100644
--- a/engines/ultima/ultima8/graphics/shape_info.h
+++ b/engines/ultima/ultima8/graphics/shape_info.h
@@ -144,6 +144,9 @@ public:
inline bool is_u8_explode() const {
return (_flags & SI_U8_EXPLODE) != 0;
}
+ inline bool is_targetable() const {
+ return (_flags & (SI_OCCL | SI_CRU_TARGETABLE));
+ }
bool hasQuantity() const {
return (_family == SF_QUANTITY || _family == SF_REAGENT);
diff --git a/engines/ultima/ultima8/world/item.cpp b/engines/ultima/ultima8/world/item.cpp
index 988792d0c9..aa1e789080 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -469,11 +469,28 @@ Box Item::getWorldBox() const {
}
void Item::setShape(uint32 shape) {
- _shape = shape;
- _cachedShapeInfo = nullptr;
_cachedShape = nullptr;
- // FIXME: In Crusader, here we should check if the shape
- // changed from targetable to not-targetable, or vice-versa
+
+ if (GAME_IS_CRUSADER) {
+ // In Crusader, here we need to check if the shape
+ // changed from targetable to not-targetable, or vice-versa
+ const ShapeInfo *oldinfo = getShapeInfo();
+ _shape = shape;
+ _cachedShapeInfo = nullptr;
+ const ShapeInfo *newinfo = getShapeInfo();
+
+ if (!hasFlags(FLG_BROKEN)) {
+ if (oldinfo->is_targetable() && !newinfo->is_targetable()) {
+ World::get_instance()->getCurrentMap()->removeTargetItem(this);
+ }
+ else if (!oldinfo->is_targetable() && newinfo->is_targetable()) {
+ World::get_instance()->getCurrentMap()->addTargetItem(this);
+ }
+ }
+ } else {
+ _shape = shape;
+ _cachedShapeInfo = nullptr;
+ }
}
bool Item::overlaps(const Item &item2) const {
@@ -1810,7 +1827,7 @@ void Item::enterFastArea() {
}
if (!hasFlags(FLG_BROKEN) && GAME_IS_CRUSADER) {
- if ((si->_flags & ShapeInfo::SI_CRU_TARGETABLE) || (si->_flags & ShapeInfo::SI_OCCL)) {
+ if (si->is_targetable()) {
World::get_instance()->getCurrentMap()->addTargetItem(this);
}
if (_shape == SNAP_EGG_SHAPE) {
Commit: 02b66bebb62a4a84286e1ef04bde7989c118b932
https://github.com/scummvm/scummvm/commit/02b66bebb62a4a84286e1ef04bde7989c118b932
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-08T09:07:54+09:00
Commit Message:
ULTIMA8: Make item animation more exact to original
A couple of subtle differences came up when comparing with the disassembly.
This should now be more accurate, although may be unnoticably different.
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 aa1e789080..74472e2d23 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -1727,55 +1727,65 @@ void Item::animateItem() {
if (!info->_animType)
return;
- int anim_data = info->_animData;
- int speed = info->_animSpeed;
-
- if ((static_cast<int>(_lastSetup) % speed * 2) != 0 && info->_animType != 1)
- return;
-
+ uint32 anim_data = info->_animData;
const Shape *shp = getShapeObject();
switch (info->_animType) {
case 2:
- // 50 % chance
- if (getRandom() & 1) break;
- // Intentional fall-through
+ // Randomly change frame
+ if ((getRandom() & 1) && shp)
+ _frame = getRandom() % shp->frameCount();
+ break;
case 1:
case 3:
- // 50 % chance
- if (anim_data == 1 && (getRandom() & 1)) break;
- _frame ++;
- if (anim_data < 2) {
- if (shp && _frame == shp->frameCount()) _frame = 0;
- } else {
- // Data represents frame count for the loop
- unsigned int num = (_frame - 1) / anim_data;
- if (_frame == ((num + 1)*anim_data)) _frame = num * anim_data;
+ // animdata 0 = always increment
+ // animdata 1 = 50 % chance of changing
+ // animdata 2+ = loop in frame blocks of size animdata
+ if (anim_data == 0 || (anim_data == 1 && (getRandom() & 1))) {
+ _frame++;
+ if (shp && _frame >= shp->frameCount())
+ _frame = 0;
+ } else if (anim_data > 1) {
+ _frame++;
+ uint32 num = (_frame - 1) / anim_data;
+ if (_frame == ((num + 1) * anim_data))
+ _frame = num * anim_data;
}
break;
case 4:
- if (anim_data && !(getRandom() % anim_data)) break;
- _frame ++;
- if (shp && _frame == shp->frameCount()) _frame = 0;
+ // Randomly start animating, with chance of 1/(animdata + 2)
+ // once animating, go through all frames.
+ if (_frame || getRandom() % (anim_data + 2)) {
+ _frame++;
+ if (shp && _frame >= shp->frameCount())
+ _frame = 0;
+ }
break;
-
case 5:
+ // Just call the usecode
callUsecodeEvent_anim();
break;
case 6:
- if (anim_data < 2) {
- if (_frame == 0) break;
- _frame ++;
- if (shp && _frame == shp->frameCount()) _frame = 1;
- } else {
- if (!(_frame % anim_data)) break;
- _frame ++;
- unsigned int num = (_frame - 1) / anim_data;
- if (_frame == ((num + 1)*anim_data)) _frame = num * anim_data + 1;
+ // animdata 0 = stick on frame 0, else loop from 1 to count
+ // animdata 1 = same as 0, but with 50% chance of change
+ // animdata 2+ = same, but loop in frame blocks of size animdata
+ if (anim_data == 0 || (anim_data == 1 && (getRandom() & 1))) {
+ if (!_frame)
+ break;
+ _frame++;
+ if (shp && _frame >= shp->frameCount())
+ _frame = 1;
+ } else if (anim_data > 1) {
+ if (!(_frame % anim_data))
+ break;
+ _frame++;
+ uint32 num = (_frame - 1) / anim_data;
+ if (_frame == ((num + 1) * anim_data))
+ _frame = num * anim_data + 1;
}
break;
More information about the Scummvm-git-logs
mailing list