diff options
author | Vincent Hamm | 2002-03-06 09:40:21 +0000 |
---|---|---|
committer | Vincent Hamm | 2002-03-06 09:40:21 +0000 |
commit | 474c9e333b81280e2c450f07e81eb1cc19ea89b5 (patch) | |
tree | a1bfb15807fb807855953d385f2313117cdf88a9 | |
parent | c7d58aca8485eff7309af22eefee6398ce136159 (diff) | |
download | scummvm-rg350-474c9e333b81280e2c450f07e81eb1cc19ea89b5.tar.gz scummvm-rg350-474c9e333b81280e2c450f07e81eb1cc19ea89b5.tar.bz2 scummvm-rg350-474c9e333b81280e2c450f07e81eb1cc19ea89b5.zip |
Reimplemented the preliminary Dig features. Implemented actor with many direction. Fixed bomp bug
svn-id: r3661
-rw-r--r-- | actor.cpp | 11 | ||||
-rw-r--r-- | akos.cpp | 35 | ||||
-rw-r--r-- | gfx.cpp | 175 | ||||
-rw-r--r-- | object.cpp | 2 | ||||
-rw-r--r-- | script_v2.cpp | 11 | ||||
-rw-r--r-- | scumm.h | 39 | ||||
-rw-r--r-- | scummvm.cpp | 17 |
7 files changed, 181 insertions, 109 deletions
@@ -21,6 +21,7 @@ #include "stdafx.h" #include "scumm.h" +#include "math.h" void Scumm::initActor(Actor *a, int mode) { if (mode==1) { @@ -153,8 +154,14 @@ int Scumm::calcMovementFactor(Actor *a, int newX, int newY) { a->walkdata.YXFactor = YXFactor; a->walkdata.xfrac = 0; a->walkdata.yfrac = 0; - - a->newDirection = getAngleFromPos(XYFactor, YXFactor); + + if(_gameId==GID_DIG) { + float temp; + temp = atan2 (XYFactor, -YXFactor); + a->newDirection = normalizeAngle(temp * 1.8e2 / 3.14); + } else { + a->newDirection = getAngleFromPos(XYFactor, YXFactor); + } return actorWalkStep(a); } @@ -35,10 +35,39 @@ bool Scumm::akos_hasManyDirections(Actor *a) { return 0; } +int Scumm::akos_findManyDirection(int16 ManyDirection, uint16 facing) +{ + int32 direction; + int32 temp; + int32 temp_facing; + temp=many_direction_tab[ManyDirection]; + direction=temp + ManyDirection * 8; + do{ + if(facing>=many_direction_tab[direction+1]) + { + if(facing<=many_direction_tab[direction+2]) + { + return(temp); + } + } + + --temp; + --direction; + + }while(temp); + + return(temp); +} + int Scumm::akos_frameToAnim(Actor *a, int frame) { - if (akos_hasManyDirections(a)) { - error("akos_frameToAnim: hasManyDirections not supported"); + bool ManyDirection; + + ManyDirection = akos_hasManyDirections(a); + + if (ManyDirection){ + frame*=many_direction_tab[ManyDirection]; + return akos_findManyDirection(ManyDirection, a->facing) + frame; } else { return newDirToOldDir(a->facing) + frame * 4; } @@ -1082,11 +1111,9 @@ bool Scumm::akos_compare(int a, int b, byte cmd) { } int Scumm::getAnimVar(Actor *a, byte var) { - assert(var>=0 && var<=15); return a->animVariable[var]; } void Scumm::setAnimVar(Actor *a, byte var, int value) { - assert(var>=0 && var<=15); a->animVariable[var] = value; } @@ -37,8 +37,11 @@ void Scumm::getGraphicsPerformance() { } _vars[VAR_PERFORMANCE_2] = 0;//_scummTimer; - - initScreens(0, 16, 320, 144); + + if(_gameId == GID_DIG) + initScreens(0, 0, 320, 200); + else + initScreens(0, 16, 320, 144); } void Scumm::initScreens(int a, int b, int w, int h) { @@ -2318,92 +2321,92 @@ int Scumm::remapPaletteColor(int r, int g, int b, uint threshold) { } void Scumm::drawBomp(BompDrawData *bd) { - byte *dest = bd->out + bd->y * bd->outwidth, *src; - int h = bd->srcheight; - bool inside; - - if (h==0 || bd->srcwidth==0) - return; - - inside = (bd->x>=0) && (bd->y>=0) && - (bd->x <= bd->outwidth - bd->srcwidth) && - (bd->y <= bd->outheight - bd->srcheight); - - - if (1 || bd->scale_x==255 && bd->scale_y==255) { - /* Routine used when no scaling is needed */ - if (inside) { - dest += bd->x; - src = bd->dataptr; - do { - byte code,color; - uint len = bd->srcwidth, num, i; - byte *d = dest; - src += 2; - do { - code = *src++; - num = (code>>1)+1; - if (num>len) num=len; - len -= num; - if (code&1) { - color = *src++; - if (color!=255) { - do *d++ = color; while (--num); - } else { - d += num; - } - } else { - for(i=0;i<num; i++) - if ( (color=src[i]) != 255) - d[i] = color; - d += num; - src += num; - } - } while (len); - dest += bd->outwidth; - } while (--h); + byte *dest = bd->out + bd->y * bd->outwidth, *src; + int h = bd->srcheight; + bool inside; + + if (h==0 || bd->srcwidth==0) + return; + + inside = (bd->x>=0) && (bd->y>=0) && + (bd->x <= bd->outwidth - bd->srcwidth) && + (bd->y <= bd->outheight - bd->srcheight); + + if (1 || bd->scale_x==255 && bd->scale_y==255) { + /* Routine used when no scaling is needed */ + if (inside) { + dest += bd->x; + src = bd->dataptr; + do { + byte code,color; + uint len = bd->srcwidth, num, i; + byte *d = dest; + src += 2; + do { + code = *src++; + num = (code>>1)+1; + if (num>len) num=len; + len -= num; + if (code&1) { + color = *src++; + if (color!=255) { + do *d++ = color; while (--num); + } else { + d += num; + } + } else { + for(i=0;i<num; i++) + if ( (color=src[i]) != 255) + d[i] = color; + d += num; + src += num; + } + } while (len); + dest += bd->outwidth; + } while (--h); } else { - uint y = bd->y; - src = bd->dataptr; + uint y = bd->y; + src = bd->dataptr; + + do { + byte color,code; + uint len, num; + uint x; + if ((uint)y >= (uint)bd->outheight) { + src += READ_LE_UINT16(src) + 2; + continue; + } + len = bd->srcwidth; + x = bd->x; + + src += 2; + do { + byte code = *src++; + num = (code>>1)+1; + if (num>len) num=len; + len -= num; + if (code&1) { + if ((color = *src++)!=255) { + do { + if ((uint)x < (uint)bd->outwidth) + dest[x] = color; + } while (++x,--num); + } else { + x += num; + } + } else { + do { + if ((color=*src++) != 255 && (uint)x < (uint)bd->outwidth) + dest[x] = color; + } while (++x,--num); + } + } while (len); + } while (dest += bd->outwidth,y++,--h); + } + } else { + /* scaling of bomp images not supported yet */ + } - do { - byte color; - uint len, num; - uint x; - if ((uint)y >= (uint)bd->outheight) { - src += READ_LE_UINT16(src) + 2; - continue; - } - len = bd->srcwidth; - x = bd->x; - - src += 2; - do { - byte code = *src++; - num = (code>>1)+1; - if (num>len) num=len; - len -= num; - if (code&1) { - if ((color = *src++)!=255) { - do { - if ((uint)x < (uint)bd->outwidth) - dest[x] = color; - } while (++x,--num); - } else { - x += num; - } - } else { - do { - if ((color=*src++) != 255 && (uint)x < (uint)bd->outwidth) - dest[x] = color; - } while (++x,--num); - } - } while (len); - } while (dest += bd->outwidth,y++,--h); - } - } else { - /* scaling of bomp images not supported yet */ - } CHECK_HEAP } diff --git a/object.cpp b/object.cpp index efb7602fa8..84595dc463 100644 --- a/object.cpp +++ b/object.cpp @@ -1165,7 +1165,7 @@ void Scumm::drawEnqueuedObject(EnqueuedObject *eo) { bdd.out = getResourceAddress(rtBuffer, vs->number+1) + vs->xstart; bdd.outwidth = 320; bdd.outheight = vs->height; - bdd.dataptr = bomp + 18; + bdd.dataptr = bomp + 10; bdd.x = eo->x; bdd.y = eo->y; bdd.scale_x = (unsigned char)eo->j; diff --git a/script_v2.cpp b/script_v2.cpp index 9f0f70d295..e359af629c 100644 --- a/script_v2.cpp +++ b/script_v2.cpp @@ -2692,6 +2692,17 @@ void Scumm::o6_kernelFunction() { a = derefActorSafe(args[1], "o6_kernelFunction:212"); push(a->frame); break; + case 215: + if(_extraBoxFlags[args[1]]&0x00FF==0x00C0) + { + push(_extraBoxFlags[args[1]]); + } + else + { + byte* temp = (byte*)getBoxBaseAddr(args[1]); + push((byte)(*(temp+17))); + } + break; default: error("o6_kernelFunction: default case %d", args[0]); } @@ -43,6 +43,43 @@ enum { NUM_ACTORS = 30 }; +const uint16 many_direction_tab[18] = { + 4, + 8, + 71, + 109, + 251, + 530, + 0, + 0, + 0, + 0, + 22, + 72, + 107, + 157, + 202, + 252, + 287, + 337 }; + +const int16 many_direction_tab_2 [16] = { + 0, + 90, + 180, + 270, + -1, + -1, + -1, + -1, + 0, + 45, + 90, + 135, + 180, + 225, + 270, + 315 }; struct Point { int x,y; @@ -796,6 +833,8 @@ struct Scumm { char *_exe_name; char *_gameDataPath; + int akos_findManyDirection(int16 ManyDirection, uint16 facing); + byte _saveLoadFlag; byte _saveLoadSlot; bool _saveLoadCompatible; diff --git a/scummvm.cpp b/scummvm.cpp index 87483a2af1..82321e48c1 100644 --- a/scummvm.cpp +++ b/scummvm.cpp @@ -1117,21 +1117,6 @@ int Scumm::oldDirToNewDir(int dir) { } -const uint16 many_direction_tab[18] = { - 71, 109, 251, 530, - 0, - 0, - 0, - 0, - 22,72,107, - 157, - 202, - 252, - 287, - 337 -}; - - int Scumm::numSimpleDirDirections(int dirType) { return dirType ? 8 : 4; } @@ -1139,7 +1124,7 @@ int Scumm::numSimpleDirDirections(int dirType) { /* Convert an angle to a simple direction */ int Scumm::toSimpleDir(int dirType, int dir) { int num = dirType ? 8 : 4, i; - const uint16 *dirtab = &many_direction_tab[dirType*8]; + const uint16 *dirtab = &many_direction_tab[dirType*8+2]; for(i=1;i<num;i++,dirtab++) { if (dir >= dirtab[0] && dir <= dirtab[1]) return i; |