diff options
-rw-r--r-- | actor.cpp | 30 | ||||
-rw-r--r-- | costume.cpp | 15 | ||||
-rw-r--r-- | object.cpp | 27 | ||||
-rw-r--r-- | scumm.h | 27 | ||||
-rw-r--r-- | scummsys.h | 9 | ||||
-rw-r--r-- | scummvm.cpp | 11 |
6 files changed, 69 insertions, 50 deletions
@@ -17,8 +17,13 @@ * * Change Log: * $Log$ - * Revision 1.1 2001/10/09 14:30:14 strigeus - * Initial revision + * Revision 1.2 2001/10/09 18:35:02 strigeus + * fixed object parent bug + * fixed some signed/unsigned comparisons + * + * Revision 1.1.1.1 2001/10/09 14:30:14 strigeus + * + * initial revision * * */ @@ -56,7 +61,7 @@ void Scumm::initActor(Actor *a, int mode) { _classData[a->number] = 0; } -void Scumm::setActorWalkSpeed(Actor *a, int speedx, int speedy) { +void Scumm::setActorWalkSpeed(Actor *a, uint speedx, uint speedy) { if (speedx == a->speedx && speedy == a->speedy) return; @@ -72,7 +77,6 @@ int Scumm::calcMovementFactor(Actor *a, int newX, int newY) { int actorX, actorY; int diffX, diffY; int32 XYFactor, YXFactor; - int32 tmp; actorX = a->x; actorY = a->y; @@ -94,11 +98,7 @@ int Scumm::calcMovementFactor(Actor *a, int newX, int newY) { YXFactor = 0; } - tmp = XYFactor >> 16; - if (tmp<0) - tmp = -tmp; - - if (tmp > a->speedx) { + if ((uint)abs(XYFactor >> 16) > a->speedx) { XYFactor = a->speedx<<16; if (diffX < 0) XYFactor = -XYFactor; @@ -449,7 +449,7 @@ int Scumm::getActorXYPos(Actor *a) { AdjustBoxResult Scumm::adjustXYToBeInBox(Actor *a, int x, int y) { AdjustBoxResult abr,tmp; - int threshold; + uint threshold; uint best; int box; byte flags, b; @@ -515,8 +515,8 @@ void Scumm::adjustActorPos(Actor *a) { a->x = abr.x; a->y = abr.y; - a->walkbox = abr.dist; /* not a dist */ - a->walkdata.destbox = abr.dist; + a->walkbox = (byte)abr.dist; /* not a dist */ + a->walkdata.destbox = (byte)abr.dist; a->mask = getMaskFromBox(abr.dist); a->walkdata.destx = -1; setupActorScale(a); @@ -748,7 +748,7 @@ void Scumm::setupCostumeRenderer(CostumeRenderer *c, Actor *a) { c->_actorY = a->y - a->elevation; c->_zbuf = a->mask; if (c->_zbuf > _numZBuffer) - c->_zbuf = _numZBuffer; + c->_zbuf = (byte)_numZBuffer; if (a->neverZClip) c->_zbuf = a->neverZClip; @@ -863,7 +863,7 @@ void Scumm::actorTalk() { return; if (vm.vars[VAR_TALK_ACTOR]>0x7F) { - _charsetColor = _stringColor[0]; + _charsetColor = (byte)_stringColor[0]; } else { a = derefActorSafe(vm.vars[VAR_TALK_ACTOR], "actorTalk(2)"); _charsetColor = a->talkColor; @@ -939,7 +939,7 @@ void Scumm::startWalkActor(Actor *a, int x, int y, int dir) { a->walkdata.destx = abr.x; a->walkdata.desty = abr.y; - a->walkdata.destbox = abr.dist; /* a box */ + a->walkdata.destbox = (byte)abr.dist; /* a box */ a->walkdata.destdir = dir; a->moving = (a->moving&2)|1; a->walkdata.curbox = a->walkbox; diff --git a/costume.cpp b/costume.cpp index 6fa98e8165..0cc6a68068 100644 --- a/costume.cpp +++ b/costume.cpp @@ -17,8 +17,13 @@ * * Change Log: * $Log$ - * Revision 1.1 2001/10/09 14:30:14 strigeus - * Initial revision + * Revision 1.2 2001/10/09 18:35:02 strigeus + * fixed object parent bug + * fixed some signed/unsigned comparisons + * + * Revision 1.1.1.1 2001/10/09 14:30:14 strigeus + * + * initial revision * * */ @@ -195,7 +200,7 @@ byte CostumeRenderer::mainRoutine(Actor *a, int slot, int frame) { _vscreenheight = _vm->virtscr[0].height; _vm->updateDirtyRect(0, _left, _right+1,_top,_bottom,1<<a->number); - if ((int)_top >= (int)_vscreenheight || _bottom <= 0) { + if (_top >= (int)_vscreenheight || _bottom <= 0) { checkHeap(); return 0; } @@ -241,10 +246,10 @@ byte CostumeRenderer::mainRoutine(Actor *a, int slot, int frame) { } } - if (_top > _vscreenheight || _top < 0) + if ((uint)_top > (uint)_vscreenheight || _top < 0) _top = 0; - if (_bottom > _vscreenheight) + if ((uint)_bottom > _vscreenheight) _bottom = _vscreenheight; if (a->top > _top) diff --git a/object.cpp b/object.cpp index 6590d0ffaa..e47b2239e2 100644 --- a/object.cpp +++ b/object.cpp @@ -17,8 +17,13 @@ * * Change Log: * $Log$ - * Revision 1.1 2001/10/09 14:30:14 strigeus - * Initial revision + * Revision 1.2 2001/10/09 18:35:02 strigeus + * fixed object parent bug + * fixed some signed/unsigned comparisons + * + * Revision 1.1.1.1 2001/10/09 14:30:14 strigeus + * + * initial revision * * */ @@ -174,8 +179,8 @@ int Scumm::findObject(int x, int y) { continue; b = i; do { - a = objs[b].cdhd_0e; - b = objs[b].cdhd_0f; + a = objs[b].parentstate; + b = objs[b].parent; if (b==0) { if (objs[i].x_pos <= (x>>3) && objs[i].numstrips + objs[i].x_pos > (x>>3) && @@ -203,12 +208,12 @@ void Scumm::drawRoomObjects(int arg) { continue; do { - a = od->cdhd_0e; - if (!od->cdhd_0f) { + a = od->parentstate; + if (!od->parent) { drawObject(num, arg); break; } - od = &objs[od->cdhd_0f]; + od = &objs[od->parent]; } while ((od->ownerstate & 0xF0)==a); } while (--num); @@ -364,12 +369,12 @@ void Scumm::loadRoomObjects() { objs[i].x_pos = cdhd->x; objs[i].y_pos = cdhd->y; - if (!(cdhd->flags&0x80)) { - objs[i].cdhd_0e = 0x10; + if (cdhd->flags == 0x80) { + objs[i].parentstate = 1<<4; } else { - objs[i].cdhd_0e = cdhd->flags; + objs[i].parentstate = (cdhd->flags&0xF)<<4; } - objs[i].cdhd_0f = cdhd->unk1; + objs[i].parent = cdhd->unk1; objs[i].cdhd_10 = READ_LE_UINT16(&cdhd->unk2); objs[i].cdhd_12 = READ_LE_UINT16(&cdhd->unk3); objs[i].actordir = cdhd->unk4; @@ -17,23 +17,20 @@ * * Change Log: * $Log$ + * Revision 1.3 2001/10/09 18:35:02 strigeus + * fixed object parent bug + * fixed some signed/unsigned comparisons + * * Revision 1.2 2001/10/09 17:38:20 strigeus * Autodetection of endianness. * * Revision 1.1.1.1 2001/10/09 14:30:12 strigeus - * * initial revision * - * */ #include "scummsys.h" -#ifdef WIN32 -#pragma warning (disable: 4018) -#pragma warning (disable: 4244) -#endif - #define SWAP(a,b) do{int tmp=a; a=b; b=tmp; } while(0) #define BYPASS_COPY_PROT @@ -143,8 +140,8 @@ struct ObjectData { byte numstrips; byte height; byte actordir; - byte cdhd_0f; - byte cdhd_0e; + byte parentstate; + byte parent; byte ownerstate; byte fl_object_index; byte unk_3; @@ -289,7 +286,7 @@ struct CharsetRenderer { int _drawTop; int _left, _left2; byte _center; - uint _right; + int _right; byte _color; bool _hasMask; @@ -379,9 +376,9 @@ struct CostumeRenderer { }; struct Actor { - int16 x,y,top,bottom; - int16 elevation; - uint16 width; + int x,y,top,bottom; + int elevation; + uint width; byte number; byte facing; byte costume; @@ -395,7 +392,7 @@ struct Actor { byte neverZClip; byte initFrame,walkFrame,standFrame,talkFrame1,talkFrame2; bool needRedraw, needBgReset,costumeNeedsInit,visible; - uint16 speedx,speedy; + uint speedx,speedy; byte data8; /* unused */ byte animIndex; byte walkbox; @@ -827,7 +824,7 @@ struct Scumm { void initActor(Actor *a, int mode); bool checkFixedDisk(); - void setActorWalkSpeed(Actor *a, int speed1, int speed2); + void setActorWalkSpeed(Actor *a, uint speed1, uint speed2); int calcMovementFactor(Actor *a, int newx, int newy); int actorWalkStep(Actor *a); int getProgrDirChange(Actor *a, int mode); diff --git a/scummsys.h b/scummsys.h index 7002994999..e1513f6372 100644 --- a/scummsys.h +++ b/scummsys.h @@ -17,11 +17,14 @@ * * Change Log: * $Log$ + * Revision 1.3 2001/10/09 18:35:02 strigeus + * fixed object parent bug + * fixed some signed/unsigned comparisons + * * Revision 1.2 2001/10/09 17:38:20 strigeus * Autodetection of endianness. * * Revision 1.1.1.1 2001/10/09 14:30:14 strigeus - * * initial revision * * @@ -29,6 +32,10 @@ #if defined(WIN32) +#pragma warning (disable: 4244) +#pragma warning (disable: 4101) + + #define SCUMM_LITTLE_ENDIAN #define FORCEINLINE __forceinline diff --git a/scummvm.cpp b/scummvm.cpp index 5e5de9a0fa..a9e0dc9320 100644 --- a/scummvm.cpp +++ b/scummvm.cpp @@ -17,8 +17,13 @@ * * Change Log: * $Log$ - * Revision 1.1 2001/10/09 14:30:13 strigeus - * Initial revision + * Revision 1.2 2001/10/09 18:35:02 strigeus + * fixed object parent bug + * fixed some signed/unsigned comparisons + * + * Revision 1.1.1.1 2001/10/09 14:30:13 strigeus + * + * initial revision * * */ @@ -209,7 +214,7 @@ void Scumm::scummMain() { _fileHandle = NULL; - _bootParam = 0; + _bootParam = 29; _debugMode = 1; initThings(); |