1 | Index: scummvm/scumm/actor.cpp
|
---|
2 | ===================================================================
|
---|
3 | RCS file: /cvsroot/scummvm/scummvm/scumm/actor.cpp,v
|
---|
4 | retrieving revision 1.314
|
---|
5 | diff -U5 -d -r1.314 actor.cpp
|
---|
6 | --- scummvm/scumm/actor.cpp 12 Oct 2004 14:40:27 -0000 1.314
|
---|
7 | +++ scummvm/scumm/actor.cpp 4 Nov 2004 19:05:00 -0000
|
---|
8 | @@ -1034,11 +1034,11 @@
|
---|
9 | }
|
---|
10 |
|
---|
11 | bcr->_clipOverride = _clipOverride;
|
---|
12 |
|
---|
13 | if (_vm->_version == 4 && boxscale & 0x8000) {
|
---|
14 | - bcr->_scaleX = bcr->_scaleY = _vm->getScale(_walkbox, _pos.x, _pos.y);
|
---|
15 | + bcr->_scaleX = bcr->_scaleY = _vm->getScaleFromSlot((boxscale & 0x7fff) + 1, _pos.x, _pos.y);
|
---|
16 | } else {
|
---|
17 | bcr->_scaleX = scalex;
|
---|
18 | bcr->_scaleY = scaley;
|
---|
19 | }
|
---|
20 |
|
---|
21 | Index: scummvm/scumm/boxes.cpp
|
---|
22 | ===================================================================
|
---|
23 | RCS file: /cvsroot/scummvm/scummvm/scumm/boxes.cpp,v
|
---|
24 | retrieving revision 1.81
|
---|
25 | diff -U5 -d -r1.81 boxes.cpp
|
---|
26 | --- scummvm/scumm/boxes.cpp 28 Sep 2004 23:35:07 -0000 1.81
|
---|
27 | +++ scummvm/scumm/boxes.cpp 4 Nov 2004 19:05:01 -0000
|
---|
28 | @@ -175,44 +175,50 @@
|
---|
29 | slot = 0;
|
---|
30 | }
|
---|
31 |
|
---|
32 | // Was a scale slot specified? If so, we compute the effective scale
|
---|
33 | // from it, ignoring the box scale.
|
---|
34 | - if (slot) {
|
---|
35 | - assert(1 <= slot && slot <= ARRAYSIZE(_scaleSlots));
|
---|
36 | - int scaleX = 0, scaleY = 0;
|
---|
37 | - ScaleSlot &s = _scaleSlots[slot-1];
|
---|
38 | + if (slot)
|
---|
39 | + scale = getScaleFromSlot(slot, x, y);
|
---|
40 | +
|
---|
41 | + return scale;
|
---|
42 | +}
|
---|
43 |
|
---|
44 | - if (s.y1 == s.y2 && s.x1 == s.x2)
|
---|
45 | - error("Invalid scale slot %d", slot);
|
---|
46 |
|
---|
47 | - if (s.y1 != s.y2) {
|
---|
48 | - if (y < 0)
|
---|
49 | - y = 0;
|
---|
50 | +int ScummEngine::getScaleFromSlot(int slot, int x, int y) {
|
---|
51 | + assert(1 <= slot && slot <= ARRAYSIZE(_scaleSlots));
|
---|
52 | + int scale;
|
---|
53 | + int scaleX = 0, scaleY = 0;
|
---|
54 | + ScaleSlot &s = _scaleSlots[slot-1];
|
---|
55 |
|
---|
56 | - scaleY = (s.scale2 - s.scale1) * (y - s.y1) / (s.y2 - s.y1) + s.scale1;
|
---|
57 | - }
|
---|
58 | - if (s.x1 == s.x2) {
|
---|
59 | - scale = scaleY;
|
---|
60 | - } else {
|
---|
61 | - scaleX = (s.scale2 - s.scale1) * (x - s.x1) / (s.x2 - s.x1) + s.scale1;
|
---|
62 | + if (s.y1 == s.y2 && s.x1 == s.x2)
|
---|
63 | + error("Invalid scale slot %d", slot);
|
---|
64 |
|
---|
65 | - if (s.y1 == s.y2) {
|
---|
66 | - scale = scaleX;
|
---|
67 | - } else {
|
---|
68 | - scale = (scaleX + scaleY) / 2;
|
---|
69 | - }
|
---|
70 | - }
|
---|
71 | + if (s.y1 != s.y2) {
|
---|
72 | + if (y < 0)
|
---|
73 | + y = 0;
|
---|
74 |
|
---|
75 | - // Clip the scale to range 1-255
|
---|
76 | - if (scale < 1)
|
---|
77 | - scale = 1;
|
---|
78 | - else if (scale > 255)
|
---|
79 | - scale = 255;
|
---|
80 | + scaleY = (s.scale2 - s.scale1) * (y - s.y1) / (s.y2 - s.y1) + s.scale1;
|
---|
81 | + }
|
---|
82 | + if (s.x1 == s.x2) {
|
---|
83 | + scale = scaleY;
|
---|
84 | + } else {
|
---|
85 | + scaleX = (s.scale2 - s.scale1) * (x - s.x1) / (s.x2 - s.x1) + s.scale1;
|
---|
86 | +
|
---|
87 | + if (s.y1 == s.y2) {
|
---|
88 | + scale = scaleX;
|
---|
89 | + } else {
|
---|
90 | + scale = (scaleX + scaleY) / 2;
|
---|
91 | + }
|
---|
92 | }
|
---|
93 | +
|
---|
94 | + // Clip the scale to range 1-255
|
---|
95 | + if (scale < 1)
|
---|
96 | + scale = 1;
|
---|
97 | + else if (scale > 255)
|
---|
98 | + scale = 255;
|
---|
99 |
|
---|
100 | - // Finally return the scale
|
---|
101 | return scale;
|
---|
102 | }
|
---|
103 |
|
---|
104 | int ScummEngine::getBoxScale(int box) {
|
---|
105 | if (_features & GF_NO_SCALING)
|
---|
106 | Index: scummvm/scumm/scumm.h
|
---|
107 | ===================================================================
|
---|
108 | RCS file: /cvsroot/scummvm/scummvm/scumm/scumm.h,v
|
---|
109 | retrieving revision 1.513
|
---|
110 | diff -U5 -d -r1.513 scumm.h
|
---|
111 | --- scummvm/scumm/scumm.h 24 Oct 2004 06:58:41 -0000 1.513
|
---|
112 | +++ scummvm/scumm/scumm.h 4 Nov 2004 19:05:02 -0000
|
---|
113 | @@ -1115,10 +1115,11 @@
|
---|
114 | Box *getBoxBaseAddr(int box);
|
---|
115 | byte getBoxFlags(int box);
|
---|
116 | int getBoxScale(int box);
|
---|
117 |
|
---|
118 | int getScale(int box, int x, int y);
|
---|
119 | + int getScaleFromSlot(int slot, int x, int y);
|
---|
120 |
|
---|
121 | protected:
|
---|
122 | // Scaling slots/items
|
---|
123 | struct ScaleSlot {
|
---|
124 | int x1, y1, scale1;
|
---|