[Scummvm-git-logs] scummvm master -> 2e29f9fed98530b8365d43042b91dfc00704b028
mduggan
mgithub at guarana.org
Sat Apr 17 06:15:48 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:
8881e5d295 ULTIMA8: Correct Crusader hurl parameters when taking fire damage
f974ea39ba ULTIMA8: Remove direction factors which are no longer used
2e29f9fed9 ULTIMA8: Disable position interpolation by default in Crusader
Commit: 8881e5d29560c18aff816d8ae9d0612fd2c2e136
https://github.com/scummvm/scummvm/commit/8881e5d29560c18aff816d8ae9d0612fd2c2e136
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-17T14:58:55+09:00
Commit Message:
ULTIMA8: Correct Crusader hurl parameters when taking fire damage
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 c99907ce7b..c4b2ae5acd 100644
--- a/engines/ultima/ultima8/world/item.cpp
+++ b/engines/ultima/ultima8/world/item.cpp
@@ -2248,9 +2248,14 @@ void Item::receiveHitCru(uint16 other, Direction dir, int damage, uint16 type) {
return;
}
+ assert((int)dir >= 0 && (int)dir < 16);
+
+ static const int hurl_x_factor[] = { 0, +1, +2, +2, +2, +2, +2, +1, 0, -1, -2, -2, -2, -2, -2, -1 };
+ static const int hurl_y_factor[] = { -2, -2, -2, -1, 0, +1, +2, +2, +2, +2, +2, +1, 0, -1, -2, -2 };
+
int xhurl = 10 + getRandom() % 15;
int yhurl = 10 + getRandom() % 15;
- hurl(-xhurl * Direction_XFactor(dir), -yhurl * Direction_YFactor(dir), 0, 2); //!! constants
+ hurl(-xhurl * hurl_x_factor[(int)dir], -yhurl * hurl_y_factor[(int)dir], 0, 2); //!! constants
}
Commit: f974ea39ba3008ecc0c44671ff8cc3c9d5144b75
https://github.com/scummvm/scummvm/commit/f974ea39ba3008ecc0c44671ff8cc3c9d5144b75
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-17T14:58:55+09:00
Commit Message:
ULTIMA8: Remove direction factors which are no longer used
Changed paths:
engines/ultima/ultima8/misc/direction_util.h
diff --git a/engines/ultima/ultima8/misc/direction_util.h b/engines/ultima/ultima8/misc/direction_util.h
index 05a150a8dd..53d835bb39 100644
--- a/engines/ultima/ultima8/misc/direction_util.h
+++ b/engines/ultima/ultima8/misc/direction_util.h
@@ -37,11 +37,10 @@ namespace Ultima8 {
inline int Direction_XFactor(Direction dir) {
static const int _x_fact[] = { 0, +1, +1, +1, 0, -1, -1, -1 };
- //static const int _x_fact16[] = { 0, +1, +2, +2, +2, +2, +2, +1, 0, -1, -2, -2, -2, -2, -2, -1 };
- // TODO: AnimPrimitiveProcess uses the below table.. what's the other table for?
- // (same for y)
static const int _x_fact16[] = { 0, +1, +1, +2, +1, +2, +1, +1, 0, -1, -1, -2, -1, -2, -1, -1, 0 };
+ assert((int)dir >= 0 && (int)dir < 16);
+
if (GAME_IS_U8)
return _x_fact[(int)dir / 2];
else
@@ -50,9 +49,10 @@ inline int Direction_XFactor(Direction dir) {
inline int Direction_YFactor(Direction dir) {
static const int _y_fact[] = { -1, -1, 0, +1, +1, +1, 0, -1 };
- //static const int _y_fact16[] = { -2, -2, -2, -1, 0, +1, +2, +2, +2, +2, +2, +1, 0, -1, -2, -2 };
static const int _y_fact16[] = { -1, -2, -1, -1, 0, +1, +1, +2, +1, +2, +1, +1, 0, -1, -1, -2, 0 };
+ assert((int)dir >= 0 && (int)dir < 16);
+
if (GAME_IS_U8)
return _y_fact[(int)dir / 2];
else
Commit: 2e29f9fed98530b8365d43042b91dfc00704b028
https://github.com/scummvm/scummvm/commit/2e29f9fed98530b8365d43042b91dfc00704b028
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2021-04-17T15:14:23+09:00
Commit Message:
ULTIMA8: Disable position interpolation by default in Crusader
Changed paths:
engines/ultima/ultima8/ultima8.cpp
engines/ultima/ultima8/world/actors/actor_anim_process.cpp
engines/ultima/ultima8/world/actors/actor_anim_process.h
diff --git a/engines/ultima/ultima8/ultima8.cpp b/engines/ultima/ultima8/ultima8.cpp
index a005bba73a..7801415111 100644
--- a/engines/ultima/ultima8/ultima8.cpp
+++ b/engines/ultima/ultima8/ultima8.cpp
@@ -374,7 +374,8 @@ bool Ultima8Engine::startupGame() {
ConfMan.registerDefault("font_antialiasing", true);
ConfMan.registerDefault("frameSkip", false);
ConfMan.registerDefault("frameLimit", true);
- ConfMan.registerDefault("interpolate", true);
+ // Position interpolation looks nice on U8, but causes Crusader to look janky.
+ ConfMan.registerDefault("interpolate", _gameInfo->_type == GameInfo::GAME_U8);
ConfMan.registerDefault("cheat", false);
bool loaded = _game->loadFiles();
diff --git a/engines/ultima/ultima8/world/actors/actor_anim_process.cpp b/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
index 5aacd24527..4d582ce2a6 100644
--- a/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
+++ b/engines/ultima/ultima8/world/actors/actor_anim_process.cpp
@@ -55,14 +55,14 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(ActorAnimProcess)
ActorAnimProcess::ActorAnimProcess() : Process(), _tracker(nullptr),
_dir(dir_north), _action(Animation::walk), _steps(0), _firstFrame(true),
_currentStep(0), _repeatCounter(0), _animAborted(false),
- _attackedSomething(false) {
+ _attackedSomething(false), _interpolate(false) {
}
ActorAnimProcess::ActorAnimProcess(Actor *actor, Animation::Sequence action,
Direction dir, uint32 steps) :
_dir(dir), _action(action), _steps(steps), _tracker(nullptr),
_firstFrame(true), _currentStep(0), _repeatCounter(0),
- _animAborted(false), _attackedSomething(false) {
+ _animAborted(false), _attackedSomething(false), _interpolate(false) {
assert(actor);
_itemNum = actor->getObjId();
@@ -74,6 +74,8 @@ bool ActorAnimProcess::init() {
_animAborted = false;
_attackedSomething = false;
+ _interpolate = ConfMan.getBool("interpolate");
+
Actor *actor = getActor(_itemNum);
assert(actor);
@@ -281,18 +283,29 @@ void ActorAnimProcess::run() {
int32 x, y, z, x2, y2, z2;
a->getLocation(x, y, z);
- _tracker->getInterpolatedPosition(x2, y2, z2, _repeatCounter);
- if (x == x2 && y == y2 && z == z2) {
- _tracker->getInterpolatedPosition(x, y, z, _repeatCounter + 1);
- a->collideMove(x, y, z, false, true); // forced move
- a->setFrame(_tracker->getFrame());
- } else {
+
+ if (_interpolate) {
+ // Apply interpolated position on repeated frames
+ _tracker->getInterpolatedPosition(x2, y2, z2, _repeatCounter);
+ if (x == x2 && y == y2 && z == z2) {
+ _tracker->getInterpolatedPosition(x, y, z, _repeatCounter + 1);
+ a->collideMove(x, y, z, false, true); // forced move
+ a->setFrame(_tracker->getFrame());
#ifdef WATCHACTOR
- if (_itemNum == watchactor) {
- pout << "Animation [" << Kernel::get_instance()->getFrameNum()
- << "] moved, so aborting this frame." << Std::endl;
+ } else {
+ if (_itemNum == watchactor) {
+ pout << "Animation [" << Kernel::get_instance()->getFrameNum()
+ << "] moved, so aborting this frame." << Std::endl;
+ }
+#endif // WATCHACTOR
+ }
+ } else {
+ // Just move the whole distance on frame 0 of the repeat.
+ if (_repeatCounter == 0) {
+ _tracker->getPosition(x2, y2, z2);
+ a->collideMove(x2, y2, z2, false, true); // forced move
+ a->setFrame(_tracker->getFrame());
}
-#endif
}
// Did we just leave the fast area?
diff --git a/engines/ultima/ultima8/world/actors/actor_anim_process.h b/engines/ultima/ultima8/world/actors/actor_anim_process.h
index c161110511..8de86b1c64 100644
--- a/engines/ultima/ultima8/world/actors/actor_anim_process.h
+++ b/engines/ultima/ultima8/world/actors/actor_anim_process.h
@@ -84,6 +84,9 @@ protected:
bool _animAborted;
bool _attackedSomething; // attacked and hit something with this animation
+
+ //! Interpolate position on repeated frames
+ bool _interpolate;
};
} // End of namespace Ultima8
More information about the Scummvm-git-logs
mailing list