diff options
| -rw-r--r-- | 2xsai.cpp | 116 | ||||
| -rw-r--r-- | actor.cpp | 4 | ||||
| -rw-r--r-- | akos.cpp | 17 | ||||
| -rw-r--r-- | boxes.cpp | 88 | ||||
| -rw-r--r-- | costume.cpp | 99 | ||||
| -rw-r--r-- | debug.cpp | 32 | ||||
| -rw-r--r-- | object.cpp | 111 | ||||
| -rw-r--r-- | saveload.cpp | 46 | ||||
| -rw-r--r-- | script.cpp | 61 | ||||
| -rw-r--r-- | string.cpp | 36 | ||||
| -rw-r--r-- | sys.cpp | 26 | ||||
| -rw-r--r-- | verbs.cpp | 22 |
12 files changed, 275 insertions, 383 deletions
@@ -54,8 +54,7 @@ int Init_2xSaI(uint32 BitFormat) return 1; } -static inline int GetResult1(uint32 A, uint32 B, uint32 C, uint32 D, - uint32 /* E */ ) +static inline int GetResult1(uint32 A, uint32 B, uint32 C, uint32 D, uint32 /* E */ ) { int x = 0; int y = 0; @@ -76,8 +75,7 @@ static inline int GetResult1(uint32 A, uint32 B, uint32 C, uint32 D, return r; } -static inline int GetResult2(uint32 A, uint32 B, uint32 C, uint32 D, - uint32 /* E */ ) +static inline int GetResult2(uint32 A, uint32 B, uint32 C, uint32 D, uint32 /* E */ ) { int x = 0; int y = 0; @@ -122,8 +120,7 @@ static inline int GetResult(uint32 A, uint32 B, uint32 C, uint32 D) static inline uint32 INTERPOLATE(uint32 A, uint32 B) { if (A != B) { - return (((A & colorMask) >> 1) + ((B & colorMask) >> 1) + - (A & B & lowPixelMask)); + return (((A & colorMask) >> 1) + ((B & colorMask) >> 1) + (A & B & lowPixelMask)); } else return A; } @@ -131,8 +128,7 @@ static inline uint32 INTERPOLATE(uint32 A, uint32 B) static inline uint32 Q_INTERPOLATE(uint32 A, uint32 B, uint32 C, uint32 D) { register uint32 x = ((A & qcolorMask) >> 2) + - ((B & qcolorMask) >> 2) + - ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2); + ((B & qcolorMask) >> 2) + ((C & qcolorMask) >> 2) + ((D & qcolorMask) >> 2); register uint32 y = (A & qlowpixelMask) + (B & qlowpixelMask) + (C & qlowpixelMask) + (D & qlowpixelMask); @@ -149,8 +145,7 @@ static inline uint32 Q_INTERPOLATE(uint32 A, uint32 B, uint32 C, uint32 D) #define GREEN_MASK555 0x03E003E0 void Super2xSaI(uint8 *srcPtr, uint32 srcPitch, - uint8 *deltaPtr, uint8 *dstPtr, uint32 dstPitch, - int width, int height) + uint8 *deltaPtr, uint8 *dstPtr, uint32 dstPitch, int width, int height) { uint16 *bP; uint8 *dP; @@ -167,8 +162,7 @@ void Super2xSaI(uint8 *srcPtr, uint32 srcPitch, for (uint32 finish = width; finish; finish -= inc_bP) { uint32 color4, color5, color6; uint32 color1, color2, color3; - uint32 colorA0, colorA1, colorA2, colorA3, - colorB0, colorB1, colorB2, colorB3, colorS1, colorS2; + uint32 colorA0, colorA1, colorA2, colorA3, colorB0, colorB1, colorB2, colorB3, colorS1, colorS2; uint32 product1a, product1b, product2a, product2b; //--------------------------------------- B1 B2 @@ -217,41 +211,31 @@ void Super2xSaI(uint8 *srcPtr, uint32 srcPitch, product2b = product1b = INTERPOLATE(color5, color6); } } else { - if (color6 == color3 && color3 == colorA1 - && color2 != colorA2 && color3 != colorA0) + if (color6 == color3 && color3 == colorA1 && color2 != colorA2 && color3 != colorA0) product2b = Q_INTERPOLATE(color3, color3, color3, color2); - else if (color5 == color2 && color2 == colorA2 - && colorA1 != color3 && color2 != colorA3) + else if (color5 == color2 && color2 == colorA2 && colorA1 != color3 && color2 != colorA3) product2b = Q_INTERPOLATE(color2, color2, color2, color3); else product2b = INTERPOLATE(color2, color3); - if (color6 == color3 && color6 == colorB1 - && color5 != colorB2 && color6 != colorB0) + if (color6 == color3 && color6 == colorB1 && color5 != colorB2 && color6 != colorB0) product1b = Q_INTERPOLATE(color6, color6, color6, color5); - else if (color5 == color2 && color5 == colorB2 - && colorB1 != color6 && color5 != colorB3) + else if (color5 == color2 && color5 == colorB2 && colorB1 != color6 && color5 != colorB3) product1b = Q_INTERPOLATE(color6, color5, color5, color5); else product1b = INTERPOLATE(color5, color6); } - if (color5 == color3 && color2 != color6 && color4 == color5 - && color5 != colorA2) + if (color5 == color3 && color2 != color6 && color4 == color5 && color5 != colorA2) product2a = INTERPOLATE(color2, color5); - else - if (color5 == color1 && color6 == color5 - && color4 != color2 && color5 != colorA0) + else if (color5 == color1 && color6 == color5 && color4 != color2 && color5 != colorA0) product2a = INTERPOLATE(color2, color5); else product2a = color2; - if (color2 == color6 && color5 != color3 && color1 == color2 - && color2 != colorB2) + if (color2 == color6 && color5 != color3 && color1 == color2 && color2 != colorB2) product1a = INTERPOLATE(color2, color5); - else - if (color4 == color2 && color3 == color2 - && color1 != color5 && color2 != colorB0) + else if (color4 == color2 && color3 == color2 && color1 != color5 && color2 != colorB0) product1a = INTERPOLATE(color2, color5); else product1a = color5; @@ -420,8 +404,7 @@ void _2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr, register uint32 colorA, colorB; uint32 colorC, colorD, - colorE, colorF, colorG, colorH, - colorI, colorJ, colorK, colorL, colorM, colorN, colorO, colorP; + colorE, colorF, colorG, colorH, colorI, colorJ, colorK, colorL, colorM, colorN, colorO, colorP; uint32 product, product1, product2; //--------------------------------------- @@ -450,34 +433,34 @@ void _2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr, colorP = *(bP + Nextline + Nextline + 2); if ((colorA == colorD) && (colorB != colorC)) { - if (((colorA == colorE) && (colorB == colorL)) || - ((colorA == colorC) && (colorA == colorF) - && (colorB != colorE) && (colorB == colorJ))) { + if (((colorA == colorE) && (colorB == colorL)) || ((colorA == colorC) && (colorA == colorF) + && (colorB != colorE) + && (colorB == colorJ))) { product = colorA; } else { product = INTERPOLATE(colorA, colorB); } - if (((colorA == colorG) && (colorC == colorO)) || - ((colorA == colorB) && (colorA == colorH) - && (colorG != colorC) && (colorC == colorM))) { + if (((colorA == colorG) && (colorC == colorO)) || ((colorA == colorB) && (colorA == colorH) + && (colorG != colorC) + && (colorC == colorM))) { product1 = colorA; } else { product1 = INTERPOLATE(colorA, colorC); } product2 = colorA; } else if ((colorB == colorC) && (colorA != colorD)) { - if (((colorB == colorF) && (colorA == colorH)) || - ((colorB == colorE) && (colorB == colorD) - && (colorA != colorF) && (colorA == colorI))) { + if (((colorB == colorF) && (colorA == colorH)) || ((colorB == colorE) && (colorB == colorD) + && (colorA != colorF) + && (colorA == colorI))) { product = colorB; } else { product = INTERPOLATE(colorA, colorB); } - if (((colorC == colorH) && (colorA == colorF)) || - ((colorC == colorG) && (colorC == colorD) - && (colorA != colorH) && (colorA == colorI))) { + if (((colorC == colorH) && (colorA == colorF)) || ((colorC == colorG) && (colorC == colorD) + && (colorA != colorH) + && (colorA == colorI))) { product1 = colorC; } else { product1 = INTERPOLATE(colorA, colorC); @@ -537,10 +520,10 @@ void _2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 *deltaPtr, #endif #ifdef SCUMM_BIG_ENDIAN - product = (colorA<<16) | product; - product1 = (product1<<16) | product2; + product = (colorA << 16) | product; + product1 = (product1 << 16) | product2; #endif - *((int32 *) dP) = product; + *((int32 *)dP) = product; *((uint32 *)(dP + dstPitch)) = product1; bP += inc_bP; @@ -574,8 +557,7 @@ static uint32 Bilinear(uint32 A, uint32 B, uint32 x) } -static uint32 Bilinear4(uint32 A, uint32 B, uint32 C, uint32 D, uint32 x, - uint32 y) +static uint32 Bilinear4(uint32 A, uint32 B, uint32 C, uint32 D, uint32 x, uint32 y) { unsigned long areaA, areaB, areaC, areaD; unsigned long result, xy; @@ -732,21 +714,22 @@ void Scale_2xSaI(uint8 *srcPtr, uint32 srcPitch, uint8 * /* deltaPtr */ , } } -void AdvMame2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, int width, int height) +void AdvMame2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, + int width, int height) { unsigned int nextlineSrc = srcPitch / sizeof(short); - short* p = (short*)srcPtr; + short *p = (short *)srcPtr; unsigned nextlineDst = dstPitch / sizeof(short); - short* q = (short*)dstPtr; + short *q = (short *)dstPtr; while (height--) { - for(int i = 0; i < width; ++i) { + for (int i = 0; i < width; ++i) { // short A = *(p + i - nextlineSrc - 1); short B = *(p + i - nextlineSrc); // short C = *(p + i - nextlineSrc + 1); short D = *(p + i - 1); - short E = *(p + i ); + short E = *(p + i); short F = *(p + i + 1); // short G = *(p + i + nextlineSrc - 1); short H = *(p + i + nextlineSrc); @@ -764,14 +747,15 @@ void AdvMame2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint3 /* Beware! Contrary to the other functions in this file, this blits from 8 to 8 bit! */ -void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, int width, int height) +void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, + int width, int height) { - uint8* r; + uint8 *r; while (height--) { r = dstPtr; - for(int i = 0; i < width; ++i, ++r) { - uint8 color = *(srcPtr + i ); + for (int i = 0; i < width; ++i, ++r) { + uint8 color = *(srcPtr + i); *r = color; } @@ -781,14 +765,15 @@ void Normal1x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 } /* Beware! Contrary to the other functions in this file, this blits from 8 to 8 bit! */ -void Normal2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, int width, int height) +void Normal2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, + int width, int height) { - uint8* r; + uint8 *r; while (height--) { r = dstPtr; - for(int i = 0; i < width; ++i, r+=2) { - uint8 color = *(srcPtr + i ); + for (int i = 0; i < width; ++i, r += 2) { + uint8 color = *(srcPtr + i); *(r) = color; *(r + 1) = color; @@ -801,14 +786,15 @@ void Normal2x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 } /* Beware! Contrary to the other functions in this file, this blits from 8 to 8 bit! */ -void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, int width, int height) +void Normal3x(uint8 *srcPtr, uint32 srcPitch, uint8 *null, uint8 *dstPtr, uint32 dstPitch, + int width, int height) { - uint8* r; + uint8 *r; uint32 dstPitch2 = dstPitch << 1; while (height--) { r = dstPtr; - for(int i = 0; i < width; ++i, r+=3) { + for (int i = 0; i < width; ++i, r += 3) { uint8 color = *(srcPtr + i); *(r + 0) = color; @@ -515,7 +515,7 @@ void Actor::setActorDirection(int direction) needBgReset = true; } -void Scumm::putActor(Actor * a, int dstX, int dstY, byte room) +void Scumm::putActor(Actor *a, int dstX, int dstY, byte room) { if (a->visible && _currentRoom != room && _vars[VAR_TALK_ACTOR] == a->number) { clearMsgQueue(); @@ -547,7 +547,7 @@ void Scumm::putActor(Actor * a, int dstX, int dstY, byte room) } } -int Scumm::getActorXYPos(Actor * a) +int Scumm::getActorXYPos(Actor *a) { if (!a) return -1; @@ -24,7 +24,7 @@ #include "actor.h" #include "akos.h" -bool Scumm::akos_hasManyDirections(Actor * a) +bool Scumm::akos_hasManyDirections(Actor *a) { if (_features & GF_NEW_COSTUMES) { byte *akos; @@ -39,7 +39,7 @@ bool Scumm::akos_hasManyDirections(Actor * a) return 0; } -int Scumm::akos_frameToAnim(Actor * a, int frame) +int Scumm::akos_frameToAnim(Actor *a, int frame) { if (akos_hasManyDirections(a)) return toSimpleDir(1, a->facing) + frame * 8; @@ -47,7 +47,7 @@ int Scumm::akos_frameToAnim(Actor * a, int frame) return newDirToOldDir(a->facing) + frame * 4; } -void Scumm::akos_decodeData(Actor * a, int frame, uint usemask) +void Scumm::akos_decodeData(Actor *a, int frame, uint usemask) { uint anim; byte *akos, *r; @@ -153,7 +153,7 @@ void AkosRenderer::setCostume(int costume) codec = READ_LE_UINT16(&akhd->codec); } -void AkosRenderer::setFacing(Actor * a) +void AkosRenderer::setFacing(Actor *a) { mirror = (Scumm::newDirToOldDir(a->facing) != 0 || akhd->flags & 1); if (a->flip) @@ -786,8 +786,7 @@ void AkosRenderer::codec1() #if 0 - switch (((byte)y_clipping << 3) | ((byte)use_scaling << 2) | - ((byte)masking << 1) | (byte)charsetmask) { + switch (((byte)y_clipping << 3) | ((byte)use_scaling << 2) | ((byte)masking << 1) | (byte)charsetmask) { case 0: akos_c1_0_decode(this); break; @@ -923,7 +922,7 @@ void AkosRenderer::codec16() } -bool Scumm::akos_increaseAnims(byte *akos, Actor * a) +bool Scumm::akos_increaseAnims(byte *akos, Actor *a) { byte *aksq, *akfo; int i; @@ -948,7 +947,7 @@ bool Scumm::akos_increaseAnims(byte *akos, Actor * a) #define GUW(o) READ_LE_UINT16(aksq+curpos+(o)) #define GB(o) aksq[curpos+(o)] -bool Scumm::akos_increaseAnim(Actor * a, int chan, byte *aksq, uint16 *akfo, int numakfo) +bool Scumm::akos_increaseAnim(Actor *a, int chan, byte *aksq, uint16 *akfo, int numakfo) { byte active; uint old_curpos, curpos, end; @@ -1175,7 +1174,7 @@ bool Scumm::akos_increaseAnim(Actor * a, int chan, byte *aksq, uint16 *akfo, int return curpos != old_curpos; } -void Scumm::akos_queCommand(byte cmd, Actor * a, int param_1, int param_2) +void Scumm::akos_queCommand(byte cmd, Actor *a, int param_1, int param_2) { // warning("akos_queCommand(%d,%d,%d,%d)", cmd, a->number, param_1, param_2); } @@ -68,11 +68,11 @@ Box *Scumm::getBoxBaseAddr(int box) checkRange(ptr[0] - 1, 0, box, "Illegal box %d"); if (_features & GF_SMALL_HEADER) { if (_features & GF_OLD256) - return (Box *) (ptr + box * (SIZEOF_BOX - 2) + 1); + return (Box *)(ptr + box * (SIZEOF_BOX - 2) + 1); else - return (Box *) (ptr + box * SIZEOF_BOX + 1); + return (Box *)(ptr + box * SIZEOF_BOX + 1); } else - return (Box *) (ptr + box * SIZEOF_BOX + 2); + return (Box *)(ptr + box * SIZEOF_BOX + 2); } int Scumm::getSpecialBox(int param1, int param2) @@ -80,21 +80,20 @@ int Scumm::getSpecialBox(int param1, int param2) int i; int numOfBoxes; byte flag; - + numOfBoxes = getNumBoxes() - 1; - for(i=numOfBoxes;i>=0;i--) - { + for (i = numOfBoxes; i >= 0; i--) { flag = getBoxFlags(i); - if(!(flag & 0x80) && (flag & 0x20)) - return(-1); + if (!(flag & 0x80) && (flag & 0x20)) + return (-1); - if(checkXYInBoxBounds(i,param1,param2)) - return(i); + if (checkXYInBoxBounds(i, param1, param2)) + return (i); } - return(-1); + return (-1); } bool Scumm::checkXYInBoxBounds(int b, int x, int y) @@ -122,8 +121,7 @@ bool Scumm::checkXYInBoxBounds(int b, int x, int y) box.ul.y == box.ur.y && box.ll.x == box.lr.x && box.ll.y == box.lr.y || - box.ul.x == box.lr.x && - box.ul.y == box.lr.y && box.ur.x == box.ll.x && box.ur.y == box.ll.y) { + box.ul.x == box.lr.x && box.ul.y == box.lr.y && box.ur.x == box.ll.x && box.ur.y == box.ll.y) { ScummPoint pt; pt = closestPtOnLine(box.ul.x, box.ul.y, box.ll.x, box.ll.y, x, y); @@ -146,25 +144,25 @@ bool Scumm::checkXYInBoxBounds(int b, int x, int y) return 1; } -void Scumm::getBoxCoordinates(int boxnum, BoxCoords * box) +void Scumm::getBoxCoordinates(int boxnum, BoxCoords *box) { Box *bp = getBoxBaseAddr(boxnum); - box->ul.x = (int16) FROM_LE_16(bp->ulx); - box->ul.y = (int16) FROM_LE_16(bp->uly); - box->ur.x = (int16) FROM_LE_16(bp->urx); - box->ur.y = (int16) FROM_LE_16(bp->ury); + box->ul.x = (int16)FROM_LE_16(bp->ulx); + box->ul.y = (int16)FROM_LE_16(bp->uly); + box->ur.x = (int16)FROM_LE_16(bp->urx); + box->ur.y = (int16)FROM_LE_16(bp->ury); if (_features & GF_OLD256) { - box->ll.x = (int16) FROM_LE_16(bp->lrx); - box->ll.y = (int16) FROM_LE_16(bp->lry); - box->lr.x = (int16) FROM_LE_16(bp->llx); - box->lr.y = (int16) FROM_LE_16(bp->lly); + box->ll.x = (int16)FROM_LE_16(bp->lrx); + box->ll.y = (int16)FROM_LE_16(bp->lry); + box->lr.x = (int16)FROM_LE_16(bp->llx); + box->lr.y = (int16)FROM_LE_16(bp->lly); } else { - box->ll.x = (int16) FROM_LE_16(bp->llx); - box->ll.y = (int16) FROM_LE_16(bp->lly); - box->lr.x = (int16) FROM_LE_16(bp->lrx); - box->lr.y = (int16) FROM_LE_16(bp->lry); + box->ll.x = (int16)FROM_LE_16(bp->llx); + box->ll.y = (int16)FROM_LE_16(bp->lly); + box->lr.x = (int16)FROM_LE_16(bp->lrx); + box->lr.y = (int16)FROM_LE_16(bp->lry); } } @@ -187,8 +185,7 @@ uint Scumm::distanceFromPt(int x, int y, int ptx, int pty) return diffx + diffy; } -ScummPoint Scumm::closestPtOnLine(int ulx, int uly, int llx, int lly, int x, - int y) +ScummPoint Scumm::closestPtOnLine(int ulx, int uly, int llx, int lly, int x, int y) { int lydiff, lxdiff; int32 dist, a, b, c; @@ -377,7 +374,7 @@ int Scumm::getPathToDestBox(byte from, byte to) return -1; } -int Scumm::findPathTowards(Actor * a, byte box1nr, byte box2nr, byte box3nr) +int Scumm::findPathTowards(Actor *a, byte box1nr, byte box2nr, byte box3nr) { BoxCoords box1; BoxCoords box2; @@ -391,8 +388,7 @@ int Scumm::findPathTowards(Actor * a, byte box1nr, byte box2nr, byte box3nr) for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { - if (box1.ul.x == box1.ur.x && - box1.ul.x == box2.ul.x && box1.ul.x == box2.ur.x) { + if (box1.ul.x == box1.ur.x && box1.ul.x == box2.ul.x && box1.ul.x == box2.ur.x) { flag = 0; if (box1.ul.y > box1.ur.y) { SWAP(box1.ul.y, box1.ur.y); @@ -450,8 +446,7 @@ int Scumm::findPathTowards(Actor * a, byte box1nr, byte box2nr, byte box3nr) } } - if (box1.ul.y == box1.ur.y && - box1.ul.y == box2.ul.y && box1.ul.y == box2.ur.y) { + if (box1.ul.y == box1.ur.y && box1.ul.y == box2.ul.y && box1.ul.y == box2.ur.y) { flag = 0; if (box1.ul.x > box1.ur.x) { SWAP(box1.ul.x, box1.ur.x); @@ -666,7 +661,7 @@ void Scumm::createBoxMatrix() nukeResource(rtMatrix, 3); } -PathVertex *Scumm::unkMatrixProc1(PathVertex * vtx, PathNode * node) +PathVertex *Scumm::unkMatrixProc1(PathVertex *vtx, PathNode *node) { if (node == NULL || vtx == NULL) return NULL; @@ -689,7 +684,7 @@ PathVertex *Scumm::unkMatrixProc1(PathVertex * vtx, PathNode * node) return NULL; } -PathNode *Scumm::unkMatrixProc2(PathVertex * vtx, int i) +PathNode *Scumm::unkMatrixProc2(PathVertex *vtx, int i) { PathNode *node; @@ -697,14 +692,14 @@ PathNode *Scumm::unkMatrixProc2(PathVertex * vtx, int i) return NULL; if (!vtx->right) { - node = (PathNode *) addToBoxVertexHeap(sizeof(PathNode)); + node = (PathNode *)addToBoxVertexHeap(sizeof(PathNode)); vtx->left = vtx->right = node; node->index = i; node->left = 0; node->right = 0; } else { - node = (PathNode *) addToBoxVertexHeap(sizeof(PathNode)); + node = (PathNode *)addToBoxVertexHeap(sizeof(PathNode)); vtx->right->left = node; node->right = vtx->right; @@ -738,8 +733,7 @@ bool Scumm::areBoxesNeighbours(int box1nr, int box2nr) do { k = 4; do { - if (box2.ur.x == box2.ul.x && - box.ul.x == box2.ul.x && box.ur.x == box2.ur.x) { + if (box2.ur.x == box2.ul.x && box.ul.x == box2.ul.x && box.ur.x == box2.ur.x) { n = m = 0; if (box2.ur.y < box2.ul.y) { n = 1; @@ -752,8 +746,7 @@ bool Scumm::areBoxesNeighbours(int box1nr, int box2nr) if (box.ur.y < box2.ul.y || box.ul.y > box2.ur.y || (box.ul.y == box2.ur.y || - box.ur.y == box2.ul.y) && - box2.ur.y != box2.ul.y && box.ul.y != box.ur.y) { + box.ur.y == box2.ul.y) && box2.ur.y != box2.ul.y && box.ul.y != box.ur.y) { if (n) { SWAP(box2.ur.y, box2.ul.y); } @@ -771,8 +764,7 @@ bool Scumm::areBoxesNeighbours(int box1nr, int box2nr) } } - if (box2.ur.y == box2.ul.y && - box.ul.y == box2.ul.y && box.ur.y == box2.ur.y) { + if (box2.ur.y == box2.ul.y && box.ul.y == box2.ul.y && box.ur.y == box2.ur.y) { n = m = 0; if (box2.ur.x < box2.ul.x) { n = 1; @@ -785,8 +777,7 @@ bool Scumm::areBoxesNeighbours(int box1nr, int box2nr) if (box.ur.x < box2.ul.x || box.ul.x > box2.ur.x || (box.ul.x == box2.ur.x || - box.ur.x == box2.ul.x) && - box2.ur.x != box2.ul.x && box.ul.x != box.ur.x) { + box.ur.x == box2.ul.x) && box2.ur.x != box2.ul.x && box.ul.x != box.ur.x) { if (n) { SWAP(box2.ur.x, box2.ul.x); @@ -857,11 +848,10 @@ PathVertex *Scumm::addPathVertex() _boxMatrixPtr4 = getResourceAddress(rtMatrix, 4); _boxPathVertexHeapIndex = 0; - return (PathVertex *) addToBoxVertexHeap(sizeof(PathVertex)); + return (PathVertex *)addToBoxVertexHeap(sizeof(PathVertex)); } -int Scumm::findPathTowardsOld(Actor * a, byte trap1, byte trap2, - byte final_trap) +int Scumm::findPathTowardsOld(Actor *a, byte trap1, byte trap2, byte final_trap) { GetGates(trap1, trap2); ScummPoint pt; @@ -895,7 +885,7 @@ int Scumm::findPathTowardsOld(Actor * a, byte trap1, byte trap2, if (compareSlope(gateLoc[1].x, gateLoc[1].y, gateLoc[3].x, gateLoc[3].y, gate1ax, gate1ay) == compareSlope(gateLoc[1].x, gateLoc[1].y, gateLoc[3].x, gateLoc[3].y, gate1bx, gate1by)) { closestPtOnLine(gate1ax, gate1ay, gate1bx, gate1by, gateLoc[1].x, gateLoc[1].y); - gateLoc[2].x = pt.x; /* if point 2 between gates, ignore! */ + gateLoc[2].x = pt.x; /* if point 2 between gates, ignore! */ gateLoc[2].y = pt.y; } diff --git a/costume.cpp b/costume.cpp index ac6c43737e..92188a1955 100644 --- a/costume.cpp +++ b/costume.cpp @@ -74,7 +74,7 @@ const byte cost_scaleTable[256] = { 238, 30, 158, 94, 222, 62, 190, 126, 254 }; -byte CostumeRenderer::mainRoutine(Actor * a, int slot, int frame) +byte CostumeRenderer::mainRoutine(Actor *a, int slot, int frame) { int xmove, ymove, i, b, s; uint scal; @@ -94,10 +94,10 @@ byte CostumeRenderer::mainRoutine(Actor * a, int slot, int frame) _width = _width2; _height2 = _srcptr[2]; _height = _height2; - xmove = (int16) READ_LE_UINT16(_srcptr + 4) + _xmove; - ymove = (int16) READ_LE_UINT16(_srcptr + 6) + _ymove; - _xmove += (int16) READ_LE_UINT16(_srcptr + 8); - _ymove -= (int16) READ_LE_UINT16(_srcptr + 10); + xmove = (int16)READ_LE_UINT16(_srcptr + 4) + _xmove; + ymove = (int16)READ_LE_UINT16(_srcptr + 6) + _ymove; + _xmove += (int16)READ_LE_UINT16(_srcptr + 8); + _ymove -= (int16)READ_LE_UINT16(_srcptr + 10); _srcptr += 12; switch (_loaded._ptr[7] & 0x7F) { @@ -108,8 +108,7 @@ byte CostumeRenderer::mainRoutine(Actor * a, int slot, int frame) _srcptr += 2; if (ex1 != 0xFF || ex2 != 0xFF) { ex1 = READ_LE_UINT16(_loaded._ptr + _loaded._numColors + 10 + ex1 * 2); - _srcptr = - _loaded._ptr + READ_LE_UINT16(_loaded._ptr + ex1 + ex2 * 2) + 14; + _srcptr = _loaded._ptr + READ_LE_UINT16(_loaded._ptr + ex1 + ex2 * 2) + 14; } } @@ -274,10 +273,8 @@ byte CostumeRenderer::mainRoutine(Actor * a, int slot, int frame) CHECK_HEAP return 2; } - _bgbak_ptr = - _vm->getResourceAddress(rtBuffer,5) + _vm->virtscr[0].xstart + _ypos * 320 + _xpos; - _backbuff_ptr = - _vm->virtscr[0].screenPtr + _vm->virtscr[0].xstart + _ypos * 320 + _xpos; + _bgbak_ptr = _vm->getResourceAddress(rtBuffer, 5) + _vm->virtscr[0].xstart + _ypos * 320 + _xpos; + _backbuff_ptr = _vm->virtscr[0].screenPtr + _vm->virtscr[0].xstart + _ypos * 320 + _xpos; charsetmask = _vm->hasCharsetMask(_left, _top + _vm->virtscr[0].topline, _right, _vm->virtscr[0].topline + _bottom); @@ -286,11 +283,14 @@ byte CostumeRenderer::mainRoutine(Actor * a, int slot, int frame) if (_vm->_features & GF_SMALL_HEADER) masking = _zbuf; else - masking = _vm->isMaskActiveAt(_left, _top, _right, _bottom,_vm->getResourceAddress(rtBuffer,9) + - _vm->gdi._imgBufOffs[_zbuf] + _vm->_screenStartStrip); + masking = + _vm->isMaskActiveAt(_left, _top, _right, _bottom, + _vm->getResourceAddress(rtBuffer, + 9) + _vm->gdi._imgBufOffs[_zbuf] + + _vm->_screenStartStrip); if (masking || charsetmask) { - _mask_ptr =_vm->getResourceAddress(rtBuffer,9) + _ypos * 40 + _vm->_screenStartStrip; + _mask_ptr = _vm->getResourceAddress(rtBuffer, 9) + _ypos * 40 + _vm->_screenStartStrip; _imgbufoffs = _vm->gdi._imgBufOffs[_zbuf]; if (!charsetmask && _zbuf != 0) _mask_ptr += _imgbufoffs; @@ -298,30 +298,30 @@ byte CostumeRenderer::mainRoutine(Actor * a, int slot, int frame) } CHECK_HEAP if (a->shadow_mode) { - proc_special(a,(masking<<1)+charsetmask); + proc_special(a, (masking << 1) + charsetmask); return b; } switch ((scaling << 2) | (masking << 1) | charsetmask) { case 0: - proc6(); // no scaling, no masking, no charsetmask + proc6(); // no scaling, no masking, no charsetmask break; case 1: case 2: - proc5(); // no scaling, masking or charsetmask + proc5(); // no scaling, masking or charsetmask break; case 3: - proc4(); // no scaling, masking and charsetmask + proc4(); // no scaling, masking and charsetmask break; case 4: - proc1(); // scaling, no masking, no charsetmask + proc1(); // scaling, no masking, no charsetmask break; case 5: case 6: - proc2(); // scaling, masking or charsetmask + proc2(); // scaling, masking or charsetmask break; case 7: - proc3(); // scaling, masking and charsetmask + proc3(); // scaling, masking and charsetmask break; } @@ -703,11 +703,11 @@ void CostumeRenderer::proc_special(Actor *a, byte mask2) byte shadow4; byte shadow5; - shadow1=a->shadow_mode & 0x80; - shadow2=a->shadow_mode & 0x40; - shadow3=a->shadow_mode & 0x20; - shadow4=a->shadow_mode & 0x10; - shadow5=a->shadow_mode & 0x0F; + shadow1 = a->shadow_mode & 0x80; + shadow2 = a->shadow_mode & 0x40; + shadow3 = a->shadow_mode & 0x20; + shadow4 = a->shadow_mode & 0x10; + shadow5 = a->shadow_mode & 0x0F; mask = _mask_ptr = _mask_ptr_dest; maskbit = revBitMask[_xpos & 7]; @@ -721,14 +721,14 @@ void CostumeRenderer::proc_special(Actor *a, byte mask2) color = _repcolor; src = _srcptr; - if(_mirror == 0) - shadow5=-shadow5; + if (_mirror == 0) + shadow5 = -shadow5; maskbit = revBitMask[_xpos & 7]; dst = _backbuff_ptr; - if(mask2 !=0 && mask2 < 3) + if (mask2 != 0 && mask2 < 3) _imgbufoffs = 0; if (_docontinue) @@ -741,28 +741,25 @@ void CostumeRenderer::proc_special(Actor *a, byte mask2) if (!len) len = *src++; - do { // ok + do { // ok if (cost_scaleTable[_scaleIndexY++] < _scaleY) { if (color && y < _outheight) { - if (!mask2 || (mask2 && !((*mask | mask[_imgbufoffs]) & maskbit))) - { - if(shadow3 == 0) - { + if (!mask2 || (mask2 && !((*mask | mask[_imgbufoffs]) & maskbit))) { + if (shadow3 == 0) { pcolor = _palette[color]; if (pcolor != 13) goto proc_special_end; } - if(shadow2 != 0) - { + if (shadow2 != 0) { warning("proc_special: shadow2 unimplemented"); pcolor = 0; - } - else // we don't need all the random stuff, just the background copy + } else // we don't need all the random stuff, just the background copy { - pcolor=_vm->_proc_special_palette[*dst]; + pcolor = _vm->_proc_special_palette[*dst]; } -proc_special_end:; *dst = pcolor; + proc_special_end:; + *dst = pcolor; } } dst += 320; @@ -790,7 +787,7 @@ proc_special_end:; *dst = pcolor; StartPos:; } while (--len); } while (1); - + } #if 0 @@ -825,7 +822,7 @@ void CostumeRenderer::loadCostume(int id) } #endif -byte CostumeRenderer::drawOneSlot(Actor * a, int slot) +byte CostumeRenderer::drawOneSlot(Actor *a, int slot) { if (!(_vm->_features & GF_AFTER_V7)) { @@ -838,8 +835,7 @@ byte CostumeRenderer::drawOneSlot(Actor * a, int slot) i = cd->curpos[slot] & 0x7FFF; - _frameptr = - _loaded._ptr + READ_LE_UINT16(_loaded._ptr + _loaded._numColors + slot * 2 + 10); + _frameptr = _loaded._ptr + READ_LE_UINT16(_loaded._ptr + _loaded._numColors + slot * 2 + 10); code = _loaded._dataptr[i] & 0x7F; @@ -855,7 +851,7 @@ byte CostumeRenderer::drawOneSlot(Actor * a, int slot) } -byte CostumeRenderer::drawCostume(Actor * a) +byte CostumeRenderer::drawCostume(Actor *a) { int i; byte r = 0; @@ -866,12 +862,12 @@ byte CostumeRenderer::drawCostume(Actor * a) return r; } -int Scumm::cost_frameToAnim(Actor * a, int frame) +int Scumm::cost_frameToAnim(Actor *a, int frame) { return newDirToOldDir(a->facing) + frame * 4; } -void Scumm::loadCostume(LoadedCostume * lc, int costume) +void Scumm::loadCostume(LoadedCostume *lc, int costume) { lc->_ptr = getResourceAddress(rtCostume, costume); @@ -901,7 +897,7 @@ void Scumm::loadCostume(LoadedCostume * lc, int costume) lc->_dataptr = lc->_ptr + READ_LE_UINT16(lc->_ptr + lc->_numColors + 8); } -void Scumm::cost_decodeData(Actor * a, int frame, uint usemask) +void Scumm::cost_decodeData(Actor *a, int frame, uint usemask) { byte *p, *r; uint mask, j; @@ -991,8 +987,7 @@ void CostumeRenderer::setPalette(byte *palette) void CostumeRenderer::setFacing(uint16 facing) { - _mirror = Scumm::newDirToOldDir(facing) != 0 - || (_loaded._ptr[7] & 0x80); + _mirror = Scumm::newDirToOldDir(facing) != 0 || (_loaded._ptr[7] & 0x80); } void CostumeRenderer::setCostume(int costume) @@ -1000,7 +995,7 @@ void CostumeRenderer::setCostume(int costume) _vm->loadCostume(&_loaded, costume); } -byte Scumm::cost_increaseAnims(LoadedCostume * lc, Actor * a) +byte Scumm::cost_increaseAnims(LoadedCostume *lc, Actor *a) { int i; byte r = 0; @@ -1012,7 +1007,7 @@ byte Scumm::cost_increaseAnims(LoadedCostume * lc, Actor * a) return r; } -byte Scumm::cost_increaseAnim(LoadedCostume * lc, Actor * a, int slot) +byte Scumm::cost_increaseAnim(LoadedCostume *lc, Actor *a, int slot) { int highflag; int i, end; @@ -41,7 +41,7 @@ enum { CMD_LOAD_ROOM, CMD_DUMPBOX, CMD_VAR, - CMD_WATCH, + CMD_WATCH, CMD_EXIT }; @@ -75,8 +75,7 @@ bool ScummDebugger::do_command() "(s)cripts -> show running scripts\n" "(b)oxes -> list and draw boxen\n" "(v)ariable -> set or show a variable value\n" - "(w)atch [varnum] -> set a variable watch. 0 means all variables.\n" - "(e)xit -> exit game\n"); + "(w)atch [varnum] -> set a variable watch. 0 means all variables.\n" "(e)xit -> exit game\n"); return true; case CMD_QUIT: @@ -128,18 +127,16 @@ bool ScummDebugger::do_command() printf("\nWalk boxes:\n"); for (i = 0; i < num; i++) { warning("BoxTest currently unimplemented in new graphics code\n"); - /*BoxTest(i);*/ + /*BoxTest(i); */ _s->getBoxCoordinates(i, &box); printf("%d: [%d x %d] [%d x %d] [%d x %d] [%d x %d]\n", i, - box.ul.x, box.ul.y, box.ll.x, box.ll.y, - box.ur.x, box.ur.y, box.lr.x, box.lr.y); + box.ul.x, box.ul.y, box.ll.x, box.ll.y, box.ur.x, box.ur.y, box.lr.x, box.lr.y); } } return true; case CMD_VAR: if (!_parameters[0]) { - printf - ("v 123 will show the value of 123, v 123 456 will set the value of 123 to 456.\n"); + printf("v 123 will show the value of 123, v 123 456 will set the value of 123 to 456.\n"); } else { char *tok = strtok(_parameters, " "); int var = atoi(tok); @@ -275,9 +272,7 @@ int ScummDebugger::get_command() *s = 0; break; } - printf - ("Invalid command '%s'. Type 'help' for a list of available commands.\n", - buf); + printf("Invalid command '%s'. Type 'help' for a list of available commands.\n", buf); } while (1); } @@ -286,24 +281,19 @@ void ScummDebugger::printActors(int act) int i; Actor *a; - printf - ("+--------------------------------------------------------------+\n"); - printf - ("|# |room| x y |elev|cos|width|box|mov|zp|frame|scale|spd|dir|\n"); - printf - ("+--+----+--------+----+---+-----+---+---+--+-----+-----+---+---+\n"); + printf("+--------------------------------------------------------------+\n"); + printf("|# |room| x y |elev|cos|width|box|mov|zp|frame|scale|spd|dir|\n"); + printf("+--+----+--------+----+---+-----+---+---+--+-----+-----+---+---+\n"); for (i = 1; i < _s->NUM_ACTORS; i++) { if (act == -1 || act == i) { a = &_s->actor[i]; if (a->visible) printf("|%2d|%4d|%3d %3d|%4d|%3d|%5d|%3d|%3d|%2d|%5d|%5d|%3d|%3d|\n", i, a->room, a->x, a->y, a->elevation, a->costume, a->width, - a->walkbox, a->moving, a->forceClip, a->frame, a->scalex, - a->speedx, a->facing); + a->walkbox, a->moving, a->forceClip, a->frame, a->scalex, a->speedx, a->facing); } } - printf - ("+--------------------------------------------------------------+\n"); + printf("+--------------------------------------------------------------+\n"); } void ScummDebugger::printScripts() diff --git a/object.cpp b/object.cpp index 6eae391cb2..22728137db 100644 --- a/object.cpp +++ b/object.cpp @@ -26,8 +26,7 @@ bool Scumm::getClass(int obj, int cls) { - checkRange(_numGlobalObjects - 1, 0, obj, - "Object %d out of range in getClass"); + checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getClass"); cls &= 0x7F; checkRange(32, 1, cls, "Class %d out of range in getClass"); @@ -43,8 +42,7 @@ bool Scumm::getClass(int obj, int cls) void Scumm::putClass(int obj, int cls, bool set) { - checkRange(_numGlobalObjects - 1, 0, obj, - "Object %d out of range in putClass"); + checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in putClass"); cls &= 0x7F; checkRange(32, 1, cls, "Class %d out of range in getClass"); @@ -65,38 +63,33 @@ void Scumm::putClass(int obj, int cls, bool set) int Scumm::getOwner(int obj) { - checkRange(_numGlobalObjects - 1, 0, obj, - "Object %d out of range in getOwner"); + checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getOwner"); return _objectOwnerTable[obj]; } void Scumm::putOwner(int obj, int owner) { - checkRange(_numGlobalObjects - 1, 0, obj, - "Object %d out of range in putOwner"); + checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in putOwner"); checkRange(0xFF, 0, owner, "Owner %d out of range in putOwner"); _objectOwnerTable[obj] = owner; } int Scumm::getState(int obj) { - checkRange(_numGlobalObjects - 1, 0, obj, - "Object %d out of range in getState"); + checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getState"); return _objectStateTable[obj]; } void Scumm::putState(int obj, int state) { - checkRange(_numGlobalObjects - 1, 0, obj, - "Object %d out of range in putState"); + checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in putState"); checkRange(0xFF, 0, state, "State %d out of range in putState"); _objectStateTable[obj] = state; } int Scumm::getObjectRoom(int obj) { - checkRange(_numGlobalObjects - 1, 0, obj, - "Object %d out of range in getObjectRoom"); + checkRange(_numGlobalObjects - 1, 0, obj, "Object %d out of range in getObjectRoom"); return _objectRoomTable[obj]; } @@ -152,9 +145,7 @@ int Scumm::getObjectOrActorXY(int object) return -1; case WIO_INVENTORY: if (_objectOwnerTable[object] < NUM_ACTORS) - return - getActorXYPos(derefActorSafe - (_objectOwnerTable[object], "getObjectOrActorXY(2)")); + return getActorXYPos(derefActorSafe(_objectOwnerTable[object], "getObjectOrActorXY(2)")); else return 0xFF; } @@ -189,11 +180,11 @@ void Scumm::getObjectXYPos(int object) assert(ptr); imhd = (ImageHeader *)findResourceData(MKID('IMHD'), ptr); if (_features & GF_AFTER_V7) { - x = od->x_pos + (int16) READ_LE_UINT16(&imhd->v7.hotspot[state].x); - y = od->y_pos + (int16) READ_LE_UINT16(&imhd->v7.hotspot[state].y); + x = od->x_pos + (int16)READ_LE_UINT16(&imhd->v7.hotspot[state].x); + y = od->y_pos + (int16)READ_LE_UINT16(&imhd->v7.hotspot[state].y); } else { - x = od->x_pos + (int16) READ_LE_UINT16(&imhd->old.hotspot[state].x); - y = od->y_pos + (int16) READ_LE_UINT16(&imhd->old.hotspot[state].y); + x = od->x_pos + (int16)READ_LE_UINT16(&imhd->old.hotspot[state].x); + y = od->y_pos + (int16)READ_LE_UINT16(&imhd->old.hotspot[state].y); } } else { x = od->walk_x; @@ -224,8 +215,7 @@ int Scumm::getObjActToObjActDist(int a, int b) if (b < NUM_ACTORS) actb = derefActorSafe(b, "getObjActToObjActDist(2)"); - if (acta && actb && acta->getRoom() == actb->getRoom() && acta->getRoom() && - !acta->isInCurrentRoom()) + if (acta && actb && acta->getRoom() == actb->getRoom() && acta->getRoom() && !acta->isInCurrentRoom()) return 0; if (getObjectOrActorXY(a) == -1) @@ -347,8 +337,7 @@ void Scumm::drawObject(int obj, int arg) width = od->width >> 3; height = od->height &= 0xF8; // Ender - if (width == 0 || xpos > _screenEndStrip - || xpos + width < _screenStartStrip) + if (width == 0 || xpos > _screenEndStrip || xpos + width < _screenStartStrip) return; if (od->fl_object_index) { @@ -386,8 +375,7 @@ void Scumm::drawObject(int obj, int arg) byte flags = Gdi::dbAllowMaskOr; if (_features & GF_AFTER_V7 && getClass(od->obj_nr, 22)) flags |= Gdi::dbDrawMaskOnBoth; - gdi.drawBitmap(ptr, _curVirtScreen, x, ypos, height, x - xpos, numstrip, - flags); + gdi.drawBitmap(ptr, _curVirtScreen, x, ypos, height, x - xpos, numstrip, flags); } } @@ -529,8 +517,7 @@ void Scumm::loadRoomObjectsSmall() setupRoomObject(od, room); } - CHECK_HEAP -} +CHECK_HEAP} void Scumm::setupRoomObject(ObjectData *od, byte *room) { @@ -567,8 +554,7 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room) return; } - cdhd = (CodeHeader *)findResourceData(MKID('CDHD'), - room + od->offs_obcd_to_room); + cdhd = (CodeHeader *)findResourceData(MKID('CDHD'), room + od->offs_obcd_to_room); if (_features & GF_AFTER_V7) od->obj_nr = READ_LE_UINT16(&(cdhd->v7.obj_id)); else if (_features & GF_AFTER_V6) @@ -580,8 +566,8 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room) if (_features & GF_AFTER_V6) { od->width = READ_LE_UINT16(&cdhd->v6.w); od->height = READ_LE_UINT16(&cdhd->v6.h); - od->x_pos = ((int16) READ_LE_UINT16(&cdhd->v6.x)); - od->y_pos = ((int16) READ_LE_UINT16(&cdhd->v6.y)); + od->x_pos = ((int16)READ_LE_UINT16(&cdhd->v6.x)); + od->y_pos = ((int16)READ_LE_UINT16(&cdhd->v6.y)); if (cdhd->v6.flags == 0x80) { od->parentstate = 1; } else { @@ -608,9 +594,7 @@ void Scumm::setupRoomObject(ObjectData *od, byte *room) od->parent = cdhd->v7.parent; od->parentstate = cdhd->v7.parentstate; - imhd = - (ImageHeader *)findResourceData(MKID('IMHD'), - room + od->offs_obim_to_room); + imhd = (ImageHeader *)findResourceData(MKID('IMHD'), room + od->offs_obim_to_room); od->x_pos = READ_LE_UINT16(&imhd->v7.x_pos); od->y_pos = READ_LE_UINT16(&imhd->v7.y_pos); od->width = READ_LE_UINT16(&imhd->v7.width); @@ -706,8 +690,7 @@ void Scumm::removeObjectFromRoom(int obj) void Scumm::addObjectToDrawQue(int object) { _drawObjectQue[_drawObjectQueNr++] = object; - if ((unsigned int)_drawObjectQueNr > - sizeof(_drawObjectQue) / sizeof(_drawObjectQue[0])) + if ((unsigned int)_drawObjectQueNr > sizeof(_drawObjectQue) / sizeof(_drawObjectQue[0])) error("Draw Object Que overflow"); } @@ -780,8 +763,7 @@ byte *Scumm::getOBCDFromObject(int obj) if (_objs[i].obj_nr == obj) { if (_objs[i].fl_object_index) return getResourceAddress(rtFlObject, _objs[i].fl_object_index) + 8; - return getResourceAddress(rtRoom, - _roomResource) + _objs[i].offs_obcd_to_room; + return getResourceAddress(rtRoom, _roomResource) + _objs[i].offs_obcd_to_room; } } } @@ -821,8 +803,7 @@ void Scumm::addObjectToInventory(uint obj, uint room) CHECK_HEAP} -void Scumm::findObjectInRoom(FindObjectInRoom * fo, byte findWhat, uint id, - uint room) +void Scumm::findObjectInRoom(FindObjectInRoom *fo, byte findWhat, uint id, uint room) { CodeHeader *cdhd; int i, numobj; @@ -835,8 +816,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom * fo, byte findWhat, uint id, if (findWhat & foCheckAlreadyLoaded && getObjectIndex(id) != -1) { fo->obcd = obcdptr = getOBCDFromObject(id); assert((byte *)obcdptr > (byte *)256); - fo->obim = obimptr = - obcdptr + READ_BE_UINT32_UNALIGNED(&((ResHdr *)obcdptr)->size); + fo->obim = obimptr = obcdptr + READ_BE_UINT32_UNALIGNED(&((ResHdr *)obcdptr)->size); fo->cdhd = (CodeHeader *)findResourceData(MKID('CDHD'), obcdptr); fo->imhd = (ImageHeader *)findResourceData(MKID('IMHD'), obimptr); return; @@ -856,8 +836,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom * fo, byte findWhat, uint id, if (numobj == 0) error("findObjectInRoom: No object found in room %d", room); if (numobj > _numLocalObjects) - error("findObjectInRoom: More (%d) than %d objects in room %d", numobj, - _numLocalObjects, room); + error("findObjectInRoom: More (%d) than %d objects in room %d", numobj, _numLocalObjects, room); if (findWhat & foCodeHeader) { searchptr = roomptr; @@ -923,8 +902,7 @@ void Scumm::findObjectInRoom(FindObjectInRoom * fo, byte findWhat, uint id, } } if (++i == numobj) - error("findObjectInRoom: Object %d image not found in room %d", id, - room); + error("findObjectInRoom: Object %d image not found in room %d", id, room); searchptr = NULL; } } @@ -1077,8 +1055,7 @@ static int getDist(int x, int y, int x2, int y2) return b; } -int Scumm::getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, - int e, int f) +int Scumm::getDistanceBetween(bool is_obj_1, int b, int c, bool is_obj_2, int e, int f) { int i, j; int x, y; @@ -1123,8 +1100,7 @@ void Scumm::setCursorImg(uint img, uint room, uint imgindex) if (room == (uint) - 1) room = getObjectRoom(img); - findObjectInRoom(&foir, foCodeHeader | foImageHeader | foCheckAlreadyLoaded, - img, room); + findObjectInRoom(&foir, foCodeHeader | foImageHeader | foCheckAlreadyLoaded, img, room); if (_features & GF_AFTER_V7) setCursorHotspot2(READ_LE_UINT16(&foir.imhd->v7.hotspot[0].x), @@ -1172,8 +1148,8 @@ void Scumm::nukeFlObjects(int min, int max) } } -void Scumm::enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth, int objectHeight, int f, int g, - int image, int mode) +void Scumm::enqueueObject(int objectNumber, int objectX, int objectY, int objectWidth, + int objectHeight, int f, int g, int image, int mode) { BlastObject *eo; ObjectData *od; @@ -1221,7 +1197,7 @@ void Scumm::drawBlastObjects() } -void Scumm::drawBlastObject(BlastObject * eo) +void Scumm::drawBlastObject(BlastObject *eo) { VirtScreen *vs; byte *bomp, *ptr, *img; @@ -1232,11 +1208,11 @@ void Scumm::drawBlastObject(BlastObject * eo) _lastXstart = vs->xstart; - checkRange(_numGlobalObjects - 1, 30, eo->number, "Illegal Blast object %d"); + checkRange(_numGlobalObjects - 1, 30, eo->number, "Illegal Blast object %d"); idx = _objs[getObjectIndex(eo->number)].fl_object_index; - if(idx) { + if (idx) { ptr = getResourceAddress(rtFlObject, idx); ptr = findResource(MKID('OBIM'), ptr); } else { @@ -1244,18 +1220,18 @@ void Scumm::drawBlastObject(BlastObject * eo) assert(idx != -1); ptr = getResourceAddress(1, _roomResource) + _objs[idx].offs_obim_to_room; } - if(!ptr) - error("BlastObject object %d image not found",eo->number); + if (!ptr) + error("BlastObject object %d image not found", eo->number); img = findResource(IMxx_tags[eo->image], ptr); - if(!img) - img = findResource(IMxx_tags[1], ptr); // Backward compatibility with samnmax blast objects - if(!img) - error("blast-object %d invalid image %d (1-x)",eo->number,eo->image); + if (!img) + img = findResource(IMxx_tags[1], ptr); // Backward compatibility with samnmax blast objects + if (!img) + error("blast-object %d invalid image %d (1-x)", eo->number, eo->image); bomp = findResourceData(MKID('BOMP'), img); - if(!bomp) - error("object %d is not a blast object",eo->number); + if (!bomp) + error("object %d is not a blast object", eo->number); bdd.srcwidth = READ_LE_UINT16(&((BompHeader *)bomp)->width); bdd.srcheight = READ_LE_UINT16(&((BompHeader *)bomp)->height); @@ -1270,8 +1246,7 @@ void Scumm::drawBlastObject(BlastObject * eo) bdd.scale_y = (unsigned char)eo->unk4; drawBomp(&bdd, 0, bdd.dataptr, 1, 0); - updateDirtyRect(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y, - bdd.y + bdd.srcheight, 0); + updateDirtyRect(vs->number, bdd.x, bdd.x + bdd.srcwidth, bdd.y, bdd.y + bdd.srcheight, 0); } void Scumm::removeBlastObjects() @@ -1287,7 +1262,7 @@ void Scumm::removeBlastObjects() clearEnqueue(); } -void Scumm::removeBlastObject(BlastObject * eo) +void Scumm::removeBlastObject(BlastObject *eo) { restoreBG(eo->posX, eo->posY, eo->posX + eo->width, eo->posY + eo->height); } diff --git a/saveload.cpp b/saveload.cpp index 2741373918..b8f75f7f31 100644 --- a/saveload.cpp +++ b/saveload.cpp @@ -130,7 +130,7 @@ bool Scumm::loadState(int slot, bool compat) gdi._mask_left = -1; initScreens(0, 0, 320, 200); - + // Force a fade to black int old_screenEffectFlag = _screenEffectFlag; _screenEffectFlag = true; @@ -169,9 +169,9 @@ void Scumm::makeSavegameName(char *out, int slot, bool compatible) dir = _gameDataPath; #else - #if !defined(MACOS_CARBON) +#if !defined(MACOS_CARBON) dir = getenv("SCUMMVM_SAVEPATH"); - #endif +#endif // If SCUMMVM_SAVEPATH was not specified, try to use game specific savepath from config if (!dir || dir[0] == 0) @@ -226,7 +226,7 @@ bool Scumm::getSavegameName(int slot, char *desc) #define MKARRAY(type,item,saveas,num) {OFFS(type,item),128|saveas,SIZE(type,item)}, {num,0,0} #define MKEND() {0xFFFF,0xFF,0xFF} -void Scumm::saveOrLoad(Serializer * s) +void Scumm::saveOrLoad(Serializer *s) { const SaveLoadEntry objectEntries[] = { MKLINE(ObjectData, offs_obim_to_room, sleUint32), @@ -442,7 +442,7 @@ void Scumm::saveOrLoad(Serializer * s) MKLINE(Scumm, _cd_track, sleInt16), MKLINE(Scumm, _cd_loops, sleInt16), - MKLINE(Scumm, _cd_frame, sleInt16), + MKLINE(Scumm, _cd_frame, sleInt16), MKLINE(Scumm, _cd_end, sleInt16), MKEND() @@ -612,7 +612,7 @@ void Scumm::saveOrLoad(Serializer * s) int var120Backup; int var98Backup; - if (_current_version == VER_V9) + if (_current_version == VER_V9) s->saveLoadEntries(this, mainEntriesV9); else s->saveLoadEntries(this, mainEntriesV8); @@ -623,33 +623,27 @@ void Scumm::saveOrLoad(Serializer * s) s->saveLoadArrayOf(vm.slot, 25, sizeof(vm.slot[0]), scriptSlotEntries); else s->saveLoadArrayOf(vm.slot, NUM_SCRIPT_SLOT, sizeof(vm.slot[0]), scriptSlotEntries); - s->saveLoadArrayOf(_objs, _numLocalObjects, sizeof(_objs[0]), - objectEntries); + s->saveLoadArrayOf(_objs, _numLocalObjects, sizeof(_objs[0]), objectEntries); s->saveLoadArrayOf(_verbs, _numVerbs, sizeof(_verbs[0]), verbEntries); s->saveLoadArrayOf(vm.nest, 16, sizeof(vm.nest[0]), nestedScriptEntries); s->saveLoadArrayOf(sentence, 6, sizeof(sentence[0]), sentenceTabEntries); s->saveLoadArrayOf(string, 6, sizeof(string[0]), stringTabEntries); - s->saveLoadArrayOf(_colorCycle, 16, sizeof(_colorCycle[0]), - colorCycleEntries); + s->saveLoadArrayOf(_colorCycle, 16, sizeof(_colorCycle[0]), colorCycleEntries); for (i = rtFirst; i <= rtLast; i++) if (res.mode[i] == 0) for (j = 1; j < res.num[i]; j++) saveLoadResource(s, i, j); - s->saveLoadArrayOf(_objectOwnerTable, _numGlobalObjects, - sizeof(_objectOwnerTable[0]), sleByte); - s->saveLoadArrayOf(_objectStateTable, _numGlobalObjects, - sizeof(_objectStateTable[0]), sleByte); + s->saveLoadArrayOf(_objectOwnerTable, _numGlobalObjects, sizeof(_objectOwnerTable[0]), sleByte); + s->saveLoadArrayOf(_objectStateTable, _numGlobalObjects, sizeof(_objectStateTable[0]), sleByte); if (_objectRoomTable) - s->saveLoadArrayOf(_objectRoomTable, _numGlobalObjects, - sizeof(_objectRoomTable[0]), sleByte); + s->saveLoadArrayOf(_objectRoomTable, _numGlobalObjects, sizeof(_objectRoomTable[0]), sleByte); if (_shadowPaletteSize) s->saveLoadArrayOf(_shadowPalette, _shadowPaletteSize, 1, sleByte); - s->saveLoadArrayOf(_classData, _numGlobalObjects, sizeof(_classData[0]), - sleUint32); + s->saveLoadArrayOf(_classData, _numGlobalObjects, sizeof(_classData[0]), sleUint32); var120Backup = _vars[120]; var98Backup = _vars[98]; @@ -684,7 +678,7 @@ void Scumm::saveOrLoad(Serializer * s) _imuse->save_or_load(s, this); } -void Scumm::saveLoadResource(Serializer * ser, int type, int idx) +void Scumm::saveLoadResource(Serializer *ser, int type, int idx) { byte *ptr; uint32 size; @@ -783,8 +777,7 @@ byte Serializer::loadByte() return e; } -void Serializer::saveLoadArrayOf(void *b, int len, int datasize, - byte filetype) +void Serializer::saveLoadArrayOf(void *b, int len, int datasize, byte filetype) { byte *at = (byte *)b; uint32 data; @@ -816,7 +809,7 @@ void Serializer::saveLoadArrayOf(void *b, int len, int datasize, break; case sleUint16: case sleInt16: - saveWord((int16) data); + saveWord((int16)data); break; case sleInt32: case sleUint32: @@ -835,13 +828,13 @@ void Serializer::saveLoadArrayOf(void *b, int len, int datasize, data = loadWord(); break; case sleInt16: - data = (int16) loadWord(); + data = (int16)loadWord(); break; case sleUint32: data = loadUint32(); break; case sleInt32: - data = (int32) loadUint32(); + data = (int32)loadUint32(); break; default: error("saveLoadArrayOf: invalid filetype %d", filetype); @@ -862,8 +855,7 @@ void Serializer::saveLoadArrayOf(void *b, int len, int datasize, } } -void Serializer::saveLoadArrayOf(void *b, int num, int datasize, - const SaveLoadEntry * sle) +void Serializer::saveLoadArrayOf(void *b, int num, int datasize, const SaveLoadEntry *sle) { byte *data = (byte *)b; @@ -874,7 +866,7 @@ void Serializer::saveLoadArrayOf(void *b, int num, int datasize, } -void Serializer::saveLoadEntries(void *d, const SaveLoadEntry * sle) +void Serializer::saveLoadEntries(void *d, const SaveLoadEntry *sle) { int replen; byte type; diff --git a/script.cpp b/script.cpp index eca8e73875..048532342c 100644 --- a/script.cpp +++ b/script.cpp @@ -80,8 +80,7 @@ void Scumm::stopScriptNr(int script) ss = &vm.slot[1]; for (i = 1; i < NUM_SCRIPT_SLOT; i++, ss++) { - if (script != ss->number || - ss->where != WIO_GLOBAL && ss->where != WIO_LOCAL || ss->status == 0) + if (script != ss->number || ss->where != WIO_GLOBAL && ss->where != WIO_LOCAL || ss->status == 0) continue; if (ss->cutsceneOverride) @@ -99,8 +98,7 @@ void Scumm::stopScriptNr(int script) num = _numNestedScripts; do { - if (nest->number == script - && (nest->where == WIO_GLOBAL || nest->where == WIO_LOCAL)) { + if (nest->number == script && (nest->where == WIO_GLOBAL || nest->where == WIO_LOCAL)) { nest->number = 0xFF; nest->slot = 0xFF; nest->where = 0xFF; @@ -122,8 +120,7 @@ void Scumm::stopObjectScript(int script) for (i = 1; i < NUM_SCRIPT_SLOT; i++, ss++) { if (script == ss->number && (ss->where == WIO_ROOM || - ss->where == WIO_INVENTORY - || ss->where == WIO_FLOBJECT) + ss->where == WIO_INVENTORY || ss->where == WIO_FLOBJECT) && ss->status != 0) { if (ss->cutsceneOverride) error("Object %d stopped with active cutscene/override", script); @@ -142,8 +139,7 @@ void Scumm::stopObjectScript(int script) do { if (nest->number == script && - (nest->where == WIO_ROOM || nest->where == WIO_FLOBJECT - || nest->where == WIO_INVENTORY)) { + (nest->where == WIO_ROOM || nest->where == WIO_FLOBJECT || nest->where == WIO_INVENTORY)) { nest->number = 0xFF; nest->slot = 0xFF; nest->where = 0xFF; @@ -250,8 +246,7 @@ void Scumm::getScriptBaseAddress() case WIO_FLOBJECT: /* flobject script */ idx = getObjectIndex(ss->number); - _scriptOrgPointer = - getResourceAddress(rtFlObject, _objs[idx].fl_object_index); + _scriptOrgPointer = getResourceAddress(rtFlObject, _objs[idx].fl_object_index); _lastCodePtr = &_baseFLObject[ss->number]; break; default: @@ -276,8 +271,7 @@ void Scumm::executeScript() _opcode = fetchScriptByte(); _scriptPointerStart = _scriptPointer; vm.slot[_currentScript].didexec = 1; - debug(8, "Script %d: [%X] %s()", vm.slot[_currentScript].number, _opcode, - _opcodes_lookup[_opcode]); + debug(8, "Script %d: [%X] %s()", vm.slot[_currentScript].number, _opcode, _opcodes_lookup[_opcode]); op = getOpcode(_opcode); (this->*op) (); } @@ -368,8 +362,7 @@ void Scumm::writeVar(uint var, int value) if ((_varwatch == (int)var) || (_varwatch == 0)) { if (vm.slot[_currentScript].number < 100) - debug(0, "vars[%d] = %d (via script-%d)", var, value, - vm.slot[_currentScript].number); + debug(0, "vars[%d] = %d (via script-%d)", var, value, vm.slot[_currentScript].number); else debug(0, "vars[%d] = %d (via room-%d-%d)", var, value, _currentRoom, vm.slot[_currentScript].number); @@ -383,8 +376,7 @@ void Scumm::writeVar(uint var, int value) /* FIXME: Enable Indy4 mousefighting by default. is there a better place to put this? */ - if (_gameId == GID_INDY4 && var == 107 - && vm.slot[_currentScript].number == 1) + if (_gameId == GID_INDY4 && var == 107 && vm.slot[_currentScript].number == 1) value = 1; if (value) @@ -466,9 +458,7 @@ void Scumm::drawBox(int x, int y, int x2, int y2, int color) if (color == -1) { if (vs->number != 0) error("can only copy bg to main window"); - bgbuff = - getResourceAddress(rtBuffer, - vs->number + 5) + vs->xstart + (y - top) * 320 + x; + bgbuff = getResourceAddress(rtBuffer, vs->number + 5) + vs->xstart + (y - top) * 320 + x; blit(backbuff, bgbuff, x2 - x, y2 - y); } else { count = y2 - y; @@ -498,8 +488,7 @@ void Scumm::stopObjectCode() } } else { if (ss->cutsceneOverride) { - warning("Script %d ending with active cutscene/override (%d)", - ss->number, ss->cutsceneOverride); + warning("Script %d ending with active cutscene/override (%d)", ss->number, ss->cutsceneOverride); ss->cutsceneOverride = 0; } } @@ -536,8 +525,7 @@ void Scumm::freezeScripts(int flag) int i; for (i = 1; i < NUM_SCRIPT_SLOT; i++) { - if (_currentScript != i && vm.slot[i].status != ssDead - && (vm.slot[i].unk1 == 0 || flag >= 0x80)) { + if (_currentScript != i && vm.slot[i].status != ssDead && (vm.slot[i].unk1 == 0 || flag >= 0x80)) { vm.slot[i].status |= 0x80; vm.slot[i].freezeCount++; } @@ -578,8 +566,7 @@ void Scumm::runAllScripts() _currentScript = 0xFF; for (_curExecScript = 0; _curExecScript < NUM_SCRIPT_SLOT; _curExecScript++) { - if (vm.slot[_curExecScript].status == ssRunning - && vm.slot[_curExecScript].didexec == 0) { + if (vm.slot[_curExecScript].status == ssRunning && vm.slot[_curExecScript].didexec == 0) { _currentScript = (char)_curExecScript; getScriptBaseAddress(); getScriptEntryPoint(); @@ -636,13 +623,11 @@ void Scumm::killScriptsAndResources() for (i = 1; i < NUM_SCRIPT_SLOT; i++, ss++) { if (ss->where == WIO_ROOM || ss->where == WIO_FLOBJECT) { if (ss->cutsceneOverride) - error("Object %d stopped with active cutscene/override in exit", - ss->number); + error("Object %d stopped with active cutscene/override in exit", ss->number); ss->status = 0; } else if (ss->where == WIO_LOCAL) { if (ss->cutsceneOverride) - error("Script %d stopped with active cutscene/override in exit", - ss->number); + error("Script %d stopped with active cutscene/override in exit", ss->number); ss->status = 0; } } @@ -675,8 +660,7 @@ void Scumm::checkAndRunVar33() if (isScriptInUse(_vars[VAR_SENTENCE_SCRIPT])) { ss = vm.slot; for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) - if (ss->number == _vars[VAR_SENTENCE_SCRIPT] && ss->status != 0 - && ss->freezeCount == 0) + if (ss->number == _vars[VAR_SENTENCE_SCRIPT] && ss->status != 0 && ss->freezeCount == 0) return; } @@ -686,8 +670,7 @@ void Scumm::checkAndRunVar33() _sentenceNum--; if (!(_features & GF_AFTER_V7)) - if (sentence[_sentenceNum].unk2 - && sentence[_sentenceNum].unk3 == sentence[_sentenceNum].unk4) + if (sentence[_sentenceNum].unk2 && sentence[_sentenceNum].unk3 == sentence[_sentenceNum].unk4) return; _localParamList[0] = sentence[_sentenceNum].unk5; @@ -815,15 +798,13 @@ int Scumm::getVerbEntrypoint(int obj, int entry) void Scumm::push(int a) { - assert(_scummStackPos >= 0 - && (unsigned int)_scummStackPos <= ARRAYSIZE(_scummStack)); + assert(_scummStackPos >= 0 && (unsigned int)_scummStackPos <= ARRAYSIZE(_scummStack)); _scummStack[_scummStackPos++] = a; } int Scumm::pop() { - assert(_scummStackPos > 0 - && (unsigned int)_scummStackPos <= ARRAYSIZE(_scummStack)); + assert(_scummStackPos > 0 && (unsigned int)_scummStackPos <= ARRAYSIZE(_scummStack)); return _scummStack[--_scummStackPos]; } @@ -859,8 +840,7 @@ void Scumm::cutscene(int16 *args) int scr = _currentScript; vm.slot[scr].cutsceneOverride++; - if (++vm.cutSceneStackPointer > - sizeof(vm.cutSceneData) / sizeof(vm.cutSceneData[0])) + if (++vm.cutSceneStackPointer > sizeof(vm.cutSceneData) / sizeof(vm.cutSceneData[0])) error("Cutscene stack overflow"); vm.cutSceneData[vm.cutSceneStackPointer] = args[0]; @@ -903,8 +883,7 @@ bool Scumm::isScriptRunning(int script) int i; ScriptSlot *ss = vm.slot; for (i = 0; i < NUM_SCRIPT_SLOT; i++, ss++) - if (ss->number == script - && (ss->where == WIO_GLOBAL || ss->where == WIO_LOCAL) && ss->status) + if (ss->number == script && (ss->where == WIO_GLOBAL || ss->where == WIO_LOCAL) && ss->status) return true; return false; } diff --git a/string.cpp b/string.cpp index 0877fb6895..7302027334 100644 --- a/string.cpp +++ b/string.cpp @@ -171,9 +171,7 @@ void Scumm::unkMessage1() uint32 a, b; a = buffer[2] | (buffer[3] << 8) | (buffer[6] << 16) | (buffer[7] << 24); - b = - buffer[10] | (buffer[11] << 8) | (buffer[14] << 16) | (buffer[15] << - 24); + b = buffer[10] | (buffer[11] << 8) | (buffer[14] << 16) | (buffer[15] << 24); // if (_saveSound != 1) talkSound(a, b, 1); } @@ -206,8 +204,7 @@ void Scumm::CHARSET_1() return; if (!(_features & GF_AFTER_V7)) { - if ((camera._dest.x >> 3) != (camera._cur.x >> 3) || - camera._cur.x != camera._last.x) + if ((camera._dest.x >> 3) != (camera._cur.x >> 3) || camera._cur.x != camera._last.x) return; } @@ -221,8 +218,7 @@ void Scumm::CHARSET_1() if (_vars[VAR_V5_TALK_STRING_Y] < 0) { s = (a->scaley * (int)_vars[VAR_V5_TALK_STRING_Y]) / 0xFF; - string[0].ypos = - ((_vars[VAR_V5_TALK_STRING_Y] - s) >> 1) + s - a->elevation + a->y; + string[0].ypos = ((_vars[VAR_V5_TALK_STRING_Y] - s) >> 1) + s - a->elevation + a->y; } else { string[0].ypos = _vars[VAR_V5_TALK_STRING_Y]; } @@ -401,14 +397,11 @@ void Scumm::CHARSET_1() } else if (c == 10) { uint32 tmpA, tmpB; - tmpA = - buffer[0] | (buffer[1] << 8) | (buffer[4] << 16) | (buffer[5] << 24); - tmpB = - buffer[8] | (buffer[9] << 8) | (buffer[12] << 16) | (buffer[13] << - 24); + tmpA = buffer[0] | (buffer[1] << 8) | (buffer[4] << 16) | (buffer[5] << 24); + tmpB = buffer[8] | (buffer[9] << 8) | (buffer[12] << 16) | (buffer[13] << 24); talkSound(tmpA, tmpB, 2); buffer += 14; - + // Set flag that speech variant exist of this msg if (_haveMsg == 0xFF) _haveMsg = 0xFE; @@ -422,8 +415,7 @@ void Scumm::CHARSET_1() charset._colorMap[i] = _charsetData[charset._curId][i - 12]; else charset._colorMap[i] = _charsetData[charset._curId][i]; - charset._ypos2 -= - getResourceAddress(rtCharset, charset._curId)[30] - oldy; + charset._ypos2 -= getResourceAddress(rtCharset, charset._curId)[30] - oldy; } else if (c == 12) { int color; color = *buffer++; @@ -594,7 +586,7 @@ void Scumm::drawString(int a) } else { if (a == 1 && (_features & GF_AFTER_V6)) - if(string[a].no_talk_anim==0) + if (string[a].no_talk_anim == 0) charset._blitAlso = true; if (_features & GF_OLD256) charset.printCharOld(chr); @@ -800,8 +792,7 @@ void CharsetRenderer::printCharOld(int chr) unsigned int buffer = 0, mask = 0, x = 0, y = 0; unsigned char color; - _vm->checkRange(_vm->_maxCharsets - 1, 0, _curId, - "Printing with bad charset %d"); + _vm->checkRange(_vm->_maxCharsets - 1, 0, _curId, "Printing with bad charset %d"); if ((vs = _vm->findVirtScreen(_top)) == NULL) return; @@ -818,8 +809,7 @@ void CharsetRenderer::printCharOld(int chr) } char_ptr = _vm->getResourceAddress(rtCharset, _curId) + 224 + (chr + 1) * 8; dest_ptr = vs->screenPtr + vs->xstart + (_top - vs->topline) * 320 + _left; - _vm->updateDirtyRect(vs->number, _left, _left + 8, _top - vs->topline, - _top - vs->topline + 8, 0); + _vm->updateDirtyRect(vs->number, _left, _left + 8, _top - vs->topline, _top - vs->topline + 8, 0); for (y = 0; y < 8; y++) { for (x = 0; x < 8; x++) { @@ -849,8 +839,7 @@ void CharsetRenderer::printChar(int chr) int d, right; VirtScreen *vs; - _vm->checkRange(_vm->_maxCharsets - 1, 1, _curId, - "Printing with bad charset %d"); + _vm->checkRange(_vm->_maxCharsets - 1, 1, _curId, "Printing with bad charset %d"); if ((vs = _vm->findVirtScreen(_top)) == NULL) return; @@ -943,8 +932,7 @@ void CharsetRenderer::printChar(int chr) _hasMask = true; #endif - _dest_ptr = _backbuff_ptr = vs->screenPtr - + vs->xstart + _drawTop * 320 + _left; + _dest_ptr = _backbuff_ptr = vs->screenPtr + vs->xstart + _drawTop * 320 + _left; #if !defined(OLD) if (_blitAlso) { @@ -42,7 +42,7 @@ void *Scumm::fileOpen(const char *filename, int mode) void Scumm::fileClose(void *file) { if (_fileMode == 1 || _fileMode == 2) - fclose((FILE *) file); + fclose((FILE *)file); } bool Scumm::fileReadFailed(void *file) @@ -57,12 +57,12 @@ void Scumm::clearFileReadFailed(void *file) bool Scumm::fileEof(void *file) { - return feof((FILE *) file) != 0; + return feof((FILE *)file) != 0; } uint32 Scumm::filePos(void *handle) { - return ftell((FILE *) handle); + return ftell((FILE *)handle); } void Scumm::fileSeek(void *file, long offs, int whence) @@ -70,8 +70,8 @@ void Scumm::fileSeek(void *file, long offs, int whence) switch (_fileMode) { case 1: case 2: - if (fseek((FILE *) file, offs, whence) != 0) - clearerr((FILE *) file); + if (fseek((FILE *)file, offs, whence) != 0) + clearerr((FILE *)file); return; case 3: _whereInResToRead = offs; @@ -88,8 +88,8 @@ void Scumm::fileRead(void *file, void *ptr, uint32 size) if (size == 0) return; - if ((uint32)fread(ptr2, size, 1, (FILE *) file) != 1) { - clearerr((FILE *) file); + if ((uint32)fread(ptr2, size, 1, (FILE *)file) != 1) { + clearerr((FILE *)file); _fileReadFailed = true; } @@ -119,8 +119,8 @@ int Scumm::fileReadByte() switch (_fileMode) { case 1: - if (fread(&b, 1, 1, (FILE *) _fileHandle) != 1) { - clearerr((FILE *) _fileHandle); + if (fread(&b, 1, 1, (FILE *)_fileHandle) != 1) { + clearerr((FILE *)_fileHandle); _fileReadFailed = true; } return b ^ _encbyte; @@ -166,9 +166,9 @@ int Scumm::fileReadByte(void *handle) { byte b; - if (fread(&b, 1, 1, (FILE *) handle) != 1) { - clearerr((FILE *) handle); - _fileReadFailed = true; + if (fread(&b, 1, 1, (FILE *)handle) != 1) { + clearerr((FILE *)handle); + _fileReadFailed = true; } return b ^ _encbyte; } @@ -205,7 +205,7 @@ char *Scumm::Strdup(const char *s) { if (s) { int l = strlen(s) + 1; - char * r = (char *) malloc(l); + char *r = (char *)malloc(l); memcpy(r, s, l); return r; } @@ -53,8 +53,7 @@ void Scumm::checkExecVerbs() runInputScript(4, _mouseButStat, 1); } else if (_mouseButStat & MBS_MOUSE_MASK) { byte code = _mouseButStat & MBS_LEFT_CLICK ? 1 : 2; - if (mouse.y >= virtscr[0].topline - && mouse.y < virtscr[0].topline + virtscr[0].height) { + if (mouse.y >= virtscr[0].topline && mouse.y < virtscr[0].topline + virtscr[0].height) { over = checkMouseOver(mouse.x, mouse.y); if (over != 0) { runInputScript(1, _verbs[over].verbid, code); @@ -63,12 +62,12 @@ void Scumm::checkExecVerbs() runInputScript(2, 0, code); } else { over = checkMouseOver(mouse.x, mouse.y); - + // FIXME For the future: Indy3 and under inv scrolling /* - if (over >= 31 && over <= 36) - over += _inventoryOffset; - */ + if (over >= 31 && over <= 36) + over += _inventoryOffset; + */ runInputScript(1, over != 0 ? _verbs[over].verbid : 0, code); } } @@ -97,8 +96,7 @@ int Scumm::checkMouseOver(int x, int y) vs = &_verbs[i]; do { - if (vs->curmode != 1 || !vs->verbid || vs->saveid || - y < vs->y || y >= vs->bottom) + if (vs->curmode != 1 || !vs->verbid || vs->saveid || y < vs->y || y >= vs->bottom) continue; if (vs->center) { if (x < -(vs->right - vs->x - vs->x) || x >= vs->right) @@ -145,9 +143,9 @@ void Scumm::drawVerb(int vrb, int mode) // FIXME For the future: Indy3 and under inv scrolling /* - if (vrb >= 31 && vrb <= 36) - vrb += _inventoryOffset; - */ + if (vrb >= 31 && vrb <= 36) + vrb += _inventoryOffset; + */ _messagePtr = getResourceAddress(rtVerb, vrb); if (!_messagePtr) @@ -240,7 +238,7 @@ void Scumm::drawVerbBitmap(int vrb, int x, int y) vst = &_verbs[vrb]; vst->right = vst->x + imgw * 8 - 1; - vst->bottom = vst->y + imgh * 8 - 1; + vst->bottom = vst->y + imgh * 8 - 1; vst->oldleft = vst->x; vst->oldright = vst->right; vst->oldtop = vst->y; |
