Reimplemented the preliminary Dig features. Implemented actor with many direction. Fixed bomp bug

svn-id: r3661
This commit is contained in:
Vincent Hamm 2002-03-06 09:40:21 +00:00
parent c7d58aca84
commit 474c9e333b
7 changed files with 177 additions and 105 deletions

View file

@ -21,6 +21,7 @@
#include "stdafx.h" #include "stdafx.h"
#include "scumm.h" #include "scumm.h"
#include "math.h"
void Scumm::initActor(Actor *a, int mode) { void Scumm::initActor(Actor *a, int mode) {
if (mode==1) { if (mode==1) {
@ -154,7 +155,13 @@ int Scumm::calcMovementFactor(Actor *a, int newX, int newY) {
a->walkdata.xfrac = 0; a->walkdata.xfrac = 0;
a->walkdata.yfrac = 0; a->walkdata.yfrac = 0;
if(_gameId==GID_DIG) {
float temp;
temp = atan2 (XYFactor, -YXFactor);
a->newDirection = normalizeAngle(temp * 1.8e2 / 3.14);
} else {
a->newDirection = getAngleFromPos(XYFactor, YXFactor); a->newDirection = getAngleFromPos(XYFactor, YXFactor);
}
return actorWalkStep(a); return actorWalkStep(a);
} }

View file

@ -35,10 +35,39 @@ bool Scumm::akos_hasManyDirections(Actor *a) {
return 0; 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) { int Scumm::akos_frameToAnim(Actor *a, int frame) {
if (akos_hasManyDirections(a)) { bool ManyDirection;
error("akos_frameToAnim: hasManyDirections not supported");
ManyDirection = akos_hasManyDirections(a);
if (ManyDirection){
frame*=many_direction_tab[ManyDirection];
return akos_findManyDirection(ManyDirection, a->facing) + frame;
} else { } else {
return newDirToOldDir(a->facing) + frame * 4; 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) { int Scumm::getAnimVar(Actor *a, byte var) {
assert(var>=0 && var<=15);
return a->animVariable[var]; return a->animVariable[var];
} }
void Scumm::setAnimVar(Actor *a, byte var, int value) { void Scumm::setAnimVar(Actor *a, byte var, int value) {
assert(var>=0 && var<=15);
a->animVariable[var] = value; a->animVariable[var] = value;
} }

View file

@ -38,6 +38,9 @@ void Scumm::getGraphicsPerformance() {
_vars[VAR_PERFORMANCE_2] = 0;//_scummTimer; _vars[VAR_PERFORMANCE_2] = 0;//_scummTimer;
if(_gameId == GID_DIG)
initScreens(0, 0, 320, 200);
else
initScreens(0, 16, 320, 144); initScreens(0, 16, 320, 144);
} }
@ -2329,7 +2332,6 @@ void Scumm::drawBomp(BompDrawData *bd) {
(bd->x <= bd->outwidth - bd->srcwidth) && (bd->x <= bd->outwidth - bd->srcwidth) &&
(bd->y <= bd->outheight - bd->srcheight); (bd->y <= bd->outheight - bd->srcheight);
if (1 || bd->scale_x==255 && bd->scale_y==255) { if (1 || bd->scale_x==255 && bd->scale_y==255) {
/* Routine used when no scaling is needed */ /* Routine used when no scaling is needed */
if (inside) { if (inside) {
@ -2367,7 +2369,7 @@ void Scumm::drawBomp(BompDrawData *bd) {
src = bd->dataptr; src = bd->dataptr;
do { do {
byte color; byte color,code;
uint len, num; uint len, num;
uint x; uint x;
if ((uint)y >= (uint)bd->outheight) { if ((uint)y >= (uint)bd->outheight) {
@ -2404,6 +2406,7 @@ void Scumm::drawBomp(BompDrawData *bd) {
} else { } else {
/* scaling of bomp images not supported yet */ /* scaling of bomp images not supported yet */
} }
CHECK_HEAP CHECK_HEAP
} }

View file

@ -1165,7 +1165,7 @@ void Scumm::drawEnqueuedObject(EnqueuedObject *eo) {
bdd.out = getResourceAddress(rtBuffer, vs->number+1) + vs->xstart; bdd.out = getResourceAddress(rtBuffer, vs->number+1) + vs->xstart;
bdd.outwidth = 320; bdd.outwidth = 320;
bdd.outheight = vs->height; bdd.outheight = vs->height;
bdd.dataptr = bomp + 18; bdd.dataptr = bomp + 10;
bdd.x = eo->x; bdd.x = eo->x;
bdd.y = eo->y; bdd.y = eo->y;
bdd.scale_x = (unsigned char)eo->j; bdd.scale_x = (unsigned char)eo->j;

View file

@ -2692,6 +2692,17 @@ void Scumm::o6_kernelFunction() {
a = derefActorSafe(args[1], "o6_kernelFunction:212"); a = derefActorSafe(args[1], "o6_kernelFunction:212");
push(a->frame); push(a->frame);
break; 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: default:
error("o6_kernelFunction: default case %d", args[0]); error("o6_kernelFunction: default case %d", args[0]);
} }

39
scumm.h
View file

@ -43,6 +43,43 @@ enum {
NUM_ACTORS = 30 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 { struct Point {
int x,y; int x,y;
@ -796,6 +833,8 @@ struct Scumm {
char *_exe_name; char *_exe_name;
char *_gameDataPath; char *_gameDataPath;
int akos_findManyDirection(int16 ManyDirection, uint16 facing);
byte _saveLoadFlag; byte _saveLoadFlag;
byte _saveLoadSlot; byte _saveLoadSlot;
bool _saveLoadCompatible; bool _saveLoadCompatible;

View file

@ -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) { int Scumm::numSimpleDirDirections(int dirType) {
return dirType ? 8 : 4; return dirType ? 8 : 4;
} }
@ -1139,7 +1124,7 @@ int Scumm::numSimpleDirDirections(int dirType) {
/* Convert an angle to a simple direction */ /* Convert an angle to a simple direction */
int Scumm::toSimpleDir(int dirType, int dir) { int Scumm::toSimpleDir(int dirType, int dir) {
int num = dirType ? 8 : 4, i; 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++) { for(i=1;i<num;i++,dirtab++) {
if (dir >= dirtab[0] && dir <= dirtab[1]) if (dir >= dirtab[0] && dir <= dirtab[1])
return i; return i;