[Scummvm-cvs-logs] scummvm master -> cd9a65f34058c838d5ed5900d8cc28e3a9692ecd
wjp
wjp at usecode.org
Thu Dec 8 20:39:41 CET 2011
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
cd9a65f340 DREAMWEB: Fix workoutFrames when walking off-screen
Commit: cd9a65f34058c838d5ed5900d8cc28e3a9692ecd
https://github.com/scummvm/scummvm/commit/cd9a65f34058c838d5ed5900d8cc28e3a9692ecd
Author: Willem Jan Palenstijn (wjp at usecode.org)
Date: 2011-12-08T11:37:54-08:00
Commit Message:
DREAMWEB: Fix workoutFrames when walking off-screen
This triggered the paranoia asserts.
Changed paths:
engines/dreamweb/pathfind.cpp
diff --git a/engines/dreamweb/pathfind.cpp b/engines/dreamweb/pathfind.cpp
index ee6ced7..bd7412f 100644
--- a/engines/dreamweb/pathfind.cpp
+++ b/engines/dreamweb/pathfind.cpp
@@ -280,20 +280,16 @@ void DreamBase::workoutFrames() {
byte tmp;
uint16 diffx, diffy;
- // FIXME: Paranoia asserts, to be removed after sufficient play
- // testing has happened. Background: The original code used to add
- // 32 to the four values listed in the asserts below. Which seems
- // nonsensical, as only the differences of the values matter, so the
- // +32 cancels out. Unless there is an overflow somewhere... So we
- // check for that here.
- assert(data.word(kLinestartx) < 0xFFFF - 32);
- assert(data.word(kLineendx) < 0xFFFF - 32);
- assert(data.word(kLinestarty) < 0xFFFF - 32);
- assert(data.word(kLineendy) < 0xFFFF - 32);
+ // We have to use signed arithmetic here because these values can
+ // be slightly negative when walking off-screen
+ int lineStartX = data.word(kLinestartx);
+ int lineStartY = data.word(kLinestarty);
+ int lineEndX = data.word(kLineendx);
+ int lineEndY = data.word(kLineendy);
- diffx = ABS(data.word(kLinestartx) - data.word(kLineendx));
- diffy = ABS(data.word(kLinestarty) - data.word(kLineendy));
+ diffx = ABS(lineStartX -lineEndX);
+ diffy = ABS(lineStartY - lineEndY);
if (diffx < diffy) {
tmp = 2;
@@ -306,9 +302,9 @@ void DreamBase::workoutFrames() {
tmp = 1;
}
- if (data.word(kLinestartx) >= data.word(kLineendx)) {
+ if (lineStartX >= lineEndX) {
// isinleft
- if (data.word(kLinestarty) < data.word(kLineendy)) {
+ if (lineStartY < lineEndY) {
if (tmp != 1)
tmp ^= 2;
tmp += 4;
@@ -318,7 +314,7 @@ void DreamBase::workoutFrames() {
}
} else {
// isinright
- if (data.word(kLinestarty) < data.word(kLineendy)) {
+ if (lineStartY < lineEndY) {
tmp += 2;
} else {
// botright
More information about the Scummvm-git-logs
mailing list