aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudvig Strigeus2001-12-29 12:45:54 +0000
committerLudvig Strigeus2001-12-29 12:45:54 +0000
commit0e66f425818e9b915392a22b5711f6c2bcd7d01d (patch)
treeabb60ead32d0f263dbbc3a495e9547d214aedfb5
parent11312eba66f196bb95d1613a7ca742bcad2b1e53 (diff)
downloadscummvm-rg350-0e66f425818e9b915392a22b5711f6c2bcd7d01d.tar.gz
scummvm-rg350-0e66f425818e9b915392a22b5711f6c2bcd7d01d.tar.bz2
scummvm-rg350-0e66f425818e9b915392a22b5711f6c2bcd7d01d.zip
fixed two bugs in indy4.
actors were facing in the wrong direction on the stairs, actors moved strangely in monte carlo svn-id: r3538
-rw-r--r--actor.cpp11
-rw-r--r--object.cpp4
-rw-r--r--sdl.cpp17
3 files changed, 25 insertions, 7 deletions
diff --git a/actor.cpp b/actor.cpp
index a7673ac08d..e5c7769731 100644
--- a/actor.cpp
+++ b/actor.cpp
@@ -162,6 +162,7 @@ int Scumm::calcMovementFactor(Actor *a, int newX, int newY) {
int Scumm::remapDirection(Actor *a, int dir) {
int specdir;
byte flags;
+ byte dirflag;
if (!a->ignoreBoxes) {
specdir = _extraBoxFlags[a->walkbox];
@@ -174,20 +175,26 @@ int Scumm::remapDirection(Actor *a, int dir) {
}
flags = getBoxFlags(a->walkbox);
+
+ dirflag = ((a->walkdata.XYFactor>0) ? 1 : 0) |
+ ((a->walkdata.YXFactor>0) ? 2 : 0);
+
if ((flags&8) || getClass(a->number, 0x1E)) {
dir = 360 - dir;
+ dirflag ^= 1;
}
if ((flags&0x10) || getClass(a->number, 0x1D)) {
dir = 180 - dir;
+ dirflag ^= 2;
}
switch(flags & 7) {
case 1:
- return a->walkdata.XYFactor >0 ? 90 : 270;
+ return (dirflag&1) ? 90 : 270;
case 2:
- return a->walkdata.YXFactor >0 ? 180 : 0;
+ return (dirflag&2) ? 180 : 0;
case 3: return 270;
case 4: return 90;
case 5: return 0;
diff --git a/object.cpp b/object.cpp
index 98c1f43407..2b6fcec46f 100644
--- a/object.cpp
+++ b/object.cpp
@@ -152,8 +152,8 @@ void Scumm::getObjectXYPos(int object) {
x = od->x_pos + (int16)READ_LE_UINT16(&imhd->hotspot[state].x);
y = od->y_pos + (int16)READ_LE_UINT16(&imhd->hotspot[state].y);
} else {
- x = od->walk_x;
- y = od->walk_y;
+ x = (int16)READ_LE_UINT16(&od->walk_x);
+ y = (int16)READ_LE_UINT16(&od->walk_y);
}
// abr = adjustXYToBeInBox(0, x, y);
diff --git a/sdl.cpp b/sdl.cpp
index aecfa61b26..f1e1c89d0c 100644
--- a/sdl.cpp
+++ b/sdl.cpp
@@ -287,6 +287,18 @@ void blitToScreen(Scumm *s, byte *src,int x, int y, int w, int h) {
#else
dst = (byte*)screen->pixels + y*640*2 + x*2;
addDirtyRect(x,y,w,h);
+#ifdef DEBUG_CODE
+ byte black = GetAsyncKeyState(VK_SHIFT)<0 ? 0 : 0xFF;
+ do {
+ i=0;
+ do {
+ dst[i*2] = dst[i*2+1] = src[i] & black;
+ } while (++i!=w);
+ memcpy(dst+640, dst, w*2);
+ dst += 640*2;
+ src += 320;
+ } while (--h);
+#else
do {
i=0;
do {
@@ -296,7 +308,7 @@ void blitToScreen(Scumm *s, byte *src,int x, int y, int w, int h) {
dst += 640*2;
src += 320;
} while (--h);
-
+#endif
#endif
SDL_UnlockSurface(screen);
@@ -326,7 +338,7 @@ void updateScreen(Scumm *s) {
int area = 0,i;
for (i=0; i<numDirtyRects; i++)
area += (dirtyRects[i].w * dirtyRects[i].h);
- debug(2,"update area %f %%", (float)area/640);
+ debug(2,"update area %f %%", (float)area/(640*400/100));
#endif
SDL_UpdateRects(screen, numDirtyRects, dirtyRects);
@@ -500,7 +512,6 @@ void initGraphics(Scumm *s, bool fullScreen) {
/* Create Music Thread */
SDL_CreateThread((int (*)(void *))&music_thread, &scumm);
}
-
#if !defined(SCALEUP_2x2)