[Scummvm-cvs-logs] CVS: scummvm/scumm actor.cpp,1.314,1.315 boxes.cpp,1.81,1.82 scumm.h,1.513,1.514
Travis Howell
kirben at users.sourceforge.net
Thu Nov 4 21:20:19 CET 2004
Update of /cvsroot/scummvm/scummvm/scumm
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20904/scumm
Modified Files:
actor.cpp boxes.cpp scumm.h
Log Message:
Add patch #1060453 - MIVGA: Actor Scale Patch
Index: actor.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
retrieving revision 1.314
retrieving revision 1.315
diff -u -d -r1.314 -r1.315
--- actor.cpp 12 Oct 2004 14:40:27 -0000 1.314
+++ actor.cpp 5 Nov 2004 05:13:56 -0000 1.315
@@ -1036,7 +1036,7 @@
bcr->_clipOverride = _clipOverride;
if (_vm->_version == 4 && boxscale & 0x8000) {
- bcr->_scaleX = bcr->_scaleY = _vm->getScale(_walkbox, _pos.x, _pos.y);
+ bcr->_scaleX = bcr->_scaleY = _vm->getScaleFromSlot((boxscale & 0x7fff) + 1, _pos.x, _pos.y);
} else {
bcr->_scaleX = scalex;
bcr->_scaleY = scaley;
Index: boxes.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/boxes.cpp,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -d -r1.81 -r1.82
--- boxes.cpp 28 Sep 2004 23:35:07 -0000 1.81
+++ boxes.cpp 5 Nov 2004 05:13:56 -0000 1.82
@@ -177,40 +177,46 @@
// Was a scale slot specified? If so, we compute the effective scale
// from it, ignoring the box scale.
- if (slot) {
- assert(1 <= slot && slot <= ARRAYSIZE(_scaleSlots));
- int scaleX = 0, scaleY = 0;
- ScaleSlot &s = _scaleSlots[slot-1];
+ if (slot)
+ scale = getScaleFromSlot(slot, x, y);
+
+ return scale;
+}
- if (s.y1 == s.y2 && s.x1 == s.x2)
- error("Invalid scale slot %d", slot);
- if (s.y1 != s.y2) {
- if (y < 0)
- y = 0;
+int ScummEngine::getScaleFromSlot(int slot, int x, int y) {
+ assert(1 <= slot && slot <= ARRAYSIZE(_scaleSlots));
+ int scale;
+ int scaleX = 0, scaleY = 0;
+ ScaleSlot &s = _scaleSlots[slot-1];
- scaleY = (s.scale2 - s.scale1) * (y - s.y1) / (s.y2 - s.y1) + s.scale1;
- }
- if (s.x1 == s.x2) {
- scale = scaleY;
- } else {
- scaleX = (s.scale2 - s.scale1) * (x - s.x1) / (s.x2 - s.x1) + s.scale1;
+ if (s.y1 == s.y2 && s.x1 == s.x2)
+ error("Invalid scale slot %d", slot);
- if (s.y1 == s.y2) {
- scale = scaleX;
- } else {
- scale = (scaleX + scaleY) / 2;
- }
- }
+ if (s.y1 != s.y2) {
+ if (y < 0)
+ y = 0;
- // Clip the scale to range 1-255
- if (scale < 1)
- scale = 1;
- else if (scale > 255)
- scale = 255;
+ scaleY = (s.scale2 - s.scale1) * (y - s.y1) / (s.y2 - s.y1) + s.scale1;
+ }
+ if (s.x1 == s.x2) {
+ scale = scaleY;
+ } else {
+ scaleX = (s.scale2 - s.scale1) * (x - s.x1) / (s.x2 - s.x1) + s.scale1;
+
+ if (s.y1 == s.y2) {
+ scale = scaleX;
+ } else {
+ scale = (scaleX + scaleY) / 2;
+ }
}
+
+ // Clip the scale to range 1-255
+ if (scale < 1)
+ scale = 1;
+ else if (scale > 255)
+ scale = 255;
- // Finally return the scale
return scale;
}
Index: scumm.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
retrieving revision 1.513
retrieving revision 1.514
diff -u -d -r1.513 -r1.514
--- scumm.h 24 Oct 2004 06:58:41 -0000 1.513
+++ scumm.h 5 Nov 2004 05:13:56 -0000 1.514
@@ -1117,6 +1117,7 @@
int getBoxScale(int box);
int getScale(int box, int x, int y);
+ int getScaleFromSlot(int slot, int x, int y);
protected:
// Scaling slots/items
More information about the Scummvm-git-logs
mailing list