[Scummvm-cvs-logs] CVS: scummvm/scumm script_v100he.cpp,2.191,2.192 script_v90he.cpp,2.294,2.295 sprite_he.cpp,1.159,1.160 wiz_he.cpp,2.117,2.118 wiz_he.h,2.39,2.40
kirben
kirben at users.sourceforge.net
Mon Jan 30 16:47:04 CET 2006
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16943/scumm
Modified Files:
script_v100he.cpp script_v90he.cpp sprite_he.cpp wiz_he.cpp
wiz_he.h
Log Message:
Cleanup
Index: script_v100he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v100he.cpp,v
retrieving revision 2.191
retrieving revision 2.192
diff -u -d -r2.191 -r2.192
--- script_v100he.cpp 27 Jan 2006 00:50:27 -0000 2.191
+++ script_v100he.cpp 31 Jan 2006 00:46:19 -0000 2.192
@@ -2486,13 +2486,13 @@
case 65:
state = pop();
resId = pop();
- _wiz->loadImgSpot(resId, state, x, y);
+ _wiz->getWizImageSpot(resId, state, x, y);
push(x);
break;
case 66:
state = pop();
resId = pop();
- _wiz->loadImgSpot(resId, state, x, y);
+ _wiz->getWizImageSpot(resId, state, x, y);
push(y);
break;
case 111:
Index: script_v90he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/script_v90he.cpp,v
retrieving revision 2.294
retrieving revision 2.295
diff -u -d -r2.294 -r2.295
--- script_v90he.cpp 18 Jan 2006 17:39:47 -0000 2.294
+++ script_v90he.cpp 31 Jan 2006 00:46:20 -0000 2.295
@@ -1691,13 +1691,13 @@
case 0:
state = pop();
resId = pop();
- _wiz->loadImgSpot(resId, state, x, y);
+ _wiz->getWizImageSpot(resId, state, x, y);
push(x);
break;
case 1:
state = pop();
resId = pop();
- _wiz->loadImgSpot(resId, state, x, y);
+ _wiz->getWizImageSpot(resId, state, x, y);
push(y);
break;
case 2:
Index: sprite_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/sprite_he.cpp,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- sprite_he.cpp 27 Jan 2006 06:05:03 -0000 1.159
+++ sprite_he.cpp 31 Jan 2006 00:46:20 -0000 1.160
@@ -55,7 +55,7 @@
SpriteInfo *spi = &_spriteTable[spriteId];
- _vm->_wiz->loadImgSpot(spi->image, spi->imageState, spr_wiz_x, spr_wiz_y);
+ _vm->_wiz->getWizImageSpot(spi->image, spi->imageState, spr_wiz_x, spr_wiz_y);
if (checkGroup && spi->group) {
SpriteGroup *spg = &_spriteGroups[spi->group];
@@ -75,33 +75,15 @@
angle = spi->angle;
scale = spi->scale;
_vm->_wiz->getWizImageDim(spi->image, spi->imageState, w, h);
- if (!(spi->flags & (kSFScaled | kSFRotated))) {
+ if (spi->flags & (kSFScaled | kSFRotated)) {
+ Common::Point pts[4];
+ _vm->_wiz->polygonTransform(spi->image, spi->imageState, x1, y1, angle, scale, pts);
+ _vm->_wiz->polygonCalcBoundBox(pts, 4, bound);
+ } else {
bound.left = x1;
bound.top = y1;
bound.right = x1 + w;
bound.bottom = y1 + h;
- } else {
- Common::Point pts[4];
-
- pts[1].x = pts[2].x = w / 2 - 1;
- pts[0].x = pts[0].y = pts[1].y = pts[3].x = -w / 2;
- pts[2].y = pts[3].y = h / 2 - 1;
-
- if ((spi->flags & kSFScaled) && scale) {
- for (int j = 0; j < 4; ++j) {
- pts[j].x = pts[j].x * scale / 256;
- pts[j].y = pts[j].y * scale / 256;
- }
- }
- if ((spi->flags & kSFRotated) && angle)
- _vm->_wiz->polygonRotatePoints(pts, 4, angle);
-
- for (int j = 0; j < 4; ++j) {
- pts[j].x += x1;
- pts[j].y += y1;
- }
-
- _vm->_wiz->polygonCalcBoundBox(pts, 4, bound);
}
} else {
bound.left = 1234;
@@ -170,8 +152,8 @@
x = x_pos - spi->pos.x;
y = y_pos - spi->pos.y;
- _vm->_wiz->loadImgSpot(spi->curImage, imageState, x1, y1);
- _vm->_wiz->loadImgSpot(spi->maskImage, imageState, x2, y2);
+ _vm->_wiz->getWizImageSpot(spi->curImage, imageState, x1, y1);
+ _vm->_wiz->getWizImageSpot(spi->maskImage, imageState, x2, y2);
x += (x2 - x1);
y += (y2 - y1);
@@ -1265,7 +1247,7 @@
spi->flags &= ~kSFNeedRedraw;
image = spi->image;
imageState = spi->imageState;
- _vm->_wiz->loadImgSpot(spi->image, spi->imageState, spr_wiz_x, spr_wiz_y);
+ _vm->_wiz->getWizImageSpot(spi->image, spi->imageState, spr_wiz_x, spr_wiz_y);
if (spi->group) {
SpriteGroup *spg = &_spriteGroups[spi->group];
@@ -1297,33 +1279,15 @@
angle = spi->angle;
scale = spi->scale;
_vm->_wiz->getWizImageDim(image, imageState, w, h);
- if (!(spi->flags & (kSFScaled | kSFRotated))) {
+ if (spi->flags & (kSFScaled | kSFRotated)) {
+ Common::Point pts[4];
+ _vm->_wiz->polygonTransform(image, imageState, wiz.img.x1, wiz.img.y1, angle, scale, pts);
+ _vm->_wiz->polygonCalcBoundBox(pts, 4, spi->bbox);
+ } else {
bboxPtr->left = wiz.img.x1;
bboxPtr->top = wiz.img.y1;
bboxPtr->right = wiz.img.x1 + w;
bboxPtr->bottom = wiz.img.y1 + h;
- } else {
- Common::Point pts[4];
-
- pts[1].x = pts[2].x = w / 2 - 1;
- pts[0].x = pts[0].y = pts[1].y = pts[3].x = -w / 2;
- pts[2].y = pts[3].y = h / 2 - 1;
-
- if ((spi->flags & kSFScaled) && scale) {
- for (int j = 0; j < 4; ++j) {
- pts[j].x = pts[j].x * scale / 256;
- pts[j].y = pts[j].y * scale / 256;
- }
- }
- if ((spi->flags & kSFRotated) && angle)
- _vm->_wiz->polygonRotatePoints(pts, 4, angle);
-
- for (int j = 0; j < 4; ++j) {
- pts[j].x += wiz.img.x1;
- pts[j].y += wiz.img.y1;
- }
-
- _vm->_wiz->polygonCalcBoundBox(pts, 4, spi->bbox);
}
} else {
bboxPtr->left = 1234;
Index: wiz_he.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.cpp,v
retrieving revision 2.117
retrieving revision 2.118
diff -u -d -r2.117 -r2.118
--- wiz_he.cpp 30 Jan 2006 22:06:53 -0000 2.117
+++ wiz_he.cpp 31 Jan 2006 00:46:20 -0000 2.118
@@ -115,6 +115,35 @@
}
}
+void Wiz::polygonTransform(int resNum, int state, int po_x, int po_y, int angle, int scale, Common::Point *pts) {
+ int32 w, h;
+
+ getWizImageDim(resNum, state, w, h);
+
+ // set the transformation origin to the center of the image
+ pts[1].x = pts[2].x = w / 2 - 1;
+ pts[0].x = pts[0].y = pts[1].y = pts[3].x = -(w / 2);
+ pts[2].y = pts[3].y = h / 2 - 1;
+
+ // scale
+ if (scale != 256) {
+ for (int i = 0; i < 4; ++i) {
+ pts[i].x = pts[i].x * scale / 256;
+ pts[i].y = pts[i].y * scale / 256;
+ }
+ }
+
+ // rotate
+ if (angle)
+ polygonRotatePoints(pts, 4, angle);
+
+ // translate
+ for (int i = 0; i < 4; ++i) {
+ pts[i].x += po_x;
+ pts[i].y += po_y;
+ }
+}
+
void Wiz::polygonCalcBoundBox(Common::Point *vert, int numVerts, Common::Rect &bound) {
bound.left = 10000;
bound.top = 10000;
@@ -921,15 +950,6 @@
_vm->res.setModified(rtImage, resNum);
}
-void Wiz::getWizImageDim(int resNum, int state, int32 &w, int32 &h) {
- uint8 *dataPtr = _vm->getResourceAddress(rtImage, resNum);
- assert(dataPtr);
- uint8 *wizh = _vm->findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
- assert(wizh);
- w = READ_LE_UINT32(wizh + 0x4);
- h = READ_LE_UINT32(wizh + 0x8);
-}
-
void Wiz::displayWizImage(WizImage *pwi) {
if (_vm->_fullRedraw) {
assert(_imagesNum < ARRAYSIZE(_images));
@@ -1181,32 +1201,8 @@
void Wiz::drawWizComplexPolygon(int resNum, int state, int po_x, int po_y, int shadow, int angle, int scale, const Common::Rect *r, int flags, int dstResNum, int palette) {
Common::Point pts[4];
- int32 w, h;
- getWizImageDim(resNum, state, w, h);
-
- // set the transformation origin to the center of the image
- pts[1].x = pts[2].x = w / 2 - 1;
- pts[0].x = pts[0].y = pts[1].y = pts[3].x = -(w / 2);
- pts[2].y = pts[3].y = h / 2 - 1;
-
- // scale
- if (scale != 256) {
- for (int i = 0; i < 4; ++i) {
- pts[i].x = pts[i].x * scale / 256;
- pts[i].y = pts[i].y * scale / 256;
- }
- }
-
- // rotate
- if (angle)
- polygonRotatePoints(pts, 4, angle);
-
- // translate
- for (int i = 0; i < 4; ++i) {
- pts[i].x += po_x;
- pts[i].y += po_y;
- }
+ polygonTransform(resNum, state, po_x, po_y, angle, scale, pts);
drawWizPolygonTransform(resNum, state, pts, flags, shadow, dstResNum, palette);
}
@@ -1393,22 +1389,9 @@
_imagesNum = 0;
}
-void Wiz::loadImgSpot(int resId, int state, int32 &x, int32 &y) {
- uint8 *dataPtr = _vm->getResourceAddress(rtImage, resId);
- assert(dataPtr);
- uint8 *spotPtr = _vm->findWrappedBlock(MKID('SPOT'), dataPtr, state, 0);
- if (spotPtr) {
- x = READ_LE_UINT32(spotPtr + 0);
- y = READ_LE_UINT32(spotPtr + 4);
- } else {
- x = 0;
- y = 0;
- }
-}
-
void Wiz::loadWizCursor(int resId) {
int32 x, y;
- loadImgSpot(resId, 0, x, y);
+ getWizImageSpot(resId, 0, x, y);
if (x < 0) {
x = 0;
} else if (x > 32) {
@@ -1921,6 +1904,28 @@
}
}
+void Wiz::getWizImageDim(int resNum, int state, int32 &w, int32 &h) {
+ uint8 *dataPtr = _vm->getResourceAddress(rtImage, resNum);
+ assert(dataPtr);
+ uint8 *wizh = _vm->findWrappedBlock(MKID('WIZH'), dataPtr, state, 0);
+ assert(wizh);
+ w = READ_LE_UINT32(wizh + 0x4);
+ h = READ_LE_UINT32(wizh + 0x8);
+}
+
+void Wiz::getWizImageSpot(int resId, int state, int32 &x, int32 &y) {
+ uint8 *dataPtr = _vm->getResourceAddress(rtImage, resId);
+ assert(dataPtr);
+ uint8 *spotPtr = _vm->findWrappedBlock(MKID('SPOT'), dataPtr, state, 0);
+ if (spotPtr) {
+ x = READ_LE_UINT32(spotPtr + 0);
+ y = READ_LE_UINT32(spotPtr + 4);
+ } else {
+ x = 0;
+ y = 0;
+ }
+}
+
int Wiz::getWizImageData(int resNum, int state, int type) {
uint8 *dataPtr, *wizh;
Index: wiz_he.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/wiz_he.h,v
retrieving revision 2.39
retrieving revision 2.40
diff -u -d -r2.39 -r2.40
--- wiz_he.h 29 Jan 2006 01:57:46 -0000 2.39
+++ wiz_he.h 31 Jan 2006 00:46:20 -0000 2.40
@@ -160,6 +160,7 @@
bool polygonDefined(int id);
bool polygonContains(const WizPolygon &pol, int x, int y);
void polygonRotatePoints(Common::Point *pts, int num, int alpha);
+ void polygonTransform(int resNum, int state, int po_x, int po_y, int angle, int zoom, Common::Point *vert);
void createWizEmptyImage(const WizParameters *params);
void fillWizRect(const WizParameters *params);
@@ -176,7 +177,7 @@
void flushWizBuffer();
- void loadImgSpot(int resId, int state, int32 &x, int32 &y);
+ void getWizImageSpot(int resId, int state, int32 &x, int32 &y);
void loadWizCursor(int resId);
void captureWizImage(int resNum, const Common::Rect& r, bool frontBuffer, int compType);
More information about the Scummvm-git-logs
mailing list