| 1 | diff -cr scummvm.old/common/endian.h scummvm/common/endian.h
|
|---|
| 2 | *** scummvm.old/common/endian.h Sat Sep 23 06:47:49 2006
|
|---|
| 3 | --- scummvm/common/endian.h Sun Oct 1 15:37:28 2006
|
|---|
| 4 | ***************
|
|---|
| 5 | *** 91,96 ****
|
|---|
| 6 | --- 91,99 ----
|
|---|
| 7 | #define FROM_LE_32(a) ((uint32)(a))
|
|---|
| 8 | #define FROM_LE_16(a) ((uint16)(a))
|
|---|
| 9 |
|
|---|
| 10 | + #define FROM_BE_32(a) SWAP_BYTES_32(a)
|
|---|
| 11 | + #define FROM_BE_16(a) SWAP_BYTES_16(a)
|
|---|
| 12 | +
|
|---|
| 13 | #define TO_LE_32(a) ((uint32)(a))
|
|---|
| 14 | #define TO_LE_16(a) ((uint16)(a))
|
|---|
| 15 |
|
|---|
| 16 | ***************
|
|---|
| 17 | *** 111,116 ****
|
|---|
| 18 | --- 114,122 ----
|
|---|
| 19 | #define FROM_LE_32(a) SWAP_BYTES_32(a)
|
|---|
| 20 | #define FROM_LE_16(a) SWAP_BYTES_16(a)
|
|---|
| 21 |
|
|---|
| 22 | + #define FROM_BE_32(a) ((uint32)(a))
|
|---|
| 23 | + #define FROM_BE_16(a) ((uint16)(a))
|
|---|
| 24 | +
|
|---|
| 25 | #define TO_LE_32(a) SWAP_BYTES_32(a)
|
|---|
| 26 | #define TO_LE_16(a) SWAP_BYTES_16(a)
|
|---|
| 27 |
|
|---|
| 28 | diff -cr scummvm.old/engines/sword1/control.cpp scummvm/engines/sword1/control.cpp
|
|---|
| 29 | *** scummvm.old/engines/sword1/control.cpp Sat Sep 23 06:46:07 2006
|
|---|
| 30 | --- scummvm/engines/sword1/control.cpp Thu Oct 5 20:48:36 2006
|
|---|
| 31 | ***************
|
|---|
| 32 | *** 21,27 ****
|
|---|
| 33 | */
|
|---|
| 34 |
|
|---|
| 35 | #include "common/stdafx.h"
|
|---|
| 36 | - #include "common/endian.h"
|
|---|
| 37 | #include "common/file.h"
|
|---|
| 38 | #include "common/util.h"
|
|---|
| 39 | #include "common/savefile.h"
|
|---|
| 40 | --- 21,26 ----
|
|---|
| 41 | ***************
|
|---|
| 42 | *** 118,125 ****
|
|---|
| 43 | _frameIdx = 0;
|
|---|
| 44 | _resMan->resOpen(_resId);
|
|---|
| 45 | FrameHeader *tmp = _resMan->fetchFrame(_resMan->fetchRes(_resId), 0);
|
|---|
| 46 | ! _width = FROM_LE_16(tmp->width);
|
|---|
| 47 | ! _height = FROM_LE_16(tmp->height);
|
|---|
| 48 | if ((x == 0) && (y == 0)) { // center the frame (used for panels);
|
|---|
| 49 | _x = (640 - _width) / 2;
|
|---|
| 50 | _y = (480 - _height) / 2;
|
|---|
| 51 | --- 117,124 ----
|
|---|
| 52 | _frameIdx = 0;
|
|---|
| 53 | _resMan->resOpen(_resId);
|
|---|
| 54 | FrameHeader *tmp = _resMan->fetchFrame(_resMan->fetchRes(_resId), 0);
|
|---|
| 55 | ! _width = _resMan->getUint16(tmp->width);
|
|---|
| 56 | ! _height = _resMan->getUint16(tmp->height);
|
|---|
| 57 | if ((x == 0) && (y == 0)) { // center the frame (used for panels);
|
|---|
| 58 | _x = (640 - _width) / 2;
|
|---|
| 59 | _y = (480 - _height) / 2;
|
|---|
| 60 | ***************
|
|---|
| 61 | *** 140,151 ****
|
|---|
| 62 | FrameHeader *fHead = _resMan->fetchFrame(_resMan->fetchRes(_resId), _frameIdx);
|
|---|
| 63 | uint8 *src = (uint8*)fHead + sizeof(FrameHeader);
|
|---|
| 64 | uint8 *dst = _dstBuf;
|
|---|
| 65 | ! for (uint16 cnt = 0; cnt < READ_LE_UINT16(&fHead->height); cnt++) {
|
|---|
| 66 | ! for (uint16 cntx = 0; cntx < READ_LE_UINT16(&fHead->width); cntx++)
|
|---|
| 67 | if (src[cntx])
|
|---|
| 68 | dst[cntx] = src[cntx];
|
|---|
| 69 | dst += SCREEN_WIDTH;
|
|---|
| 70 | ! src += READ_LE_UINT16(&fHead->width);
|
|---|
| 71 | }
|
|---|
| 72 | _system->copyRectToScreen(_dstBuf, SCREEN_WIDTH, _x, _y, _width, _height);
|
|---|
| 73 | }
|
|---|
| 74 | --- 139,150 ----
|
|---|
| 75 | FrameHeader *fHead = _resMan->fetchFrame(_resMan->fetchRes(_resId), _frameIdx);
|
|---|
| 76 | uint8 *src = (uint8*)fHead + sizeof(FrameHeader);
|
|---|
| 77 | uint8 *dst = _dstBuf;
|
|---|
| 78 | ! for (uint16 cnt = 0; cnt < _resMan->readUint16(&fHead->height); cnt++) {
|
|---|
| 79 | ! for (uint16 cntx = 0; cntx < _resMan->readUint16(&fHead->width); cntx++)
|
|---|
| 80 | if (src[cntx])
|
|---|
| 81 | dst[cntx] = src[cntx];
|
|---|
| 82 | dst += SCREEN_WIDTH;
|
|---|
| 83 | ! src += _resMan->readUint16(&fHead->width);
|
|---|
| 84 | }
|
|---|
| 85 | _system->copyRectToScreen(_dstBuf, SCREEN_WIDTH, _x, _y, _width, _height);
|
|---|
| 86 | }
|
|---|
| 87 | ***************
|
|---|
| 88 | *** 485,492 ****
|
|---|
| 89 |
|
|---|
| 90 | void Control::setupSaveRestorePanel(bool saving) {
|
|---|
| 91 | FrameHeader *savePanel = _resMan->fetchFrame(_resMan->openFetchRes(SR_WINDOW), 0);
|
|---|
| 92 | ! uint16 panelX = (640 - FROM_LE_16(savePanel->width)) / 2;
|
|---|
| 93 | ! uint16 panelY = (480 - FROM_LE_16(savePanel->height)) / 2;
|
|---|
| 94 | ControlButton *panel = new ControlButton(panelX, panelY, SR_WINDOW, 0, 0, _resMan, _screenBuf, _system);
|
|---|
| 95 | panel->draw();
|
|---|
| 96 | delete panel;
|
|---|
| 97 | --- 484,491 ----
|
|---|
| 98 |
|
|---|
| 99 | void Control::setupSaveRestorePanel(bool saving) {
|
|---|
| 100 | FrameHeader *savePanel = _resMan->fetchFrame(_resMan->openFetchRes(SR_WINDOW), 0);
|
|---|
| 101 | ! uint16 panelX = (640 - _resMan->getUint16(savePanel->width)) / 2;
|
|---|
| 102 | ! uint16 panelY = (480 - _resMan->getUint16(savePanel->height)) / 2;
|
|---|
| 103 | ControlButton *panel = new ControlButton(panelX, panelY, SR_WINDOW, 0, 0, _resMan, _screenBuf, _system);
|
|---|
| 104 | panel->draw();
|
|---|
| 105 | delete panel;
|
|---|
| 106 | ***************
|
|---|
| 107 | *** 870,876 ****
|
|---|
| 108 | uint16 Control::getTextWidth(const uint8 *str) {
|
|---|
| 109 | uint16 width = 0;
|
|---|
| 110 | while (*str) {
|
|---|
| 111 | ! width += FROM_LE_16(_resMan->fetchFrame(_font, *str - 32)->width) - 3;
|
|---|
| 112 | str++;
|
|---|
| 113 | }
|
|---|
| 114 | return width;
|
|---|
| 115 | --- 869,875 ----
|
|---|
| 116 | uint16 Control::getTextWidth(const uint8 *str) {
|
|---|
| 117 | uint16 width = 0;
|
|---|
| 118 | while (*str) {
|
|---|
| 119 | ! width += _resMan->getUint16(_resMan->fetchFrame(_font, *str - 32)->width) - 3;
|
|---|
| 120 | str++;
|
|---|
| 121 | }
|
|---|
| 122 | return width;
|
|---|
| 123 | ***************
|
|---|
| 124 | *** 894,908 ****
|
|---|
| 125 |
|
|---|
| 126 | FrameHeader *chSpr = _resMan->fetchFrame(font, *str - 32);
|
|---|
| 127 | uint8 *sprData = (uint8*)chSpr + sizeof(FrameHeader);
|
|---|
| 128 | ! for (uint16 cnty = 0; cnty < FROM_LE_16(chSpr->height); cnty++) {
|
|---|
| 129 | ! for (uint16 cntx = 0; cntx < FROM_LE_16(chSpr->width); cntx++) {
|
|---|
| 130 | if (sprData[cntx])
|
|---|
| 131 | dst[cntx] = sprData[cntx];
|
|---|
| 132 | }
|
|---|
| 133 | ! sprData += FROM_LE_16(chSpr->width);
|
|---|
| 134 | dst += SCREEN_WIDTH;
|
|---|
| 135 | }
|
|---|
| 136 | ! destX += FROM_LE_16(chSpr->width) - 3;
|
|---|
| 137 | str++;
|
|---|
| 138 | }
|
|---|
| 139 | _system->copyRectToScreen(_screenBuf + y * SCREEN_WIDTH + x, SCREEN_WIDTH, x, y, (destX - x) + 3, 28);
|
|---|
| 140 | --- 893,907 ----
|
|---|
| 141 |
|
|---|
| 142 | FrameHeader *chSpr = _resMan->fetchFrame(font, *str - 32);
|
|---|
| 143 | uint8 *sprData = (uint8*)chSpr + sizeof(FrameHeader);
|
|---|
| 144 | ! for (uint16 cnty = 0; cnty < _resMan->getUint16(chSpr->height); cnty++) {
|
|---|
| 145 | ! for (uint16 cntx = 0; cntx < _resMan->getUint16(chSpr->width); cntx++) {
|
|---|
| 146 | if (sprData[cntx])
|
|---|
| 147 | dst[cntx] = sprData[cntx];
|
|---|
| 148 | }
|
|---|
| 149 | ! sprData += _resMan->getUint16(chSpr->width);
|
|---|
| 150 | dst += SCREEN_WIDTH;
|
|---|
| 151 | }
|
|---|
| 152 | ! destX += _resMan->getUint16(chSpr->width) - 3;
|
|---|
| 153 | str++;
|
|---|
| 154 | }
|
|---|
| 155 | _system->copyRectToScreen(_screenBuf + y * SCREEN_WIDTH + x, SCREEN_WIDTH, x, y, (destX - x) + 3, 28);
|
|---|
| 156 | ***************
|
|---|
| 157 | *** 917,928 ****
|
|---|
| 158 | FrameHeader *frHead = _resMan->fetchFrame(_resMan->openFetchRes(SR_VLIGHT), (vol + 15) >> 4);
|
|---|
| 159 | uint8 *destMem = _screenBuf + destY * SCREEN_WIDTH + destX;
|
|---|
| 160 | uint8 *srcMem = (uint8*)frHead + sizeof(FrameHeader);
|
|---|
| 161 | ! for (uint16 cnty = 0; cnty < FROM_LE_16(frHead->height); cnty++) {
|
|---|
| 162 | ! memcpy(destMem, srcMem, FROM_LE_16(frHead->width));
|
|---|
| 163 | ! srcMem += FROM_LE_16(frHead->width);
|
|---|
| 164 | destMem += SCREEN_WIDTH;
|
|---|
| 165 | }
|
|---|
| 166 | ! _system->copyRectToScreen(_screenBuf + destY * SCREEN_WIDTH + destX, SCREEN_WIDTH, destX, destY, FROM_LE_16(frHead->width), FROM_LE_16(frHead->height));
|
|---|
| 167 | _resMan->resClose(SR_VLIGHT);
|
|---|
| 168 | destX += 32;
|
|---|
| 169 | }
|
|---|
| 170 | --- 916,927 ----
|
|---|
| 171 | FrameHeader *frHead = _resMan->fetchFrame(_resMan->openFetchRes(SR_VLIGHT), (vol + 15) >> 4);
|
|---|
| 172 | uint8 *destMem = _screenBuf + destY * SCREEN_WIDTH + destX;
|
|---|
| 173 | uint8 *srcMem = (uint8*)frHead + sizeof(FrameHeader);
|
|---|
| 174 | ! for (uint16 cnty = 0; cnty < _resMan->getUint16(frHead->height); cnty++) {
|
|---|
| 175 | ! memcpy(destMem, srcMem, _resMan->getUint16(frHead->width));
|
|---|
| 176 | ! srcMem += _resMan->getUint16(frHead->width);
|
|---|
| 177 | destMem += SCREEN_WIDTH;
|
|---|
| 178 | }
|
|---|
| 179 | ! _system->copyRectToScreen(_screenBuf + destY * SCREEN_WIDTH + destX, SCREEN_WIDTH, destX, destY, _resMan->getUint16(frHead->width), _resMan->getUint16(frHead->height));
|
|---|
| 180 | _resMan->resClose(SR_VLIGHT);
|
|---|
| 181 | destX += 32;
|
|---|
| 182 | }
|
|---|
| 183 | diff -cr scummvm.old/engines/sword1/logic.cpp scummvm/engines/sword1/logic.cpp
|
|---|
| 184 | *** scummvm.old/engines/sword1/logic.cpp Sat Sep 23 06:46:07 2006
|
|---|
| 185 | --- scummvm/engines/sword1/logic.cpp Thu Oct 5 22:45:27 2006
|
|---|
| 186 | ***************
|
|---|
| 187 | *** 355,361 ****
|
|---|
| 188 | }
|
|---|
| 189 | if (compact->o_anim_resource) {
|
|---|
| 190 | uint8 *animData = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
|
|---|
| 191 | ! int32 numFrames = READ_LE_UINT32(animData);
|
|---|
| 192 | animData += 4;
|
|---|
| 193 | compact->o_anim_pc++; // go to next frame of anim
|
|---|
| 194 |
|
|---|
| 195 | --- 355,361 ----
|
|---|
| 196 | }
|
|---|
| 197 | if (compact->o_anim_resource) {
|
|---|
| 198 | uint8 *animData = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
|
|---|
| 199 | ! int32 numFrames = _resMan->readUint32(animData);
|
|---|
| 200 | animData += 4;
|
|---|
| 201 | compact->o_anim_pc++; // go to next frame of anim
|
|---|
| 202 |
|
|---|
| 203 | ***************
|
|---|
| 204 | *** 365,374 ****
|
|---|
| 205 |
|
|---|
| 206 | AnimUnit *animPtr = (AnimUnit*)(animData + sizeof(AnimUnit) * compact->o_anim_pc);
|
|---|
| 207 | if (!(compact->o_status & STAT_SHRINK)) {
|
|---|
| 208 | ! compact->o_anim_x = FROM_LE_32(animPtr->animX);
|
|---|
| 209 | ! compact->o_anim_y = FROM_LE_32(animPtr->animY);
|
|---|
| 210 | }
|
|---|
| 211 | ! compact->o_frame = FROM_LE_32(animPtr->animFrame);
|
|---|
| 212 | _resMan->resClose(compact->o_anim_resource);
|
|---|
| 213 | }
|
|---|
| 214 | return 0;
|
|---|
| 215 | --- 365,374 ----
|
|---|
| 216 |
|
|---|
| 217 | AnimUnit *animPtr = (AnimUnit*)(animData + sizeof(AnimUnit) * compact->o_anim_pc);
|
|---|
| 218 | if (!(compact->o_status & STAT_SHRINK)) {
|
|---|
| 219 | ! compact->o_anim_x = _resMan->getUint32(animPtr->animX);
|
|---|
| 220 | ! compact->o_anim_y = _resMan->getUint32(animPtr->animY);
|
|---|
| 221 | }
|
|---|
| 222 | ! compact->o_frame = _resMan->getUint32(animPtr->animFrame);
|
|---|
| 223 | _resMan->resClose(compact->o_anim_resource);
|
|---|
| 224 | }
|
|---|
| 225 | return 0;
|
|---|
| 226 | ***************
|
|---|
| 227 | *** 380,392 ****
|
|---|
| 228 | return 1;
|
|---|
| 229 | }
|
|---|
| 230 | uint8 *data = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
|
|---|
| 231 | ! uint32 numFrames = READ_LE_UINT32(data);
|
|---|
| 232 | data += 4;
|
|---|
| 233 | AnimUnit *animPtr = (AnimUnit*)(data + compact->o_anim_pc * sizeof(AnimUnit));
|
|---|
| 234 |
|
|---|
| 235 | ! compact->o_anim_x = compact->o_xcoord = FROM_LE_32(animPtr->animX);
|
|---|
| 236 | ! compact->o_anim_y = compact->o_ycoord = FROM_LE_32(animPtr->animY);
|
|---|
| 237 | ! compact->o_frame = FROM_LE_32(animPtr->animFrame);
|
|---|
| 238 |
|
|---|
| 239 | compact->o_anim_pc++;
|
|---|
| 240 | if (compact->o_anim_pc == (int)numFrames)
|
|---|
| 241 | --- 380,392 ----
|
|---|
| 242 | return 1;
|
|---|
| 243 | }
|
|---|
| 244 | uint8 *data = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
|
|---|
| 245 | ! uint32 numFrames = _resMan->readUint32(data);
|
|---|
| 246 | data += 4;
|
|---|
| 247 | AnimUnit *animPtr = (AnimUnit*)(data + compact->o_anim_pc * sizeof(AnimUnit));
|
|---|
| 248 |
|
|---|
| 249 | ! compact->o_anim_x = compact->o_xcoord = _resMan->getUint32(animPtr->animX);
|
|---|
| 250 | ! compact->o_anim_y = compact->o_ycoord = _resMan->getUint32(animPtr->animY);
|
|---|
| 251 | ! compact->o_frame = _resMan->getUint32(animPtr->animFrame);
|
|---|
| 252 |
|
|---|
| 253 | compact->o_anim_pc++;
|
|---|
| 254 | if (compact->o_anim_pc == (int)numFrames)
|
|---|
| 255 | ***************
|
|---|
| 256 | *** 402,416 ****
|
|---|
| 257 | return 1;
|
|---|
| 258 | }
|
|---|
| 259 | uint8 *data = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
|
|---|
| 260 | ! uint32 numFrames = READ_LE_UINT32(data);
|
|---|
| 261 | AnimUnit *animPtr = (AnimUnit*)(data + 4 + compact->o_anim_pc * sizeof(AnimUnit));
|
|---|
| 262 |
|
|---|
| 263 | if (!(compact->o_status & STAT_SHRINK)) {
|
|---|
| 264 | ! compact->o_anim_x = FROM_LE_32(animPtr->animX);
|
|---|
| 265 | ! compact->o_anim_y = FROM_LE_32(animPtr->animY);
|
|---|
| 266 | }
|
|---|
| 267 |
|
|---|
| 268 | ! compact->o_frame = FROM_LE_32(animPtr->animFrame);
|
|---|
| 269 | compact->o_anim_pc++;
|
|---|
| 270 | if (compact->o_anim_pc == (int)numFrames)
|
|---|
| 271 | compact->o_logic = LOGIC_script;
|
|---|
| 272 | --- 402,416 ----
|
|---|
| 273 | return 1;
|
|---|
| 274 | }
|
|---|
| 275 | uint8 *data = ((uint8*)_resMan->openFetchRes(compact->o_anim_resource)) + sizeof(Header);
|
|---|
| 276 | ! uint32 numFrames = _resMan->readUint32(data);
|
|---|
| 277 | AnimUnit *animPtr = (AnimUnit*)(data + 4 + compact->o_anim_pc * sizeof(AnimUnit));
|
|---|
| 278 |
|
|---|
| 279 | if (!(compact->o_status & STAT_SHRINK)) {
|
|---|
| 280 | ! compact->o_anim_x = _resMan->getUint32(animPtr->animX);
|
|---|
| 281 | ! compact->o_anim_y = _resMan->getUint32(animPtr->animY);
|
|---|
| 282 | }
|
|---|
| 283 |
|
|---|
| 284 | ! compact->o_frame = _resMan->getUint32(animPtr->animFrame);
|
|---|
| 285 | compact->o_anim_pc++;
|
|---|
| 286 | if (compact->o_anim_pc == (int)numFrames)
|
|---|
| 287 | compact->o_logic = LOGIC_script;
|
|---|
| 288 | ***************
|
|---|
| 289 | *** 828,835 ****
|
|---|
| 290 | animTab = (AnimSet*)((uint8*)_resMan->openFetchRes(cdt) + sizeof(Header));
|
|---|
| 291 | animTab += cpt->o_dir;
|
|---|
| 292 |
|
|---|
| 293 | ! cpt->o_anim_resource = FROM_LE_32(animTab->cdt);
|
|---|
| 294 | ! cpt->o_resource = FROM_LE_32(animTab->spr);
|
|---|
| 295 | _resMan->resClose(cdt);
|
|---|
| 296 | } else {
|
|---|
| 297 | cpt->o_anim_resource = cdt;
|
|---|
| 298 | --- 828,835 ----
|
|---|
| 299 | animTab = (AnimSet*)((uint8*)_resMan->openFetchRes(cdt) + sizeof(Header));
|
|---|
| 300 | animTab += cpt->o_dir;
|
|---|
| 301 |
|
|---|
| 302 | ! cpt->o_anim_resource = _resMan->getUint32(animTab->cdt);
|
|---|
| 303 | ! cpt->o_resource = _resMan->getUint32(animTab->spr);
|
|---|
| 304 | _resMan->resClose(cdt);
|
|---|
| 305 | } else {
|
|---|
| 306 | cpt->o_anim_resource = cdt;
|
|---|
| 307 | ***************
|
|---|
| 308 | *** 862,875 ****
|
|---|
| 309 | uint8 *data = (uint8*)_resMan->openFetchRes(cdt);
|
|---|
| 310 | data += sizeof(Header);
|
|---|
| 311 | if (frameNo == LAST_FRAME)
|
|---|
| 312 | ! frameNo = READ_LE_UINT32(data) - 1;
|
|---|
| 313 |
|
|---|
| 314 | data += 4;
|
|---|
| 315 | animPtr = (AnimUnit*)(data + frameNo * sizeof(AnimUnit));
|
|---|
| 316 |
|
|---|
| 317 | ! cpt->o_anim_x = FROM_LE_32(animPtr->animX);
|
|---|
| 318 | ! cpt->o_anim_y = FROM_LE_32(animPtr->animY);
|
|---|
| 319 | ! cpt->o_frame = FROM_LE_32(animPtr->animFrame);
|
|---|
| 320 |
|
|---|
| 321 | cpt->o_resource = spr;
|
|---|
| 322 | cpt->o_status &= ~STAT_SHRINK;
|
|---|
| 323 | --- 862,875 ----
|
|---|
| 324 | uint8 *data = (uint8*)_resMan->openFetchRes(cdt);
|
|---|
| 325 | data += sizeof(Header);
|
|---|
| 326 | if (frameNo == LAST_FRAME)
|
|---|
| 327 | ! frameNo = _resMan->readUint32(data) - 1;
|
|---|
| 328 |
|
|---|
| 329 | data += 4;
|
|---|
| 330 | animPtr = (AnimUnit*)(data + frameNo * sizeof(AnimUnit));
|
|---|
| 331 |
|
|---|
| 332 | ! cpt->o_anim_x = _resMan->getUint32(animPtr->animX);
|
|---|
| 333 | ! cpt->o_anim_y = _resMan->getUint32(animPtr->animY);
|
|---|
| 334 | ! cpt->o_frame = _resMan->getUint32(animPtr->animFrame);
|
|---|
| 335 |
|
|---|
| 336 | cpt->o_resource = spr;
|
|---|
| 337 | cpt->o_status &= ~STAT_SHRINK;
|
|---|
| 338 | ***************
|
|---|
| 339 | *** 892,904 ****
|
|---|
| 340 | uint8 *data = (uint8*)_resMan->openFetchRes(cdt) + sizeof(Header);
|
|---|
| 341 |
|
|---|
| 342 | if (frameNo == LAST_FRAME)
|
|---|
| 343 | ! frameNo = READ_LE_UINT32(data) - 1;
|
|---|
| 344 | data += 4;
|
|---|
| 345 |
|
|---|
| 346 | AnimUnit *animPtr = (AnimUnit*)(data + sizeof(AnimUnit) * frameNo);
|
|---|
| 347 | ! cpt->o_anim_x = cpt->o_xcoord = FROM_LE_32(animPtr->animX);
|
|---|
| 348 | ! cpt->o_anim_y = cpt->o_ycoord = FROM_LE_32(animPtr->animY);
|
|---|
| 349 | ! cpt->o_frame = FROM_LE_32(animPtr->animFrame);
|
|---|
| 350 |
|
|---|
| 351 | cpt->o_resource = spr;
|
|---|
| 352 | cpt->o_status &= ~STAT_SHRINK;
|
|---|
| 353 | --- 892,904 ----
|
|---|
| 354 | uint8 *data = (uint8*)_resMan->openFetchRes(cdt) + sizeof(Header);
|
|---|
| 355 |
|
|---|
| 356 | if (frameNo == LAST_FRAME)
|
|---|
| 357 | ! frameNo = _resMan->readUint32(data) - 1;
|
|---|
| 358 | data += 4;
|
|---|
| 359 |
|
|---|
| 360 | AnimUnit *animPtr = (AnimUnit*)(data + sizeof(AnimUnit) * frameNo);
|
|---|
| 361 | ! cpt->o_anim_x = cpt->o_xcoord = _resMan->getUint32(animPtr->animX);
|
|---|
| 362 | ! cpt->o_anim_y = cpt->o_ycoord = _resMan->getUint32(animPtr->animY);
|
|---|
| 363 | ! cpt->o_frame = _resMan->getUint32(animPtr->animFrame);
|
|---|
| 364 |
|
|---|
| 365 | cpt->o_resource = spr;
|
|---|
| 366 | cpt->o_status &= ~STAT_SHRINK;
|
|---|
| 367 | ***************
|
|---|
| 368 | *** 1116,1124 ****
|
|---|
| 369 | AnimSet *animTab = (AnimSet*)((uint8*)_resMan->openFetchRes(cdt) + sizeof(Header));
|
|---|
| 370 | animTab += cpt->o_dir;
|
|---|
| 371 |
|
|---|
| 372 | ! cpt->o_anim_resource = FROM_LE_32(animTab->cdt);
|
|---|
| 373 | if (animTab->cdt)
|
|---|
| 374 | ! cpt->o_resource = FROM_LE_32(animTab->spr);
|
|---|
| 375 | _resMan->resClose(cdt);
|
|---|
| 376 | } else {
|
|---|
| 377 | cpt->o_anim_resource = cdt;
|
|---|
| 378 | --- 1116,1124 ----
|
|---|
| 379 | AnimSet *animTab = (AnimSet*)((uint8*)_resMan->openFetchRes(cdt) + sizeof(Header));
|
|---|
| 380 | animTab += cpt->o_dir;
|
|---|
| 381 |
|
|---|
| 382 | ! cpt->o_anim_resource = _resMan->getUint32(animTab->cdt);
|
|---|
| 383 | if (animTab->cdt)
|
|---|
| 384 | ! cpt->o_resource = _resMan->getUint32(animTab->spr);
|
|---|
| 385 | _resMan->resClose(cdt);
|
|---|
| 386 | } else {
|
|---|
| 387 | cpt->o_anim_resource = cdt;
|
|---|
| 388 | ***************
|
|---|
| 389 | *** 1158,1165 ****
|
|---|
| 390 | textCpt->o_target = textCptId;
|
|---|
| 391 |
|
|---|
| 392 | // the graphic is a property of Text, so we don't lock/unlock it.
|
|---|
| 393 | ! uint16 textSpriteWidth = FROM_LE_16(_textMan->giveSpriteData(textCpt->o_target)->width);
|
|---|
| 394 | ! uint16 textSpriteHeight = FROM_LE_16(_textMan->giveSpriteData(textCpt->o_target)->height);
|
|---|
| 395 |
|
|---|
| 396 | cpt->o_text_id = textCptId;
|
|---|
| 397 |
|
|---|
| 398 | --- 1158,1165 ----
|
|---|
| 399 | textCpt->o_target = textCptId;
|
|---|
| 400 |
|
|---|
| 401 | // the graphic is a property of Text, so we don't lock/unlock it.
|
|---|
| 402 | ! uint16 textSpriteWidth = _resMan->getUint16(_textMan->giveSpriteData(textCpt->o_target)->width);
|
|---|
| 403 | ! uint16 textSpriteHeight = _resMan->getUint16(_textMan->giveSpriteData(textCpt->o_target)->height);
|
|---|
| 404 |
|
|---|
| 405 | cpt->o_text_id = textCptId;
|
|---|
| 406 |
|
|---|
| 407 | ***************
|
|---|
| 408 | *** 1717,1722 ****
|
|---|
| 409 | --- 1717,1724 ----
|
|---|
| 410 | }
|
|---|
| 411 |
|
|---|
| 412 | void Logic::runStartScript(const uint8 *data) {
|
|---|
| 413 | + // Here data is a static resource defined in staticres.cpp
|
|---|
| 414 | + // It is always in little endian
|
|---|
| 415 | uint16 varId = 0;
|
|---|
| 416 | uint8 fnId = 0;
|
|---|
| 417 | uint32 param1 = 0;
|
|---|
| 418 | diff -cr scummvm.old/engines/sword1/mouse.cpp scummvm/engines/sword1/mouse.cpp
|
|---|
| 419 | *** scummvm.old/engines/sword1/mouse.cpp Sat Sep 23 06:46:06 2006
|
|---|
| 420 | --- scummvm/engines/sword1/mouse.cpp Thu Oct 5 22:45:47 2006
|
|---|
| 421 | ***************
|
|---|
| 422 | *** 21,27 ****
|
|---|
| 423 | */
|
|---|
| 424 |
|
|---|
| 425 | #include "common/stdafx.h"
|
|---|
| 426 | - #include "common/endian.h"
|
|---|
| 427 | #include "common/system.h"
|
|---|
| 428 |
|
|---|
| 429 | #include "graphics/cursorman.h"
|
|---|
| 430 | --- 21,26 ----
|
|---|
| 431 | ***************
|
|---|
| 432 | *** 199,231 ****
|
|---|
| 433 | if (ptrId) {
|
|---|
| 434 | MousePtr *lugg = NULL;
|
|---|
| 435 | MousePtr *ptr = (MousePtr*)_resMan->openFetchRes(ptrId);
|
|---|
| 436 | ! uint16 resSizeX = FROM_LE_16(ptr->sizeX);
|
|---|
| 437 | ! uint16 resSizeY = FROM_LE_16(ptr->sizeY);
|
|---|
| 438 | ! uint16 noFrames = FROM_LE_16(ptr->numFrames);
|
|---|
| 439 | if (luggageId) {
|
|---|
| 440 | lugg = (MousePtr*)_resMan->openFetchRes(luggageId);
|
|---|
| 441 | ! resSizeX = MAX(resSizeX, (uint16)((resSizeX / 2) + FROM_LE_16(lugg->sizeX)));
|
|---|
| 442 | ! resSizeY = MAX(resSizeY, (uint16)((resSizeY / 2) + FROM_LE_16(lugg->sizeY)));
|
|---|
| 443 | }
|
|---|
| 444 | _currentPtr = (MousePtr*)malloc(sizeof(MousePtr) + resSizeX * resSizeY * noFrames);
|
|---|
| 445 | ! _currentPtr->hotSpotX = FROM_LE_16(ptr->hotSpotX);
|
|---|
| 446 | ! _currentPtr->hotSpotY = FROM_LE_16(ptr->hotSpotY);
|
|---|
| 447 | _currentPtr->numFrames = noFrames;
|
|---|
| 448 | _currentPtr->sizeX = resSizeX;
|
|---|
| 449 | _currentPtr->sizeY = resSizeY;
|
|---|
| 450 | uint8 *ptrData = (uint8*)_currentPtr + sizeof(MousePtr);
|
|---|
| 451 | memset(ptrData, 255, resSizeX * resSizeY * noFrames);
|
|---|
| 452 | if (luggageId) {
|
|---|
| 453 | ! uint8 *dstData = ptrData + resSizeX - FROM_LE_16(lugg->sizeX);
|
|---|
| 454 | for (uint32 frameCnt = 0; frameCnt < noFrames; frameCnt++) {
|
|---|
| 455 | uint8 *luggSrc = (uint8*)lugg + sizeof(MousePtr);
|
|---|
| 456 | ! dstData += (resSizeY - FROM_LE_16(lugg->sizeY)) * resSizeX;
|
|---|
| 457 | ! for (uint32 cnty = 0; cnty < FROM_LE_16(lugg->sizeY); cnty++) {
|
|---|
| 458 | ! for (uint32 cntx = 0; cntx < FROM_LE_16(lugg->sizeX); cntx++)
|
|---|
| 459 | if (luggSrc[cntx])
|
|---|
| 460 | dstData[cntx] = luggSrc[cntx];
|
|---|
| 461 | dstData += resSizeX;
|
|---|
| 462 | ! luggSrc += FROM_LE_16(lugg->sizeX);
|
|---|
| 463 | }
|
|---|
| 464 | }
|
|---|
| 465 | _resMan->resClose(luggageId);
|
|---|
| 466 | --- 198,230 ----
|
|---|
| 467 | if (ptrId) {
|
|---|
| 468 | MousePtr *lugg = NULL;
|
|---|
| 469 | MousePtr *ptr = (MousePtr*)_resMan->openFetchRes(ptrId);
|
|---|
| 470 | ! uint16 resSizeX = _resMan->getLEUint16(ptr->sizeX);
|
|---|
| 471 | ! uint16 resSizeY = _resMan->getLEUint16(ptr->sizeY);
|
|---|
| 472 | ! uint16 noFrames = _resMan->getLEUint16(ptr->numFrames);
|
|---|
| 473 | if (luggageId) {
|
|---|
| 474 | lugg = (MousePtr*)_resMan->openFetchRes(luggageId);
|
|---|
| 475 | ! resSizeX = MAX(resSizeX, (uint16)((resSizeX / 2) + _resMan->getLEUint16(lugg->sizeX)));
|
|---|
| 476 | ! resSizeY = MAX(resSizeY, (uint16)((resSizeY / 2) + _resMan->getLEUint16(lugg->sizeY)));
|
|---|
| 477 | }
|
|---|
| 478 | _currentPtr = (MousePtr*)malloc(sizeof(MousePtr) + resSizeX * resSizeY * noFrames);
|
|---|
| 479 | ! _currentPtr->hotSpotX = _resMan->getLEUint16(ptr->hotSpotX);
|
|---|
| 480 | ! _currentPtr->hotSpotY = _resMan->getLEUint16(ptr->hotSpotY);
|
|---|
| 481 | _currentPtr->numFrames = noFrames;
|
|---|
| 482 | _currentPtr->sizeX = resSizeX;
|
|---|
| 483 | _currentPtr->sizeY = resSizeY;
|
|---|
| 484 | uint8 *ptrData = (uint8*)_currentPtr + sizeof(MousePtr);
|
|---|
| 485 | memset(ptrData, 255, resSizeX * resSizeY * noFrames);
|
|---|
| 486 | if (luggageId) {
|
|---|
| 487 | ! uint8 *dstData = ptrData + resSizeX - _resMan->getLEUint16(lugg->sizeX);
|
|---|
| 488 | for (uint32 frameCnt = 0; frameCnt < noFrames; frameCnt++) {
|
|---|
| 489 | uint8 *luggSrc = (uint8*)lugg + sizeof(MousePtr);
|
|---|
| 490 | ! dstData += (resSizeY - _resMan->getLEUint16(lugg->sizeY)) * resSizeX;
|
|---|
| 491 | ! for (uint32 cnty = 0; cnty < _resMan->getLEUint16(lugg->sizeY); cnty++) {
|
|---|
| 492 | ! for (uint32 cntx = 0; cntx < _resMan->getLEUint16(lugg->sizeX); cntx++)
|
|---|
| 493 | if (luggSrc[cntx])
|
|---|
| 494 | dstData[cntx] = luggSrc[cntx];
|
|---|
| 495 | dstData += resSizeX;
|
|---|
| 496 | ! luggSrc += _resMan->getLEUint16(lugg->sizeX);
|
|---|
| 497 | }
|
|---|
| 498 | }
|
|---|
| 499 | _resMan->resClose(luggageId);
|
|---|
| 500 | ***************
|
|---|
| 501 | *** 233,246 ****
|
|---|
| 502 | uint8 *dstData = ptrData;
|
|---|
| 503 | uint8 *srcData = (uint8*)ptr + sizeof(MousePtr);
|
|---|
| 504 | for (uint32 frameCnt = 0; frameCnt < noFrames; frameCnt++) {
|
|---|
| 505 | ! for (uint32 cnty = 0; cnty < FROM_LE_16(ptr->sizeY); cnty++) {
|
|---|
| 506 | ! for (uint32 cntx = 0; cntx < FROM_LE_16(ptr->sizeX); cntx++)
|
|---|
| 507 | if (srcData[cntx])
|
|---|
| 508 | dstData[cntx] = srcData[cntx];
|
|---|
| 509 | ! srcData += FROM_LE_16(ptr->sizeX);
|
|---|
| 510 | dstData += resSizeX;
|
|---|
| 511 | }
|
|---|
| 512 | ! dstData += (resSizeY - FROM_LE_16(ptr->sizeY)) * resSizeX;
|
|---|
| 513 | }
|
|---|
| 514 | _resMan->resClose(ptrId);
|
|---|
| 515 | }
|
|---|
| 516 | --- 232,245 ----
|
|---|
| 517 | uint8 *dstData = ptrData;
|
|---|
| 518 | uint8 *srcData = (uint8*)ptr + sizeof(MousePtr);
|
|---|
| 519 | for (uint32 frameCnt = 0; frameCnt < noFrames; frameCnt++) {
|
|---|
| 520 | ! for (uint32 cnty = 0; cnty < _resMan->getLEUint16(ptr->sizeY); cnty++) {
|
|---|
| 521 | ! for (uint32 cntx = 0; cntx < _resMan->getLEUint16(ptr->sizeX); cntx++)
|
|---|
| 522 | if (srcData[cntx])
|
|---|
| 523 | dstData[cntx] = srcData[cntx];
|
|---|
| 524 | ! srcData += _resMan->getLEUint16(ptr->sizeX);
|
|---|
| 525 | dstData += resSizeX;
|
|---|
| 526 | }
|
|---|
| 527 | ! dstData += (resSizeY - _resMan->getLEUint16(ptr->sizeY)) * resSizeX;
|
|---|
| 528 | }
|
|---|
| 529 | _resMan->resClose(ptrId);
|
|---|
| 530 | }
|
|---|
| 531 | diff -cr scummvm.old/engines/sword1/objectman.cpp scummvm/engines/sword1/objectman.cpp
|
|---|
| 532 | *** scummvm.old/engines/sword1/objectman.cpp Sat Sep 23 06:46:06 2006
|
|---|
| 533 | --- scummvm/engines/sword1/objectman.cpp Sun Oct 1 17:50:44 2006
|
|---|
| 534 | ***************
|
|---|
| 535 | *** 21,27 ****
|
|---|
| 536 | */
|
|---|
| 537 |
|
|---|
| 538 | #include "common/stdafx.h"
|
|---|
| 539 | - #include "common/endian.h"
|
|---|
| 540 | #include "common/util.h"
|
|---|
| 541 |
|
|---|
| 542 | #include "sword1/objectman.h"
|
|---|
| 543 | --- 21,26 ----
|
|---|
| 544 | ***************
|
|---|
| 545 | *** 88,94 ****
|
|---|
| 546 |
|
|---|
| 547 | uint8 lang = SwordEngine::_systemVars.language;
|
|---|
| 548 | uint32 *textData = (uint32*)((uint8*)_resMan->openFetchRes(_textList[textId / ITM_PER_SEC][lang]) + sizeof(Header));
|
|---|
| 549 | ! if ((textId & ITM_ID) < READ_LE_UINT32(textData)) {
|
|---|
| 550 | textData++;
|
|---|
| 551 | if (textData[textId & ITM_ID])
|
|---|
| 552 | retVal = 1;
|
|---|
| 553 | --- 87,93 ----
|
|---|
| 554 |
|
|---|
| 555 | uint8 lang = SwordEngine::_systemVars.language;
|
|---|
| 556 | uint32 *textData = (uint32*)((uint8*)_resMan->openFetchRes(_textList[textId / ITM_PER_SEC][lang]) + sizeof(Header));
|
|---|
| 557 | ! if ((textId & ITM_ID) < _resMan->readUint32(textData)) {
|
|---|
| 558 | textData++;
|
|---|
| 559 | if (textData[textId & ITM_ID])
|
|---|
| 560 | retVal = 1;
|
|---|
| 561 | ***************
|
|---|
| 562 | *** 100,110 ****
|
|---|
| 563 | char *ObjectMan::lockText(uint32 textId) {
|
|---|
| 564 | uint8 lang = SwordEngine::_systemVars.language;
|
|---|
| 565 | char *addr = (char*)_resMan->openFetchRes(_textList[textId / ITM_PER_SEC][lang]) + sizeof(Header);
|
|---|
| 566 | ! if ((textId & ITM_ID) >= READ_LE_UINT32(addr)) {
|
|---|
| 567 | ! warning("ObjectMan::lockText(%d): only %d texts in file", textId & ITM_ID, READ_LE_UINT32(addr));
|
|---|
| 568 | textId = 0; // get first line instead
|
|---|
| 569 | }
|
|---|
| 570 | ! uint32 offset = READ_LE_UINT32(addr + ((textId & ITM_ID) + 1)* 4);
|
|---|
| 571 | if (offset == 0) {
|
|---|
| 572 | warning("ObjectMan::lockText(%d): text number has no text lines", textId);
|
|---|
| 573 | return _errorStr;
|
|---|
| 574 | --- 99,109 ----
|
|---|
| 575 | char *ObjectMan::lockText(uint32 textId) {
|
|---|
| 576 | uint8 lang = SwordEngine::_systemVars.language;
|
|---|
| 577 | char *addr = (char*)_resMan->openFetchRes(_textList[textId / ITM_PER_SEC][lang]) + sizeof(Header);
|
|---|
| 578 | ! if ((textId & ITM_ID) >= _resMan->readUint32(addr)) {
|
|---|
| 579 | ! warning("ObjectMan::lockText(%d): only %d texts in file", textId & ITM_ID, _resMan->readUint32(addr));
|
|---|
| 580 | textId = 0; // get first line instead
|
|---|
| 581 | }
|
|---|
| 582 | ! uint32 offset = _resMan->readUint32(addr + ((textId & ITM_ID) + 1)* 4);
|
|---|
| 583 | if (offset == 0) {
|
|---|
| 584 | warning("ObjectMan::lockText(%d): text number has no text lines", textId);
|
|---|
| 585 | return _errorStr;
|
|---|
| 586 | ***************
|
|---|
| 587 | *** 118,124 ****
|
|---|
| 588 |
|
|---|
| 589 | uint32 ObjectMan::lastTextNumber(int section) {
|
|---|
| 590 | uint8 *data = (uint8*)_resMan->openFetchRes(_textList[section][SwordEngine::_systemVars.language]) + sizeof(Header);
|
|---|
| 591 | ! uint32 result = READ_LE_UINT32(data) - 1;
|
|---|
| 592 | _resMan->resClose(_textList[section][SwordEngine::_systemVars.language]);
|
|---|
| 593 | return result;
|
|---|
| 594 | }
|
|---|
| 595 | --- 117,123 ----
|
|---|
| 596 |
|
|---|
| 597 | uint32 ObjectMan::lastTextNumber(int section) {
|
|---|
| 598 | uint8 *data = (uint8*)_resMan->openFetchRes(_textList[section][SwordEngine::_systemVars.language]) + sizeof(Header);
|
|---|
| 599 | ! uint32 result = _resMan->readUint32(data) - 1;
|
|---|
| 600 | _resMan->resClose(_textList[section][SwordEngine::_systemVars.language]);
|
|---|
| 601 | return result;
|
|---|
| 602 | }
|
|---|
| 603 | diff -cr scummvm.old/engines/sword1/resman.cpp scummvm/engines/sword1/resman.cpp
|
|---|
| 604 | *** scummvm.old/engines/sword1/resman.cpp Sat Sep 23 06:46:07 2006
|
|---|
| 605 | --- scummvm/engines/sword1/resman.cpp Thu Oct 5 23:14:28 2006
|
|---|
| 606 | ***************
|
|---|
| 607 | *** 21,27 ****
|
|---|
| 608 | */
|
|---|
| 609 |
|
|---|
| 610 | #include "common/stdafx.h"
|
|---|
| 611 | - #include "common/endian.h"
|
|---|
| 612 | #include "common/config-manager.h"
|
|---|
| 613 | #include "common/util.h"
|
|---|
| 614 | #include "common/str.h"
|
|---|
| 615 | --- 21,26 ----
|
|---|
| 616 | ***************
|
|---|
| 617 | *** 49,57 ****
|
|---|
| 618 |
|
|---|
| 619 | #define MAX_PATH_LEN 260
|
|---|
| 620 |
|
|---|
| 621 | ! ResMan::ResMan(const char *fileName) {
|
|---|
| 622 | _openCluStart = _openCluEnd = NULL;
|
|---|
| 623 | _openClus = 0;
|
|---|
| 624 | _memMan = new MemMan();
|
|---|
| 625 | loadCluDescript(fileName);
|
|---|
| 626 | }
|
|---|
| 627 | --- 48,57 ----
|
|---|
| 628 |
|
|---|
| 629 | #define MAX_PATH_LEN 260
|
|---|
| 630 |
|
|---|
| 631 | ! ResMan::ResMan(const char *fileName, bool isMacFile) {
|
|---|
| 632 | _openCluStart = _openCluEnd = NULL;
|
|---|
| 633 | _openClus = 0;
|
|---|
| 634 | + _isBigEndian = isMacFile;
|
|---|
| 635 | _memMan = new MemMan();
|
|---|
| 636 | loadCluDescript(fileName);
|
|---|
| 637 | }
|
|---|
| 638 | ***************
|
|---|
| 639 | *** 82,87 ****
|
|---|
| 640 | --- 82,88 ----
|
|---|
| 641 | }
|
|---|
| 642 |
|
|---|
| 643 | void ResMan::loadCluDescript(const char *fileName) {
|
|---|
| 644 | + // The cluster description file is always little endian (even on the mac version, whose cluster files are big endian)
|
|---|
| 645 | Common::File file;
|
|---|
| 646 | file.open(fileName);
|
|---|
| 647 |
|
|---|
| 648 | ***************
|
|---|
| 649 | *** 223,235 ****
|
|---|
| 650 | error("Script id %d not found.\n", scrID);
|
|---|
| 651 | scrID = _scriptList[scrID / ITM_PER_SEC];
|
|---|
| 652 | #ifdef SCUMM_BIG_ENDIAN
|
|---|
| 653 | ! MemHandle *memHandle = resHandle(scrID);
|
|---|
| 654 | ! if (memHandle->cond == MEM_FREED)
|
|---|
| 655 | ! openScriptResourceBigEndian(scrID);
|
|---|
| 656 | ! else
|
|---|
| 657 | ! resOpen(scrID);
|
|---|
| 658 | #else
|
|---|
| 659 | ! resOpen(scrID);
|
|---|
| 660 | #endif
|
|---|
| 661 | return (Header*)resHandle(scrID)->data;
|
|---|
| 662 | }
|
|---|
| 663 | --- 224,232 ----
|
|---|
| 664 | error("Script id %d not found.\n", scrID);
|
|---|
| 665 | scrID = _scriptList[scrID / ITM_PER_SEC];
|
|---|
| 666 | #ifdef SCUMM_BIG_ENDIAN
|
|---|
| 667 | ! openScriptResourceBigEndian(scrID);
|
|---|
| 668 | #else
|
|---|
| 669 | ! openScriptResourceLittleEndian(scrID);
|
|---|
| 670 | #endif
|
|---|
| 671 | return (Header*)resHandle(scrID)->data;
|
|---|
| 672 | }
|
|---|
| 673 | ***************
|
|---|
| 674 | *** 240,252 ****
|
|---|
| 675 |
|
|---|
| 676 | void *ResMan::cptResOpen(uint32 id) {
|
|---|
| 677 | #ifdef SCUMM_BIG_ENDIAN
|
|---|
| 678 | ! MemHandle *memHandle = resHandle(id);
|
|---|
| 679 | ! if (memHandle->cond == MEM_FREED)
|
|---|
| 680 | ! openCptResourceBigEndian(id);
|
|---|
| 681 | ! else
|
|---|
| 682 | ! resOpen(id);
|
|---|
| 683 | #else
|
|---|
| 684 | ! resOpen(id);
|
|---|
| 685 | #endif
|
|---|
| 686 | return resHandle(id)->data;
|
|---|
| 687 | }
|
|---|
| 688 | --- 237,245 ----
|
|---|
| 689 |
|
|---|
| 690 | void *ResMan::cptResOpen(uint32 id) {
|
|---|
| 691 | #ifdef SCUMM_BIG_ENDIAN
|
|---|
| 692 | ! openCptResourceBigEndian(id);
|
|---|
| 693 | #else
|
|---|
| 694 | ! openCptResourceLittleEndian(id);
|
|---|
| 695 | #endif
|
|---|
| 696 | return resHandle(id)->data;
|
|---|
| 697 | }
|
|---|
| 698 | ***************
|
|---|
| 699 | *** 286,294 ****
|
|---|
| 700 | FrameHeader *ResMan::fetchFrame(void *resourceData, uint32 frameNo) {
|
|---|
| 701 | uint8 *frameFile = (uint8*)resourceData;
|
|---|
| 702 | uint8 *idxData = frameFile + sizeof(Header);
|
|---|
| 703 | ! if (frameNo >= READ_LE_UINT32(idxData))
|
|---|
| 704 | ! error("fetchFrame:: frame %d doesn't exist in resource.", frameNo);
|
|---|
| 705 | ! frameFile += READ_LE_UINT32(idxData + (frameNo+1) * 4);
|
|---|
| 706 | return (FrameHeader*)frameFile;
|
|---|
| 707 | }
|
|---|
| 708 |
|
|---|
| 709 | --- 279,293 ----
|
|---|
| 710 | FrameHeader *ResMan::fetchFrame(void *resourceData, uint32 frameNo) {
|
|---|
| 711 | uint8 *frameFile = (uint8*)resourceData;
|
|---|
| 712 | uint8 *idxData = frameFile + sizeof(Header);
|
|---|
| 713 | ! if (_isBigEndian) {
|
|---|
| 714 | ! if (frameNo >= READ_BE_UINT32(idxData))
|
|---|
| 715 | ! error("fetchFrame:: frame %d doesn't exist in resource.", frameNo);
|
|---|
| 716 | ! frameFile += READ_BE_UINT32(idxData + (frameNo+1) * 4);
|
|---|
| 717 | ! } else {
|
|---|
| 718 | ! if (frameNo >= READ_LE_UINT32(idxData))
|
|---|
| 719 | ! error("fetchFrame:: frame %d doesn't exist in resource.", frameNo);
|
|---|
| 720 | ! frameFile += READ_LE_UINT32(idxData + (frameNo+1) * 4);
|
|---|
| 721 | ! }
|
|---|
| 722 | return (FrameHeader*)frameFile;
|
|---|
| 723 | }
|
|---|
| 724 |
|
|---|
| 725 | ***************
|
|---|
| 726 | *** 304,310 ****
|
|---|
| 727 | }
|
|---|
| 728 | cluster->file = new Common::File();
|
|---|
| 729 | char fileName[15];
|
|---|
| 730 | ! sprintf(fileName, "%s.CLU", _prj.clu[(id >> 24)-1].label);
|
|---|
| 731 | cluster->file->open(fileName);
|
|---|
| 732 |
|
|---|
| 733 | if (!cluster->file->isOpen()) {
|
|---|
| 734 | --- 303,314 ----
|
|---|
| 735 | }
|
|---|
| 736 | cluster->file = new Common::File();
|
|---|
| 737 | char fileName[15];
|
|---|
| 738 | ! // Supposes that big endian means mac cluster file and little endian means PC cluster file.
|
|---|
| 739 | ! // This works, but we may want to separate the file name from the endianess or try .CLM extension if opening.clu file fail.
|
|---|
| 740 | ! if (_isBigEndian)
|
|---|
| 741 | ! sprintf(fileName, "%s.CLM", _prj.clu[(id >> 24)-1].label);
|
|---|
| 742 | ! else
|
|---|
| 743 | ! sprintf(fileName, "%s.CLU", _prj.clu[(id >> 24)-1].label);
|
|---|
| 744 | cluster->file->open(fileName);
|
|---|
| 745 |
|
|---|
| 746 | if (!cluster->file->isOpen()) {
|
|---|
| 747 | ***************
|
|---|
| 748 | *** 355,393 ****
|
|---|
| 749 | }
|
|---|
| 750 |
|
|---|
| 751 | void ResMan::openCptResourceBigEndian(uint32 id) {
|
|---|
| 752 | resOpen(id);
|
|---|
| 753 | ! MemHandle *handle = resHandle(id);
|
|---|
| 754 | ! uint32 totSize = handle->size;
|
|---|
| 755 | ! uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header));
|
|---|
| 756 | ! totSize -= sizeof(Header);
|
|---|
| 757 | ! if (totSize & 3)
|
|---|
| 758 | ! error("Illegal compact size for id %d: %d", id, totSize);
|
|---|
| 759 | ! totSize /= 4;
|
|---|
| 760 | ! for (uint32 cnt = 0; cnt < totSize; cnt++) {
|
|---|
| 761 | ! *data = READ_LE_UINT32(data);
|
|---|
| 762 | ! data++;
|
|---|
| 763 | }
|
|---|
| 764 | }
|
|---|
| 765 |
|
|---|
| 766 | void ResMan::openScriptResourceBigEndian(uint32 id) {
|
|---|
| 767 | resOpen(id);
|
|---|
| 768 | ! MemHandle *handle = resHandle(id);
|
|---|
| 769 | ! // uint32 totSize = handle->size;
|
|---|
| 770 | ! Header *head = (Header*)handle->data;
|
|---|
| 771 | ! head->comp_length = FROM_LE_32(head->comp_length);
|
|---|
| 772 | ! head->decomp_length = FROM_LE_32(head->decomp_length);
|
|---|
| 773 | ! head->version = FROM_LE_16(head->version);
|
|---|
| 774 | ! uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header));
|
|---|
| 775 | ! uint32 size = handle->size - sizeof(Header);
|
|---|
| 776 | ! if (size & 3)
|
|---|
| 777 | ! error("Odd size during script endian conversion. Resource ID =%d, size = %d", id, size);
|
|---|
| 778 | ! size >>= 2;
|
|---|
| 779 | ! for (uint32 cnt = 0; cnt < size; cnt++) {
|
|---|
| 780 | ! *data = READ_LE_UINT32(data);
|
|---|
| 781 | ! data++;
|
|---|
| 782 | }
|
|---|
| 783 | }
|
|---|
| 784 |
|
|---|
| 785 | uint32 ResMan::_srIdList[29] = { // the file numbers differ for the control panel file IDs, so we need this array
|
|---|
| 786 | OTHER_SR_FONT, // SR_FONT
|
|---|
| 787 | 0x04050000, // SR_BUTTON
|
|---|
| 788 | --- 359,472 ----
|
|---|
| 789 | }
|
|---|
| 790 |
|
|---|
| 791 | void ResMan::openCptResourceBigEndian(uint32 id) {
|
|---|
| 792 | + bool needByteSwap = false;
|
|---|
| 793 | + if (!_isBigEndian) {
|
|---|
| 794 | + // Cluster files are in little endian fomat.
|
|---|
| 795 | + // If the resource are not in memory anymore, and therefore will be read
|
|---|
| 796 | + // from disk, they will need to be byte swaped.
|
|---|
| 797 | + MemHandle *memHandle = resHandle(id);
|
|---|
| 798 | + needByteSwap = (memHandle->cond == MEM_FREED);
|
|---|
| 799 | + }
|
|---|
| 800 | resOpen(id);
|
|---|
| 801 | ! if (needByteSwap) {
|
|---|
| 802 | ! MemHandle *handle = resHandle(id);
|
|---|
| 803 | ! uint32 totSize = handle->size;
|
|---|
| 804 | ! uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header));
|
|---|
| 805 | ! totSize -= sizeof(Header);
|
|---|
| 806 | ! if (totSize & 3)
|
|---|
| 807 | ! error("Illegal compact size for id %d: %d", id, totSize);
|
|---|
| 808 | ! totSize /= 4;
|
|---|
| 809 | ! for (uint32 cnt = 0; cnt < totSize; cnt++) {
|
|---|
| 810 | ! *data = READ_LE_UINT32(data);
|
|---|
| 811 | ! data++;
|
|---|
| 812 | ! }
|
|---|
| 813 | ! }
|
|---|
| 814 | ! }
|
|---|
| 815 | !
|
|---|
| 816 | ! void ResMan::openCptResourceLittleEndian(uint32 id) {
|
|---|
| 817 | ! bool needByteSwap = false;
|
|---|
| 818 | ! if (_isBigEndian) {
|
|---|
| 819 | ! // Cluster files are in big endian fomat.
|
|---|
| 820 | ! // If the resource are not in memory anymore, and therefore will be read
|
|---|
| 821 | ! // from disk, they will need to be byte swaped.
|
|---|
| 822 | ! MemHandle *memHandle = resHandle(id);
|
|---|
| 823 | ! needByteSwap = (memHandle->cond == MEM_FREED);
|
|---|
| 824 | ! }
|
|---|
| 825 | ! resOpen(id);
|
|---|
| 826 | ! if (needByteSwap) {
|
|---|
| 827 | ! MemHandle *handle = resHandle(id);
|
|---|
| 828 | ! uint32 totSize = handle->size;
|
|---|
| 829 | ! uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header));
|
|---|
| 830 | ! totSize -= sizeof(Header);
|
|---|
| 831 | ! if (totSize & 3)
|
|---|
| 832 | ! error("Illegal compact size for id %d: %d", id, totSize);
|
|---|
| 833 | ! totSize /= 4;
|
|---|
| 834 | ! for (uint32 cnt = 0; cnt < totSize; cnt++) {
|
|---|
| 835 | ! *data = READ_BE_UINT32(data);
|
|---|
| 836 | ! data++;
|
|---|
| 837 | ! }
|
|---|
| 838 | }
|
|---|
| 839 | }
|
|---|
| 840 |
|
|---|
| 841 | void ResMan::openScriptResourceBigEndian(uint32 id) {
|
|---|
| 842 | + bool needByteSwap = false;
|
|---|
| 843 | + if (!_isBigEndian) {
|
|---|
| 844 | + // Cluster files are in little endian fomat.
|
|---|
| 845 | + // If the resource are not in memory anymore, and therefore will be read
|
|---|
| 846 | + // from disk, they will need to be byte swaped.
|
|---|
| 847 | + MemHandle *memHandle = resHandle(id);
|
|---|
| 848 | + needByteSwap = (memHandle->cond == MEM_FREED);
|
|---|
| 849 | + }
|
|---|
| 850 | resOpen(id);
|
|---|
| 851 | ! if (needByteSwap) {
|
|---|
| 852 | ! MemHandle *handle = resHandle(id);
|
|---|
| 853 | ! // uint32 totSize = handle->size;
|
|---|
| 854 | ! Header *head = (Header*)handle->data;
|
|---|
| 855 | ! head->comp_length = FROM_LE_32(head->comp_length);
|
|---|
| 856 | ! head->decomp_length = FROM_LE_32(head->decomp_length);
|
|---|
| 857 | ! head->version = FROM_LE_16(head->version);
|
|---|
| 858 | ! uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header));
|
|---|
| 859 | ! uint32 size = handle->size - sizeof(Header);
|
|---|
| 860 | ! if (size & 3)
|
|---|
| 861 | ! error("Odd size during script endian conversion. Resource ID =%d, size = %d", id, size);
|
|---|
| 862 | ! size >>= 2;
|
|---|
| 863 | ! for (uint32 cnt = 0; cnt < size; cnt++) {
|
|---|
| 864 | ! *data = READ_LE_UINT32(data);
|
|---|
| 865 | ! data++;
|
|---|
| 866 | ! }
|
|---|
| 867 | ! }
|
|---|
| 868 | ! }
|
|---|
| 869 | !
|
|---|
| 870 | ! void ResMan::openScriptResourceLittleEndian(uint32 id) {
|
|---|
| 871 | ! bool needByteSwap = false;
|
|---|
| 872 | ! if (_isBigEndian) {
|
|---|
| 873 | ! // Cluster files are in big endian fomat.
|
|---|
| 874 | ! // If the resource are not in memory anymore, and therefore will be read
|
|---|
| 875 | ! // from disk, they will need to be byte swaped.
|
|---|
| 876 | ! MemHandle *memHandle = resHandle(id);
|
|---|
| 877 | ! needByteSwap = (memHandle->cond == MEM_FREED);
|
|---|
| 878 | ! }
|
|---|
| 879 | ! resOpen(id);
|
|---|
| 880 | ! if (needByteSwap) {
|
|---|
| 881 | ! MemHandle *handle = resHandle(id);
|
|---|
| 882 | ! // uint32 totSize = handle->size;
|
|---|
| 883 | ! Header *head = (Header*)handle->data;
|
|---|
| 884 | ! head->comp_length = FROM_BE_32(head->comp_length);
|
|---|
| 885 | ! head->decomp_length = FROM_BE_32(head->decomp_length);
|
|---|
| 886 | ! head->version = FROM_BE_16(head->version);
|
|---|
| 887 | ! uint32 *data = (uint32*)((uint8*)handle->data + sizeof(Header));
|
|---|
| 888 | ! uint32 size = handle->size - sizeof(Header);
|
|---|
| 889 | ! if (size & 3)
|
|---|
| 890 | ! error("Odd size during script endian conversion. Resource ID =%d, size = %d", id, size);
|
|---|
| 891 | ! size >>= 2;
|
|---|
| 892 | ! for (uint32 cnt = 0; cnt < size; cnt++) {
|
|---|
| 893 | ! *data = READ_BE_UINT32(data);
|
|---|
| 894 | ! data++;
|
|---|
| 895 | ! }
|
|---|
| 896 | }
|
|---|
| 897 | }
|
|---|
| 898 |
|
|---|
| 899 | +
|
|---|
| 900 | uint32 ResMan::_srIdList[29] = { // the file numbers differ for the control panel file IDs, so we need this array
|
|---|
| 901 | OTHER_SR_FONT, // SR_FONT
|
|---|
| 902 | 0x04050000, // SR_BUTTON
|
|---|
| 903 | diff -cr scummvm.old/engines/sword1/resman.h scummvm/engines/sword1/resman.h
|
|---|
| 904 | *** scummvm.old/engines/sword1/resman.h Sat Sep 23 06:46:06 2006
|
|---|
| 905 | --- scummvm/engines/sword1/resman.h Thu Oct 5 22:57:55 2006
|
|---|
| 906 | ***************
|
|---|
| 907 | *** 26,31 ****
|
|---|
| 908 | --- 26,32 ----
|
|---|
| 909 | #include "sword1/memman.h"
|
|---|
| 910 | #include "common/file.h"
|
|---|
| 911 | #include "sword1/sworddefs.h"
|
|---|
| 912 | + #include "common/endian.h"
|
|---|
| 913 |
|
|---|
| 914 | namespace Sword1 {
|
|---|
| 915 |
|
|---|
| 916 | ***************
|
|---|
| 917 | *** 62,68 ****
|
|---|
| 918 |
|
|---|
| 919 | class ResMan {
|
|---|
| 920 | public:
|
|---|
| 921 | ! ResMan(const char *fileName);
|
|---|
| 922 | ~ResMan(void);
|
|---|
| 923 | void flush(void);
|
|---|
| 924 | void resClose(uint32 id);
|
|---|
| 925 | --- 63,69 ----
|
|---|
| 926 |
|
|---|
| 927 | class ResMan {
|
|---|
| 928 | public:
|
|---|
| 929 | ! ResMan(const char *fileName, bool isMacFile);
|
|---|
| 930 | ~ResMan(void);
|
|---|
| 931 | void flush(void);
|
|---|
| 932 | void resClose(uint32 id);
|
|---|
| 933 | ***************
|
|---|
| 934 | *** 74,79 ****
|
|---|
| 935 | --- 75,110 ----
|
|---|
| 936 | Header *lockScript(uint32 scrID);
|
|---|
| 937 | void unlockScript(uint32 scrID);
|
|---|
| 938 | FrameHeader *fetchFrame(void *resourceData, uint32 frameNo);
|
|---|
| 939 | +
|
|---|
| 940 | + uint16 getUint16(uint16 value) {
|
|---|
| 941 | + return (_isBigEndian) ? FROM_BE_16(value): FROM_LE_16(value);
|
|---|
| 942 | + }
|
|---|
| 943 | + uint32 getUint32(uint32 value) {
|
|---|
| 944 | + return (_isBigEndian) ? FROM_BE_32(value): FROM_LE_32(value);
|
|---|
| 945 | + }
|
|---|
| 946 | + uint16 getLEUint16(uint16 value) {
|
|---|
| 947 | + return FROM_LE_16(value);
|
|---|
| 948 | + }
|
|---|
| 949 | + uint32 getLEUint32(uint32 value) {
|
|---|
| 950 | + return FROM_LE_32(value);
|
|---|
| 951 | + }
|
|---|
| 952 | + uint16 readUint16(const void *ptr) {
|
|---|
| 953 | + return (_isBigEndian) ? READ_BE_UINT16(ptr): READ_LE_UINT16(ptr);
|
|---|
| 954 | + }
|
|---|
| 955 | + uint32 readUint32(const void *ptr) {
|
|---|
| 956 | + return (_isBigEndian) ? READ_BE_UINT32(ptr):READ_LE_UINT32(ptr);
|
|---|
| 957 | + }
|
|---|
| 958 | + uint32 readLEUint32(const void *ptr) {
|
|---|
| 959 | + return READ_LE_UINT32(ptr);
|
|---|
| 960 | + }
|
|---|
| 961 | + uint16 toUint16(uint16 value) {
|
|---|
| 962 | + return (_isBigEndian) ? TO_BE_16(value): TO_LE_16(value);
|
|---|
| 963 | + }
|
|---|
| 964 | + uint32 toUint32(uint32 value) {
|
|---|
| 965 | + return (_isBigEndian) ? TO_BE_32(value): TO_LE_32(value);
|
|---|
| 966 | + }
|
|---|
| 967 | +
|
|---|
| 968 | +
|
|---|
| 969 | private:
|
|---|
| 970 | uint32 resLength(uint32 id);
|
|---|
| 971 | MemHandle *resHandle(uint32 id);
|
|---|
| 972 | ***************
|
|---|
| 973 | *** 82,87 ****
|
|---|
| 974 | --- 113,120 ----
|
|---|
| 975 |
|
|---|
| 976 | void openCptResourceBigEndian(uint32 id);
|
|---|
| 977 | void openScriptResourceBigEndian(uint32 id);
|
|---|
| 978 | + void openCptResourceLittleEndian(uint32 id);
|
|---|
| 979 | + void openScriptResourceLittleEndian(uint32 id);
|
|---|
| 980 |
|
|---|
| 981 | void loadCluDescript(const char *fileName);
|
|---|
| 982 | void freeCluDescript(void);
|
|---|
| 983 | ***************
|
|---|
| 984 | *** 91,96 ****
|
|---|
| 985 | --- 124,130 ----
|
|---|
| 986 | static uint32 _srIdList[29];
|
|---|
| 987 | Clu *_openCluStart, *_openCluEnd;
|
|---|
| 988 | int _openClus;
|
|---|
| 989 | + bool _isBigEndian;
|
|---|
| 990 | };
|
|---|
| 991 |
|
|---|
| 992 | } // End of namespace Sword1
|
|---|
| 993 | diff -cr scummvm.old/engines/sword1/router.cpp scummvm/engines/sword1/router.cpp
|
|---|
| 994 | *** scummvm.old/engines/sword1/router.cpp Sat Sep 23 06:46:06 2006
|
|---|
| 995 | --- scummvm/engines/sword1/router.cpp Thu Oct 5 23:10:06 2006
|
|---|
| 996 | ***************
|
|---|
| 997 | *** 21,27 ****
|
|---|
| 998 | */
|
|---|
| 999 |
|
|---|
| 1000 | #include "common/stdafx.h"
|
|---|
| 1001 | - #include "common/endian.h"
|
|---|
| 1002 | #include "common/util.h"
|
|---|
| 1003 |
|
|---|
| 1004 | #include "sword1/router.h"
|
|---|
| 1005 | --- 21,26 ----
|
|---|
| 1006 | ***************
|
|---|
| 1007 | *** 1911,1917 ****
|
|---|
| 1008 | fPolygrid += sizeof(Header);
|
|---|
| 1009 | memcpy(&floorHeader,fPolygrid,sizeof(WalkGridHeader));
|
|---|
| 1010 | fPolygrid += sizeof(WalkGridHeader);
|
|---|
| 1011 | ! _nBars = FROM_LE_32(floorHeader.numBars);
|
|---|
| 1012 |
|
|---|
| 1013 | if (_nBars >= O_GRID_SIZE)
|
|---|
| 1014 | {
|
|---|
| 1015 | --- 1910,1916 ----
|
|---|
| 1016 | fPolygrid += sizeof(Header);
|
|---|
| 1017 | memcpy(&floorHeader,fPolygrid,sizeof(WalkGridHeader));
|
|---|
| 1018 | fPolygrid += sizeof(WalkGridHeader);
|
|---|
| 1019 | ! _nBars = _resMan->getUint32(floorHeader.numBars);
|
|---|
| 1020 |
|
|---|
| 1021 | if (_nBars >= O_GRID_SIZE)
|
|---|
| 1022 | {
|
|---|
| 1023 | ***************
|
|---|
| 1024 | *** 1921,1927 ****
|
|---|
| 1025 | _nBars = 0;
|
|---|
| 1026 | }
|
|---|
| 1027 |
|
|---|
| 1028 | ! _nNodes = FROM_LE_32(floorHeader.numNodes)+1; //array starts at 0 begins at a start _node has nnodes nodes and a target _node
|
|---|
| 1029 |
|
|---|
| 1030 | if (_nNodes >= O_GRID_SIZE)
|
|---|
| 1031 | {
|
|---|
| 1032 | --- 1920,1926 ----
|
|---|
| 1033 | _nBars = 0;
|
|---|
| 1034 | }
|
|---|
| 1035 |
|
|---|
| 1036 | ! _nNodes = _resMan->getUint32(floorHeader.numNodes)+1; //array starts at 0 begins at a start _node has nnodes nodes and a target _node
|
|---|
| 1037 |
|
|---|
| 1038 | if (_nNodes >= O_GRID_SIZE)
|
|---|
| 1039 | {
|
|---|
| 1040 | ***************
|
|---|
| 1041 | *** 1934,1950 ****
|
|---|
| 1042 | /*memmove(&_bars[0],fPolygrid,_nBars*sizeof(BarData));
|
|---|
| 1043 | fPolygrid += _nBars*sizeof(BarData);//move pointer to start of _node data*/
|
|---|
| 1044 | for (cnt = 0; cnt < _nBars; cnt++) {
|
|---|
| 1045 | ! _bars[cnt].x1 = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
|---|
| 1046 | ! _bars[cnt].y1 = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
|---|
| 1047 | ! _bars[cnt].x2 = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
|---|
| 1048 | ! _bars[cnt].y2 = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
|---|
| 1049 | ! _bars[cnt].xmin = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
|---|
| 1050 | ! _bars[cnt].ymin = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
|---|
| 1051 | ! _bars[cnt].xmax = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
|---|
| 1052 | ! _bars[cnt].ymax = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
|---|
| 1053 | ! _bars[cnt].dx = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
|---|
| 1054 | ! _bars[cnt].dy = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
|---|
| 1055 | ! _bars[cnt].co = READ_LE_UINT32(fPolygrid); fPolygrid += 4;
|
|---|
| 1056 | }
|
|---|
| 1057 |
|
|---|
| 1058 | /*j = 1;// leave _node 0 for start _node
|
|---|
| 1059 | --- 1933,1949 ----
|
|---|
| 1060 | /*memmove(&_bars[0],fPolygrid,_nBars*sizeof(BarData));
|
|---|
| 1061 | fPolygrid += _nBars*sizeof(BarData);//move pointer to start of _node data*/
|
|---|
| 1062 | for (cnt = 0; cnt < _nBars; cnt++) {
|
|---|
| 1063 | ! _bars[cnt].x1 = _resMan->readUint16(fPolygrid); fPolygrid += 2;
|
|---|
| 1064 | ! _bars[cnt].y1 = _resMan->readUint16(fPolygrid); fPolygrid += 2;
|
|---|
| 1065 | ! _bars[cnt].x2 = _resMan->readUint16(fPolygrid); fPolygrid += 2;
|
|---|
| 1066 | ! _bars[cnt].y2 = _resMan->readUint16(fPolygrid); fPolygrid += 2;
|
|---|
| 1067 | ! _bars[cnt].xmin = _resMan->readUint16(fPolygrid); fPolygrid += 2;
|
|---|
| 1068 | ! _bars[cnt].ymin = _resMan->readUint16(fPolygrid); fPolygrid += 2;
|
|---|
| 1069 | ! _bars[cnt].xmax = _resMan->readUint16(fPolygrid); fPolygrid += 2;
|
|---|
| 1070 | ! _bars[cnt].ymax = _resMan->readUint16(fPolygrid); fPolygrid += 2;
|
|---|
| 1071 | ! _bars[cnt].dx = _resMan->readUint16(fPolygrid); fPolygrid += 2;
|
|---|
| 1072 | ! _bars[cnt].dy = _resMan->readUint16(fPolygrid); fPolygrid += 2;
|
|---|
| 1073 | ! _bars[cnt].co = _resMan->readUint32(fPolygrid); fPolygrid += 4;
|
|---|
| 1074 | }
|
|---|
| 1075 |
|
|---|
| 1076 | /*j = 1;// leave _node 0 for start _node
|
|---|
| 1077 | ***************
|
|---|
| 1078 | *** 1954,1961 ****
|
|---|
| 1079 | j ++;
|
|---|
| 1080 | } while (j < _nNodes);//array starts at 0*/
|
|---|
| 1081 | for (cnt = 1; cnt < _nNodes; cnt++) {
|
|---|
| 1082 | ! _node[cnt].x = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
|---|
| 1083 | ! _node[cnt].y = READ_LE_UINT16(fPolygrid); fPolygrid += 2;
|
|---|
| 1084 | }
|
|---|
| 1085 |
|
|---|
| 1086 | //ResUnlock(walkGridResourceId); // mouse wiggle
|
|---|
| 1087 | --- 1953,1960 ----
|
|---|
| 1088 | j ++;
|
|---|
| 1089 | } while (j < _nNodes);//array starts at 0*/
|
|---|
| 1090 | for (cnt = 1; cnt < _nNodes; cnt++) {
|
|---|
| 1091 | ! _node[cnt].x = _resMan->readUint16(fPolygrid); fPolygrid += 2;
|
|---|
| 1092 | ! _node[cnt].y = _resMan->readUint16(fPolygrid); fPolygrid += 2;
|
|---|
| 1093 | }
|
|---|
| 1094 |
|
|---|
| 1095 | //ResUnlock(walkGridResourceId); // mouse wiggle
|
|---|
| 1096 | ***************
|
|---|
| 1097 | *** 1980,1996 ****
|
|---|
| 1098 | //ResOpen(megaObject->o_mega_resource); // mouse wiggle
|
|---|
| 1099 | //fMegaWalkData = ResLock(megaObject->o_mega_resource); // mouse wiggle
|
|---|
| 1100 | fMegaWalkData = (uint8*)_resMan->openFetchRes(megaObject->o_mega_resource);
|
|---|
| 1101 |
|
|---|
| 1102 | _nWalkFrames = fMegaWalkData[0];
|
|---|
| 1103 | _nTurnFrames = fMegaWalkData[1];
|
|---|
| 1104 | fMegaWalkData += 2;
|
|---|
| 1105 | -
|
|---|
| 1106 | for (cnt = 0; cnt < NO_DIRECTIONS * (_nWalkFrames + 1 + _nTurnFrames); cnt++) {
|
|---|
| 1107 | ! _dx[cnt] = (int32)READ_LE_UINT32(fMegaWalkData);
|
|---|
| 1108 | fMegaWalkData += 4;
|
|---|
| 1109 | }
|
|---|
| 1110 | for (cnt = 0; cnt < NO_DIRECTIONS * (_nWalkFrames + 1 + _nTurnFrames); cnt++) {
|
|---|
| 1111 | ! _dy[cnt] = (int32)READ_LE_UINT32(fMegaWalkData);
|
|---|
| 1112 | fMegaWalkData += 4;
|
|---|
| 1113 | }
|
|---|
| 1114 | /*memmove(&_dx[0],fMegaWalkData,NO_DIRECTIONS*(_nWalkFrames+1+_nTurnFrames)*sizeof(int32));
|
|---|
| 1115 | --- 1979,1995 ----
|
|---|
| 1116 | //ResOpen(megaObject->o_mega_resource); // mouse wiggle
|
|---|
| 1117 | //fMegaWalkData = ResLock(megaObject->o_mega_resource); // mouse wiggle
|
|---|
| 1118 | fMegaWalkData = (uint8*)_resMan->openFetchRes(megaObject->o_mega_resource);
|
|---|
| 1119 | + // Apparently this resource is in little endian in both the Mac and the PC version
|
|---|
| 1120 |
|
|---|
| 1121 | _nWalkFrames = fMegaWalkData[0];
|
|---|
| 1122 | _nTurnFrames = fMegaWalkData[1];
|
|---|
| 1123 | fMegaWalkData += 2;
|
|---|
| 1124 | for (cnt = 0; cnt < NO_DIRECTIONS * (_nWalkFrames + 1 + _nTurnFrames); cnt++) {
|
|---|
| 1125 | ! _dx[cnt] = (int32)_resMan->readLEUint32(fMegaWalkData);
|
|---|
| 1126 | fMegaWalkData += 4;
|
|---|
| 1127 | }
|
|---|
| 1128 | for (cnt = 0; cnt < NO_DIRECTIONS * (_nWalkFrames + 1 + _nTurnFrames); cnt++) {
|
|---|
| 1129 | ! _dy[cnt] = (int32)_resMan->readLEUint32(fMegaWalkData);
|
|---|
| 1130 | fMegaWalkData += 4;
|
|---|
| 1131 | }
|
|---|
| 1132 | /*memmove(&_dx[0],fMegaWalkData,NO_DIRECTIONS*(_nWalkFrames+1+_nTurnFrames)*sizeof(int32));
|
|---|
| 1133 | ***************
|
|---|
| 1134 | *** 1999,2009 ****
|
|---|
| 1135 | fMegaWalkData += NO_DIRECTIONS*(_nWalkFrames+1+_nTurnFrames)*sizeof(int32);*/
|
|---|
| 1136 |
|
|---|
| 1137 | for (cntu = 0; cntu < NO_DIRECTIONS; cntu++) {
|
|---|
| 1138 | ! _modX[cntu] = (int32)READ_LE_UINT32(fMegaWalkData);
|
|---|
| 1139 | fMegaWalkData += 4;
|
|---|
| 1140 | }
|
|---|
| 1141 | for (cntu = 0; cntu < NO_DIRECTIONS; cntu++) {
|
|---|
| 1142 | ! _modY[cntu] = (int32)READ_LE_UINT32(fMegaWalkData);
|
|---|
| 1143 | fMegaWalkData += 4;
|
|---|
| 1144 | }
|
|---|
| 1145 | /*memmove(&_modX[0],fMegaWalkData,NO_DIRECTIONS*sizeof(int32));
|
|---|
| 1146 | --- 1998,2008 ----
|
|---|
| 1147 | fMegaWalkData += NO_DIRECTIONS*(_nWalkFrames+1+_nTurnFrames)*sizeof(int32);*/
|
|---|
| 1148 |
|
|---|
| 1149 | for (cntu = 0; cntu < NO_DIRECTIONS; cntu++) {
|
|---|
| 1150 | ! _modX[cntu] = (int32)_resMan->readLEUint32(fMegaWalkData);
|
|---|
| 1151 | fMegaWalkData += 4;
|
|---|
| 1152 | }
|
|---|
| 1153 | for (cntu = 0; cntu < NO_DIRECTIONS; cntu++) {
|
|---|
| 1154 | ! _modY[cntu] = (int32)_resMan->readLEUint32(fMegaWalkData);
|
|---|
| 1155 | fMegaWalkData += 4;
|
|---|
| 1156 | }
|
|---|
| 1157 | /*memmove(&_modX[0],fMegaWalkData,NO_DIRECTIONS*sizeof(int32));
|
|---|
| 1158 | diff -cr scummvm.old/engines/sword1/screen.cpp scummvm/engines/sword1/screen.cpp
|
|---|
| 1159 | *** scummvm.old/engines/sword1/screen.cpp Sat Sep 23 06:46:07 2006
|
|---|
| 1160 | --- scummvm/engines/sword1/screen.cpp Thu Oct 5 21:30:31 2006
|
|---|
| 1161 | ***************
|
|---|
| 1162 | *** 21,27 ****
|
|---|
| 1163 | */
|
|---|
| 1164 |
|
|---|
| 1165 | #include "common/stdafx.h"
|
|---|
| 1166 | - #include "common/endian.h"
|
|---|
| 1167 | #include "common/system.h"
|
|---|
| 1168 | #include "common/util.h"
|
|---|
| 1169 |
|
|---|
| 1170 | --- 21,26 ----
|
|---|
| 1171 | ***************
|
|---|
| 1172 | *** 407,446 ****
|
|---|
| 1173 | uint16 spriteY = compact->o_anim_y;
|
|---|
| 1174 | if (compact->o_status & STAT_SHRINK) {
|
|---|
| 1175 | scale = (compact->o_scale_a * compact->o_ycoord + compact->o_scale_b) / 256;
|
|---|
| 1176 | ! spriteX += ((int16)READ_LE_UINT16(&frameHead->offsetX) * scale) / 256;
|
|---|
| 1177 | ! spriteY += ((int16)READ_LE_UINT16(&frameHead->offsetY) * scale) / 256;
|
|---|
| 1178 | } else {
|
|---|
| 1179 | scale = 256;
|
|---|
| 1180 | ! spriteX += (int16)READ_LE_UINT16(&frameHead->offsetX);
|
|---|
| 1181 | ! spriteY += (int16)READ_LE_UINT16(&frameHead->offsetY);
|
|---|
| 1182 | }
|
|---|
| 1183 |
|
|---|
| 1184 | uint8 *tonyBuf = NULL;
|
|---|
| 1185 | if (frameHead->runTimeComp[3] == '7') { // RLE7 encoded?
|
|---|
| 1186 | ! decompressRLE7(sprData, READ_LE_UINT32(&frameHead->compSize), _rleBuffer);
|
|---|
| 1187 | sprData = _rleBuffer;
|
|---|
| 1188 | } else if (frameHead->runTimeComp[3] == '0') { // RLE0 encoded?
|
|---|
| 1189 | ! decompressRLE0(sprData, READ_LE_UINT32(&frameHead->compSize), _rleBuffer);
|
|---|
| 1190 | sprData = _rleBuffer;
|
|---|
| 1191 | } else if (frameHead->runTimeComp[1] == 'I') { // new type
|
|---|
| 1192 | ! tonyBuf = (uint8*)malloc(READ_LE_UINT16(&frameHead->width) * READ_LE_UINT16(&frameHead->height));
|
|---|
| 1193 | ! decompressTony(sprData, READ_LE_UINT32(&frameHead->compSize), tonyBuf);
|
|---|
| 1194 | sprData = tonyBuf;
|
|---|
| 1195 | }
|
|---|
| 1196 |
|
|---|
| 1197 | uint16 sprSizeX, sprSizeY;
|
|---|
| 1198 | if (compact->o_status & STAT_SHRINK) {
|
|---|
| 1199 | ! sprSizeX = (scale * READ_LE_UINT16(&frameHead->width)) / 256;
|
|---|
| 1200 | ! sprSizeY = (scale * READ_LE_UINT16(&frameHead->height)) / 256;
|
|---|
| 1201 | ! fastShrink(sprData, READ_LE_UINT16(&frameHead->width), READ_LE_UINT16(&frameHead->height), scale, _shrinkBuffer);
|
|---|
| 1202 | sprData = _shrinkBuffer;
|
|---|
| 1203 | } else {
|
|---|
| 1204 | ! sprSizeX = READ_LE_UINT16(&frameHead->width);
|
|---|
| 1205 | ! sprSizeY = READ_LE_UINT16(&frameHead->height);
|
|---|
| 1206 | }
|
|---|
| 1207 | if (!(compact->o_status & STAT_OVERRIDE)) {
|
|---|
| 1208 | //mouse size linked to exact size & coordinates of sprite box - shrink friendly
|
|---|
| 1209 | ! if (READ_LE_UINT16(&frameHead->offsetX) || READ_LE_UINT16(&frameHead->offsetY)) {
|
|---|
| 1210 | //for megas the mouse area is reduced to account for sprite not
|
|---|
| 1211 | //filling the box size is reduced to 1/2 width, 4/5 height
|
|---|
| 1212 | compact->o_mouse_x1 = spriteX + sprSizeX / 4;
|
|---|
| 1213 | --- 406,445 ----
|
|---|
| 1214 | uint16 spriteY = compact->o_anim_y;
|
|---|
| 1215 | if (compact->o_status & STAT_SHRINK) {
|
|---|
| 1216 | scale = (compact->o_scale_a * compact->o_ycoord + compact->o_scale_b) / 256;
|
|---|
| 1217 | ! spriteX += ((int16)_resMan->readUint16(&frameHead->offsetX) * scale) / 256;
|
|---|
| 1218 | ! spriteY += ((int16)_resMan->readUint16(&frameHead->offsetY) * scale) / 256;
|
|---|
| 1219 | } else {
|
|---|
| 1220 | scale = 256;
|
|---|
| 1221 | ! spriteX += (int16)_resMan->readUint16(&frameHead->offsetX);
|
|---|
| 1222 | ! spriteY += (int16)_resMan->readUint16(&frameHead->offsetY);
|
|---|
| 1223 | }
|
|---|
| 1224 |
|
|---|
| 1225 | uint8 *tonyBuf = NULL;
|
|---|
| 1226 | if (frameHead->runTimeComp[3] == '7') { // RLE7 encoded?
|
|---|
| 1227 | ! decompressRLE7(sprData, _resMan->readUint32(&frameHead->compSize), _rleBuffer);
|
|---|
| 1228 | sprData = _rleBuffer;
|
|---|
| 1229 | } else if (frameHead->runTimeComp[3] == '0') { // RLE0 encoded?
|
|---|
| 1230 | ! decompressRLE0(sprData, _resMan->readUint32(&frameHead->compSize), _rleBuffer);
|
|---|
| 1231 | sprData = _rleBuffer;
|
|---|
| 1232 | } else if (frameHead->runTimeComp[1] == 'I') { // new type
|
|---|
| 1233 | ! tonyBuf = (uint8*)malloc(_resMan->readUint16(&frameHead->width) * _resMan->readUint16(&frameHead->height));
|
|---|
| 1234 | ! decompressTony(sprData, _resMan->readUint32(&frameHead->compSize), tonyBuf);
|
|---|
| 1235 | sprData = tonyBuf;
|
|---|
| 1236 | }
|
|---|
| 1237 |
|
|---|
| 1238 | uint16 sprSizeX, sprSizeY;
|
|---|
| 1239 | if (compact->o_status & STAT_SHRINK) {
|
|---|
| 1240 | ! sprSizeX = (scale * _resMan->readUint16(&frameHead->width)) / 256;
|
|---|
| 1241 | ! sprSizeY = (scale * _resMan->readUint16(&frameHead->height)) / 256;
|
|---|
| 1242 | ! fastShrink(sprData, _resMan->readUint16(&frameHead->width), _resMan->readUint16(&frameHead->height), scale, _shrinkBuffer);
|
|---|
| 1243 | sprData = _shrinkBuffer;
|
|---|
| 1244 | } else {
|
|---|
| 1245 | ! sprSizeX = _resMan->readUint16(&frameHead->width);
|
|---|
| 1246 | ! sprSizeY = _resMan->readUint16(&frameHead->height);
|
|---|
| 1247 | }
|
|---|
| 1248 | if (!(compact->o_status & STAT_OVERRIDE)) {
|
|---|
| 1249 | //mouse size linked to exact size & coordinates of sprite box - shrink friendly
|
|---|
| 1250 | ! if (_resMan->readUint16(&frameHead->offsetX) || _resMan->readUint16(&frameHead->offsetY)) {
|
|---|
| 1251 | //for megas the mouse area is reduced to account for sprite not
|
|---|
| 1252 | //filling the box size is reduced to 1/2 width, 4/5 height
|
|---|
| 1253 | compact->o_mouse_x1 = spriteX + sprSizeX / 4;
|
|---|
| 1254 | ***************
|
|---|
| 1255 | *** 495,501 ****
|
|---|
| 1256 | uint16 *grid = _layerGrid[level] + gridX + blkx + gridY * lGridSizeX;
|
|---|
| 1257 | for (int16 blky = bHeight - 1; blky >= 0; blky--) {
|
|---|
| 1258 | if (*grid) {
|
|---|
| 1259 | ! uint8 *blkData = _layerBlocks[level + 1] + (READ_LE_UINT16(grid) - 1) * 128;
|
|---|
| 1260 | blitBlockClear(x + blkx, y + blky, blkData);
|
|---|
| 1261 | } else
|
|---|
| 1262 | break;
|
|---|
| 1263 | --- 494,500 ----
|
|---|
| 1264 | uint16 *grid = _layerGrid[level] + gridX + blkx + gridY * lGridSizeX;
|
|---|
| 1265 | for (int16 blky = bHeight - 1; blky >= 0; blky--) {
|
|---|
| 1266 | if (*grid) {
|
|---|
| 1267 | ! uint8 *blkData = _layerBlocks[level + 1] + (_resMan->readUint16(grid) - 1) * 128;
|
|---|
| 1268 | blitBlockClear(x + blkx, y + blky, blkData);
|
|---|
| 1269 | } else
|
|---|
| 1270 | break;
|
|---|
| 1271 | ***************
|
|---|
| 1272 | *** 520,526 ****
|
|---|
| 1273 | void Screen::renderParallax(uint8 *data) {
|
|---|
| 1274 | ParallaxHeader *header = (ParallaxHeader*)data;
|
|---|
| 1275 | uint32 *lineIndexes = (uint32*)(data + sizeof(ParallaxHeader));
|
|---|
| 1276 | ! assert((FROM_LE_16(header->sizeX) >= SCREEN_WIDTH) && (FROM_LE_16(header->sizeY) >= SCREEN_DEPTH));
|
|---|
| 1277 |
|
|---|
| 1278 | uint16 paraScrlX, paraScrlY;
|
|---|
| 1279 | uint16 scrnScrlX, scrnScrlY;
|
|---|
| 1280 | --- 519,525 ----
|
|---|
| 1281 | void Screen::renderParallax(uint8 *data) {
|
|---|
| 1282 | ParallaxHeader *header = (ParallaxHeader*)data;
|
|---|
| 1283 | uint32 *lineIndexes = (uint32*)(data + sizeof(ParallaxHeader));
|
|---|
| 1284 | ! assert((_resMan->getUint16(header->sizeX) >= SCREEN_WIDTH) && (_resMan->getUint16(header->sizeY) >= SCREEN_DEPTH));
|
|---|
| 1285 |
|
|---|
| 1286 | uint16 paraScrlX, paraScrlY;
|
|---|
| 1287 | uint16 scrnScrlX, scrnScrlY;
|
|---|
| 1288 | ***************
|
|---|
| 1289 | *** 533,551 ****
|
|---|
| 1290 | scrnHeight = SCREEN_DEPTH + ABS((int32)_oldScrollY - (int32)Logic::_scriptVars[SCROLL_OFFSET_Y]);
|
|---|
| 1291 |
|
|---|
| 1292 | if (_scrnSizeX != SCREEN_WIDTH) {
|
|---|
| 1293 | ! double scrlfx = (FROM_LE_16(header->sizeX) - SCREEN_WIDTH) / ((double)(_scrnSizeX - SCREEN_WIDTH));
|
|---|
| 1294 | paraScrlX = (uint16)(scrnScrlX * scrlfx);
|
|---|
| 1295 | } else
|
|---|
| 1296 | paraScrlX = 0;
|
|---|
| 1297 |
|
|---|
| 1298 | if (_scrnSizeY != SCREEN_DEPTH) {
|
|---|
| 1299 | ! double scrlfy = (FROM_LE_16(header->sizeY) - SCREEN_DEPTH) / ((double)(_scrnSizeY - SCREEN_DEPTH));
|
|---|
| 1300 | paraScrlY = (uint16)(scrnScrlY * scrlfy);
|
|---|
| 1301 | } else
|
|---|
| 1302 | paraScrlY = 0;
|
|---|
| 1303 |
|
|---|
| 1304 | for (uint16 cnty = 0; cnty < scrnHeight; cnty++) {
|
|---|
| 1305 | ! uint8 *src = data + READ_LE_UINT32(lineIndexes + cnty + paraScrlY);
|
|---|
| 1306 | uint8 *dest = _screenBuf + scrnScrlX + (cnty + scrnScrlY) * _scrnSizeX;
|
|---|
| 1307 | uint16 remain = paraScrlX;
|
|---|
| 1308 | uint16 xPos = 0;
|
|---|
| 1309 | --- 532,550 ----
|
|---|
| 1310 | scrnHeight = SCREEN_DEPTH + ABS((int32)_oldScrollY - (int32)Logic::_scriptVars[SCROLL_OFFSET_Y]);
|
|---|
| 1311 |
|
|---|
| 1312 | if (_scrnSizeX != SCREEN_WIDTH) {
|
|---|
| 1313 | ! double scrlfx = (_resMan->getUint16(header->sizeX) - SCREEN_WIDTH) / ((double)(_scrnSizeX - SCREEN_WIDTH));
|
|---|
| 1314 | paraScrlX = (uint16)(scrnScrlX * scrlfx);
|
|---|
| 1315 | } else
|
|---|
| 1316 | paraScrlX = 0;
|
|---|
| 1317 |
|
|---|
| 1318 | if (_scrnSizeY != SCREEN_DEPTH) {
|
|---|
| 1319 | ! double scrlfy = (_resMan->getUint16(header->sizeY) - SCREEN_DEPTH) / ((double)(_scrnSizeY - SCREEN_DEPTH));
|
|---|
| 1320 | paraScrlY = (uint16)(scrnScrlY * scrlfy);
|
|---|
| 1321 | } else
|
|---|
| 1322 | paraScrlY = 0;
|
|---|
| 1323 |
|
|---|
| 1324 | for (uint16 cnty = 0; cnty < scrnHeight; cnty++) {
|
|---|
| 1325 | ! uint8 *src = data + _resMan->readUint32(lineIndexes + cnty + paraScrlY);
|
|---|
| 1326 | uint8 *dest = _screenBuf + scrnScrlX + (cnty + scrnScrlY) * _scrnSizeX;
|
|---|
| 1327 | uint16 remain = paraScrlX;
|
|---|
| 1328 | uint16 xPos = 0;
|
|---|
| 1329 | ***************
|
|---|
| 1330 | *** 655,661 ****
|
|---|
| 1331 | if (!(cpt->o_status & STAT_SHRINK)) { // not a boxed mega using shrinking
|
|---|
| 1332 | Header *frameRaw = (Header*)_resMan->openFetchRes(cpt->o_resource);
|
|---|
| 1333 | FrameHeader *frameHead = _resMan->fetchFrame(frameRaw, cpt->o_frame);
|
|---|
| 1334 | ! _sortList[_sortLength].y += READ_LE_UINT16(&frameHead->height) - 1; // now pointing to base of sprite
|
|---|
| 1335 | _resMan->resClose(cpt->o_resource);
|
|---|
| 1336 | }
|
|---|
| 1337 | _sortLength++;
|
|---|
| 1338 | --- 654,660 ----
|
|---|
| 1339 | if (!(cpt->o_status & STAT_SHRINK)) { // not a boxed mega using shrinking
|
|---|
| 1340 | Header *frameRaw = (Header*)_resMan->openFetchRes(cpt->o_resource);
|
|---|
| 1341 | FrameHeader *frameHead = _resMan->fetchFrame(frameRaw, cpt->o_frame);
|
|---|
| 1342 | ! _sortList[_sortLength].y += _resMan->readUint16(&frameHead->height) - 1; // now pointing to base of sprite
|
|---|
| 1343 | _resMan->resClose(cpt->o_resource);
|
|---|
| 1344 | }
|
|---|
| 1345 | _sortLength++;
|
|---|
| 1346 | ***************
|
|---|
| 1347 | *** 803,811 ****
|
|---|
| 1348 | FrameHeader *frameHead = _resMan->fetchFrame(_resMan->openFetchRes(resId), frameNo);
|
|---|
| 1349 | uint8 *frameData = ((uint8*)frameHead) + sizeof(FrameHeader);
|
|---|
| 1350 |
|
|---|
| 1351 | ! for (i = 0; i < FROM_LE_16(frameHead->height); i++) {
|
|---|
| 1352 | ! for (j = 0; j < FROM_LE_16(frameHead->height); j++) {
|
|---|
| 1353 | ! frame[(i + 4) * 40 + j + 2] = frameData[i * FROM_LE_16(frameHead->width) + j];
|
|---|
| 1354 | }
|
|---|
| 1355 | }
|
|---|
| 1356 |
|
|---|
| 1357 | --- 802,810 ----
|
|---|
| 1358 | FrameHeader *frameHead = _resMan->fetchFrame(_resMan->openFetchRes(resId), frameNo);
|
|---|
| 1359 | uint8 *frameData = ((uint8*)frameHead) + sizeof(FrameHeader);
|
|---|
| 1360 |
|
|---|
| 1361 | ! for (i = 0; i < _resMan->getUint16(frameHead->height); i++) {
|
|---|
| 1362 | ! for (j = 0; j < _resMan->getUint16(frameHead->height); j++) {
|
|---|
| 1363 | ! frame[(i + 4) * 40 + j + 2] = frameData[i * _resMan->getUint16(frameHead->width) + j];
|
|---|
| 1364 | }
|
|---|
| 1365 | }
|
|---|
| 1366 |
|
|---|
| 1367 | diff -cr scummvm.old/engines/sword1/sword1.cpp scummvm/engines/sword1/sword1.cpp
|
|---|
| 1368 | *** scummvm.old/engines/sword1/sword1.cpp Sat Sep 23 06:46:06 2006
|
|---|
| 1369 | --- scummvm/engines/sword1/sword1.cpp Sun Oct 1 18:19:20 2006
|
|---|
| 1370 | ***************
|
|---|
| 1371 | *** 51,66 ****
|
|---|
| 1372 | {"sword1", "Broken Sword 1: The Shadow of the Templars"};
|
|---|
| 1373 | static const PlainGameDescriptor sword1DemoSettings =
|
|---|
| 1374 | {"sword1demo", "Broken Sword 1: The Shadow of the Templars (Demo)"};
|
|---|
| 1375 |
|
|---|
| 1376 | // check these subdirectories (if present)
|
|---|
| 1377 | static const char *g_dirNames[] = { "clusters", "speech" };
|
|---|
| 1378 |
|
|---|
| 1379 | ! #define NUM_FILES_TO_CHECK 5
|
|---|
| 1380 | static const char *g_filesToCheck[NUM_FILES_TO_CHECK] = { // these files have to be found
|
|---|
| 1381 | ! "swordres.rif",
|
|---|
| 1382 | ! "general.clu",
|
|---|
| 1383 | ! "compacts.clu",
|
|---|
| 1384 | ! "scripts.clu",
|
|---|
| 1385 | "cows.mad", // this one should only exist in the demo version
|
|---|
| 1386 | // the engine needs several more files to work, but checking these should be sufficient
|
|---|
| 1387 | };
|
|---|
| 1388 | --- 51,77 ----
|
|---|
| 1389 | {"sword1", "Broken Sword 1: The Shadow of the Templars"};
|
|---|
| 1390 | static const PlainGameDescriptor sword1DemoSettings =
|
|---|
| 1391 | {"sword1demo", "Broken Sword 1: The Shadow of the Templars (Demo)"};
|
|---|
| 1392 | + static const PlainGameDescriptor sword1MacFullSettings =
|
|---|
| 1393 | + {"sword1mac", "Broken Sword 1: The Shadow of the Templars (Mac)"};
|
|---|
| 1394 | + static const PlainGameDescriptor sword1MacDemoSettings =
|
|---|
| 1395 | + {"sword1macdemo", "Broken Sword 1: The Shadow of the Templars (Mac demo)"};
|
|---|
| 1396 |
|
|---|
| 1397 | // check these subdirectories (if present)
|
|---|
| 1398 | static const char *g_dirNames[] = { "clusters", "speech" };
|
|---|
| 1399 |
|
|---|
| 1400 | ! #define NUM_COMMON_FILES_TO_CHECK 1
|
|---|
| 1401 | ! #define NUM_PC_FILES_TO_CHECK 3
|
|---|
| 1402 | ! #define NUM_MAC_FILES_TO_CHECK 3
|
|---|
| 1403 | ! #define NUM_DEMO_FILES_TO_CHECK 1
|
|---|
| 1404 | ! #define NUM_FILES_TO_CHECK NUM_COMMON_FILES_TO_CHECK + NUM_PC_FILES_TO_CHECK + NUM_MAC_FILES_TO_CHECK + NUM_DEMO_FILES_TO_CHECK
|
|---|
| 1405 | static const char *g_filesToCheck[NUM_FILES_TO_CHECK] = { // these files have to be found
|
|---|
| 1406 | ! "swordres.rif", // Mac and PC version
|
|---|
| 1407 | ! "general.clu", // PC version only
|
|---|
| 1408 | ! "compacts.clu", // PC version only
|
|---|
| 1409 | ! "scripts.clu", // PC version only
|
|---|
| 1410 | ! "general.clm", // Mac version only
|
|---|
| 1411 | ! "compacts.clm", // Mac version only
|
|---|
| 1412 | ! "scripts.clm", // Mac version only
|
|---|
| 1413 | "cows.mad", // this one should only exist in the demo version
|
|---|
| 1414 | // the engine needs several more files to work, but checking these should be sufficient
|
|---|
| 1415 | };
|
|---|
| 1416 | ***************
|
|---|
| 1417 | *** 69,74 ****
|
|---|
| 1418 | --- 80,87 ----
|
|---|
| 1419 | GameList games;
|
|---|
| 1420 | games.push_back(sword1FullSettings);
|
|---|
| 1421 | games.push_back(sword1DemoSettings);
|
|---|
| 1422 | + games.push_back(sword1MacFullSettings);
|
|---|
| 1423 | + games.push_back(sword1MacDemoSettings);
|
|---|
| 1424 | return games;
|
|---|
| 1425 | }
|
|---|
| 1426 |
|
|---|
| 1427 | ***************
|
|---|
| 1428 | *** 77,82 ****
|
|---|
| 1429 | --- 90,99 ----
|
|---|
| 1430 | return sword1FullSettings;
|
|---|
| 1431 | if (0 == scumm_stricmp(gameid, sword1DemoSettings.gameid))
|
|---|
| 1432 | return sword1DemoSettings;
|
|---|
| 1433 | + if (0 == scumm_stricmp(gameid, sword1MacFullSettings.gameid))
|
|---|
| 1434 | + return sword1MacFullSettings;
|
|---|
| 1435 | + if (0 == scumm_stricmp(gameid, sword1MacDemoSettings.gameid))
|
|---|
| 1436 | + return sword1MacDemoSettings;
|
|---|
| 1437 | return GameDescriptor();
|
|---|
| 1438 | }
|
|---|
| 1439 |
|
|---|
| 1440 | ***************
|
|---|
| 1441 | *** 99,120 ****
|
|---|
| 1442 | }
|
|---|
| 1443 |
|
|---|
| 1444 | DetectedGameList Engine_SWORD1_detectGames(const FSList &fslist) {
|
|---|
| 1445 | ! int i;
|
|---|
| 1446 | DetectedGameList detectedGames;
|
|---|
| 1447 | bool filesFound[NUM_FILES_TO_CHECK];
|
|---|
| 1448 | for (i = 0; i < NUM_FILES_TO_CHECK; i++)
|
|---|
| 1449 | filesFound[i] = false;
|
|---|
| 1450 | !
|
|---|
| 1451 | Sword1CheckDirectory(fslist, filesFound);
|
|---|
| 1452 | bool mainFilesFound = true;
|
|---|
| 1453 | ! for (i = 0; i < NUM_FILES_TO_CHECK -1; i++)
|
|---|
| 1454 | if (!filesFound[i])
|
|---|
| 1455 | mainFilesFound = false;
|
|---|
| 1456 |
|
|---|
| 1457 | ! if (mainFilesFound && filesFound[NUM_FILES_TO_CHECK - 1])
|
|---|
| 1458 | detectedGames.push_back(sword1DemoSettings);
|
|---|
| 1459 | ! else if (mainFilesFound)
|
|---|
| 1460 | detectedGames.push_back(sword1FullSettings);
|
|---|
| 1461 |
|
|---|
| 1462 | return detectedGames;
|
|---|
| 1463 | }
|
|---|
| 1464 | --- 116,153 ----
|
|---|
| 1465 | }
|
|---|
| 1466 |
|
|---|
| 1467 | DetectedGameList Engine_SWORD1_detectGames(const FSList &fslist) {
|
|---|
| 1468 | ! int i, j;
|
|---|
| 1469 | DetectedGameList detectedGames;
|
|---|
| 1470 | bool filesFound[NUM_FILES_TO_CHECK];
|
|---|
| 1471 | for (i = 0; i < NUM_FILES_TO_CHECK; i++)
|
|---|
| 1472 | filesFound[i] = false;
|
|---|
| 1473 | !
|
|---|
| 1474 | Sword1CheckDirectory(fslist, filesFound);
|
|---|
| 1475 | bool mainFilesFound = true;
|
|---|
| 1476 | ! bool pcFilesFound = true;
|
|---|
| 1477 | ! bool macFilesFound = true;
|
|---|
| 1478 | ! bool demoFilesFound = true;
|
|---|
| 1479 | ! for (i = 0; i < NUM_COMMON_FILES_TO_CHECK; i++)
|
|---|
| 1480 | if (!filesFound[i])
|
|---|
| 1481 | mainFilesFound = false;
|
|---|
| 1482 | + for (j = 0; j < NUM_PC_FILES_TO_CHECK; i++, j++)
|
|---|
| 1483 | + if (!filesFound[i])
|
|---|
| 1484 | + pcFilesFound = false;
|
|---|
| 1485 | + for (j = 0; j < NUM_MAC_FILES_TO_CHECK; i++, j++)
|
|---|
| 1486 | + if (!filesFound[i])
|
|---|
| 1487 | + macFilesFound = false;
|
|---|
| 1488 | + for (j = 0; j < NUM_DEMO_FILES_TO_CHECK; i++, j++)
|
|---|
| 1489 | + if (!filesFound[i])
|
|---|
| 1490 | + demoFilesFound = false;
|
|---|
| 1491 |
|
|---|
| 1492 | ! if (mainFilesFound && pcFilesFound && demoFilesFound)
|
|---|
| 1493 | detectedGames.push_back(sword1DemoSettings);
|
|---|
| 1494 | ! else if (mainFilesFound && pcFilesFound)
|
|---|
| 1495 | detectedGames.push_back(sword1FullSettings);
|
|---|
| 1496 | + else if (mainFilesFound && macFilesFound && demoFilesFound)
|
|---|
| 1497 | + detectedGames.push_back(sword1MacDemoSettings);
|
|---|
| 1498 | + else if (mainFilesFound && macFilesFound)
|
|---|
| 1499 | + detectedGames.push_back(sword1MacFullSettings);
|
|---|
| 1500 |
|
|---|
| 1501 | return detectedGames;
|
|---|
| 1502 | }
|
|---|
| 1503 | ***************
|
|---|
| 1504 | *** 134,144 ****
|
|---|
| 1505 | SwordEngine::SwordEngine(OSystem *syst)
|
|---|
| 1506 | : Engine(syst) {
|
|---|
| 1507 |
|
|---|
| 1508 | ! if (0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1demo"))
|
|---|
| 1509 | _features = GF_DEMO;
|
|---|
| 1510 | else
|
|---|
| 1511 | ! _features = 0;
|
|---|
| 1512 | !
|
|---|
| 1513 |
|
|---|
| 1514 | if (!_mixer->isReady())
|
|---|
| 1515 | warning("Sound initialization failed");
|
|---|
| 1516 | --- 167,177 ----
|
|---|
| 1517 | SwordEngine::SwordEngine(OSystem *syst)
|
|---|
| 1518 | : Engine(syst) {
|
|---|
| 1519 |
|
|---|
| 1520 | ! if ( 0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1demo") ||
|
|---|
| 1521 | ! 0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1macdemo") )
|
|---|
| 1522 | _features = GF_DEMO;
|
|---|
| 1523 | else
|
|---|
| 1524 | ! _features = 0;
|
|---|
| 1525 |
|
|---|
| 1526 | if (!_mixer->isReady())
|
|---|
| 1527 | warning("Sound initialization failed");
|
|---|
| 1528 | ***************
|
|---|
| 1529 | *** 172,182 ****
|
|---|
| 1530 | initCommonGFX(true);
|
|---|
| 1531 | _system->initSize(640, 480);
|
|---|
| 1532 | _system->endGFXTransaction();
|
|---|
| 1533 |
|
|---|
| 1534 | checkCdFiles();
|
|---|
| 1535 |
|
|---|
| 1536 | debug(5, "Starting resource manager");
|
|---|
| 1537 | ! _resMan = new ResMan("swordres.rif");
|
|---|
| 1538 | debug(5, "Starting object manager");
|
|---|
| 1539 | _objectMan = new ObjectMan(_resMan);
|
|---|
| 1540 | _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, Audio::Mixer::kMaxMixerVolume);
|
|---|
| 1541 | --- 205,221 ----
|
|---|
| 1542 | initCommonGFX(true);
|
|---|
| 1543 | _system->initSize(640, 480);
|
|---|
| 1544 | _system->endGFXTransaction();
|
|---|
| 1545 | +
|
|---|
| 1546 | + if ( 0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1mac") ||
|
|---|
| 1547 | + 0 == scumm_stricmp(ConfMan.get("gameid").c_str(), "sword1macdemo") )
|
|---|
| 1548 | + _systemVars.isMac = true;
|
|---|
| 1549 | + else
|
|---|
| 1550 | + _systemVars.isMac = false;
|
|---|
| 1551 |
|
|---|
| 1552 | checkCdFiles();
|
|---|
| 1553 |
|
|---|
| 1554 | debug(5, "Starting resource manager");
|
|---|
| 1555 | ! _resMan = new ResMan("swordres.rif", _systemVars.isMac);
|
|---|
| 1556 | debug(5, "Starting object manager");
|
|---|
| 1557 | _objectMan = new ObjectMan(_resMan);
|
|---|
| 1558 | _mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, Audio::Mixer::kMaxMixerVolume);
|
|---|
| 1559 | ***************
|
|---|
| 1560 | *** 287,293 ****
|
|---|
| 1561 | "Please copy these files from their corresponding CDs:\n"
|
|---|
| 1562 | };
|
|---|
| 1563 |
|
|---|
| 1564 | ! const CdFile SwordEngine::_cdFileList[] = {
|
|---|
| 1565 | { "paris2.clu", FLAG_CD1 },
|
|---|
| 1566 | { "ireland.clu", FLAG_CD2 },
|
|---|
| 1567 | { "paris3.clu", FLAG_CD1 },
|
|---|
| 1568 | --- 326,332 ----
|
|---|
| 1569 | "Please copy these files from their corresponding CDs:\n"
|
|---|
| 1570 | };
|
|---|
| 1571 |
|
|---|
| 1572 | ! const CdFile SwordEngine::_pcCdFileList[] = {
|
|---|
| 1573 | { "paris2.clu", FLAG_CD1 },
|
|---|
| 1574 | { "ireland.clu", FLAG_CD2 },
|
|---|
| 1575 | { "paris3.clu", FLAG_CD1 },
|
|---|
| 1576 | ***************
|
|---|
| 1577 | *** 316,344 ****
|
|---|
| 1578 | #endif
|
|---|
| 1579 | };
|
|---|
| 1580 |
|
|---|
| 1581 | void SwordEngine::showFileErrorMsg(uint8 type, bool *fileExists) {
|
|---|
| 1582 | char msg[1024];
|
|---|
| 1583 | int missCnt = 0, missNum = 0;
|
|---|
| 1584 | ! for (int i = 0; i < ARRAYSIZE(_cdFileList); i++)
|
|---|
| 1585 | ! if (!fileExists[i]) {
|
|---|
| 1586 | ! missCnt++;
|
|---|
| 1587 | ! missNum = i;
|
|---|
| 1588 | ! }
|
|---|
| 1589 | ! assert(missCnt > 0); // this function shouldn't get called if there's nothing missing.
|
|---|
| 1590 | ! warning("%d files missing", missCnt);
|
|---|
| 1591 | ! int msgId = (type == TYPE_IMMED) ? 0 : 2;
|
|---|
| 1592 | ! if (missCnt == 1) {
|
|---|
| 1593 | ! sprintf(msg, errorMsgs[msgId],
|
|---|
| 1594 | ! _cdFileList[missNum].name, (_cdFileList[missNum].flags & FLAG_CD2) ? 2 : 1);
|
|---|
| 1595 | ! warning(msg);
|
|---|
| 1596 | } else {
|
|---|
| 1597 | ! char *pos = msg + sprintf(msg, errorMsgs[msgId + 1], missCnt);
|
|---|
| 1598 | ! warning(msg);
|
|---|
| 1599 | ! for (int i = 0; i < ARRAYSIZE(_cdFileList); i++)
|
|---|
| 1600 | if (!fileExists[i]) {
|
|---|
| 1601 | ! warning("\"%s\" (CD %d)", _cdFileList[i].name, (_cdFileList[i].flags & FLAG_CD2) ? 2 : 1);
|
|---|
| 1602 | ! pos += sprintf(pos, "\"%s\" (CD %d)\n", _cdFileList[i].name, (_cdFileList[i].flags & FLAG_CD2) ? 2 : 1);
|
|---|
| 1603 | }
|
|---|
| 1604 | }
|
|---|
| 1605 | GUI::MessageDialog dialog(msg);
|
|---|
| 1606 | dialog.runModal();
|
|---|
| 1607 | --- 355,438 ----
|
|---|
| 1608 | #endif
|
|---|
| 1609 | };
|
|---|
| 1610 |
|
|---|
| 1611 | + const CdFile SwordEngine::_macCdFileList[] = {
|
|---|
| 1612 | + { "paris2.clm", FLAG_CD1 },
|
|---|
| 1613 | + { "ireland.clm", FLAG_CD2 },
|
|---|
| 1614 | + { "paris3.clm", FLAG_CD1 },
|
|---|
| 1615 | + { "paris4.clm", FLAG_CD1 },
|
|---|
| 1616 | + { "scotland.clm", FLAG_CD2 },
|
|---|
| 1617 | + { "spain.clm", FLAG_CD2 },
|
|---|
| 1618 | + { "syria.clm", FLAG_CD2 },
|
|---|
| 1619 | + { "train.clm", FLAG_CD2 },
|
|---|
| 1620 | + { "compacts.clm", FLAG_CD1 | FLAG_DEMO | FLAG_IMMED },
|
|---|
| 1621 | + { "general.clm", FLAG_CD1 | FLAG_DEMO | FLAG_IMMED },
|
|---|
| 1622 | + { "maps.clm", FLAG_CD1 | FLAG_DEMO },
|
|---|
| 1623 | + { "paris1.clm", FLAG_CD1 | FLAG_DEMO },
|
|---|
| 1624 | + { "scripts.clm", FLAG_CD1 | FLAG_DEMO | FLAG_IMMED },
|
|---|
| 1625 | + { "swordres.rif", FLAG_CD1 | FLAG_DEMO | FLAG_IMMED },
|
|---|
| 1626 | + { "text.clm", FLAG_CD1 | FLAG_DEMO },
|
|---|
| 1627 | + { "cows.mad", FLAG_DEMO },
|
|---|
| 1628 | + { "speech1.clu", FLAG_SPEECH1 },
|
|---|
| 1629 | + { "speech2.clu", FLAG_SPEECH2 }
|
|---|
| 1630 | + #ifdef USE_MAD
|
|---|
| 1631 | + ,{ "speech1.cl3", FLAG_SPEECH1 },
|
|---|
| 1632 | + { "speech2.cl3", FLAG_SPEECH2 }
|
|---|
| 1633 | + #endif
|
|---|
| 1634 | + #ifdef USE_VORBIS
|
|---|
| 1635 | + ,{ "speech1.clv", FLAG_SPEECH1 },
|
|---|
| 1636 | + { "speech2.clv", FLAG_SPEECH2 }
|
|---|
| 1637 | + #endif
|
|---|
| 1638 | + };
|
|---|
| 1639 | +
|
|---|
| 1640 | +
|
|---|
| 1641 | void SwordEngine::showFileErrorMsg(uint8 type, bool *fileExists) {
|
|---|
| 1642 | char msg[1024];
|
|---|
| 1643 | int missCnt = 0, missNum = 0;
|
|---|
| 1644 | !
|
|---|
| 1645 | ! if (_systemVars.isMac) {
|
|---|
| 1646 | ! for (int i = 0; i < ARRAYSIZE(_macCdFileList); i++)
|
|---|
| 1647 | ! if (!fileExists[i]) {
|
|---|
| 1648 | ! missCnt++;
|
|---|
| 1649 | ! missNum = i;
|
|---|
| 1650 | ! }
|
|---|
| 1651 | ! assert(missCnt > 0); // this function shouldn't get called if there's nothing missing.
|
|---|
| 1652 | ! warning("%d files missing", missCnt);
|
|---|
| 1653 | ! int msgId = (type == TYPE_IMMED) ? 0 : 2;
|
|---|
| 1654 | ! if (missCnt == 1) {
|
|---|
| 1655 | ! sprintf(msg, errorMsgs[msgId],
|
|---|
| 1656 | ! _macCdFileList[missNum].name, (_macCdFileList[missNum].flags & FLAG_CD2) ? 2 : 1);
|
|---|
| 1657 | ! warning(msg);
|
|---|
| 1658 | ! } else {
|
|---|
| 1659 | ! char *pos = msg + sprintf(msg, errorMsgs[msgId + 1], missCnt);
|
|---|
| 1660 | ! warning(msg);
|
|---|
| 1661 | ! for (int i = 0; i < ARRAYSIZE(_macCdFileList); i++)
|
|---|
| 1662 | ! if (!fileExists[i]) {
|
|---|
| 1663 | ! warning("\"%s\" (CD %d)", _macCdFileList[i].name, (_macCdFileList[i].flags & FLAG_CD2) ? 2 : 1);
|
|---|
| 1664 | ! pos += sprintf(pos, "\"%s\" (CD %d)\n", _macCdFileList[i].name, (_macCdFileList[i].flags & FLAG_CD2) ? 2 : 1);
|
|---|
| 1665 | ! }
|
|---|
| 1666 | ! }
|
|---|
| 1667 | } else {
|
|---|
| 1668 | ! for (int i = 0; i < ARRAYSIZE(_pcCdFileList); i++)
|
|---|
| 1669 | if (!fileExists[i]) {
|
|---|
| 1670 | ! missCnt++;
|
|---|
| 1671 | ! missNum = i;
|
|---|
| 1672 | }
|
|---|
| 1673 | + assert(missCnt > 0); // this function shouldn't get called if there's nothing missing.
|
|---|
| 1674 | + warning("%d files missing", missCnt);
|
|---|
| 1675 | + int msgId = (type == TYPE_IMMED) ? 0 : 2;
|
|---|
| 1676 | + if (missCnt == 1) {
|
|---|
| 1677 | + sprintf(msg, errorMsgs[msgId],
|
|---|
| 1678 | + _pcCdFileList[missNum].name, (_pcCdFileList[missNum].flags & FLAG_CD2) ? 2 : 1);
|
|---|
| 1679 | + warning(msg);
|
|---|
| 1680 | + } else {
|
|---|
| 1681 | + char *pos = msg + sprintf(msg, errorMsgs[msgId + 1], missCnt);
|
|---|
| 1682 | + warning(msg);
|
|---|
| 1683 | + for (int i = 0; i < ARRAYSIZE(_pcCdFileList); i++)
|
|---|
| 1684 | + if (!fileExists[i]) {
|
|---|
| 1685 | + warning("\"%s\" (CD %d)", _pcCdFileList[i].name, (_pcCdFileList[i].flags & FLAG_CD2) ? 2 : 1);
|
|---|
| 1686 | + pos += sprintf(pos, "\"%s\" (CD %d)\n", _pcCdFileList[i].name, (_pcCdFileList[i].flags & FLAG_CD2) ? 2 : 1);
|
|---|
| 1687 | + }
|
|---|
| 1688 | + }
|
|---|
| 1689 | }
|
|---|
| 1690 | GUI::MessageDialog dialog(msg);
|
|---|
| 1691 | dialog.runModal();
|
|---|
| 1692 | ***************
|
|---|
| 1693 | *** 356,372 ****
|
|---|
| 1694 | _systemVars.playSpeech = true;
|
|---|
| 1695 |
|
|---|
| 1696 | // check all files and look out if we can find a file that wouldn't exist if this was the demo version
|
|---|
| 1697 | ! for (int fcnt = 0; fcnt < ARRAYSIZE(_cdFileList); fcnt++) {
|
|---|
| 1698 | ! if (Common::File::exists(_cdFileList[fcnt].name)) {
|
|---|
| 1699 | ! fileExists[fcnt] = true;
|
|---|
| 1700 | ! flagsToBool(foundTypes, _cdFileList[fcnt].flags);
|
|---|
| 1701 | ! if (!(_cdFileList[fcnt].flags & FLAG_DEMO))
|
|---|
| 1702 | ! isFullVersion = true;
|
|---|
| 1703 | ! if (_cdFileList[fcnt].flags & FLAG_CD2)
|
|---|
| 1704 | ! cd2FilesFound = true;
|
|---|
| 1705 | ! } else {
|
|---|
| 1706 | ! flagsToBool(missingTypes, _cdFileList[fcnt].flags);
|
|---|
| 1707 | ! fileExists[fcnt] = false;
|
|---|
| 1708 | }
|
|---|
| 1709 | }
|
|---|
| 1710 |
|
|---|
| 1711 | --- 450,482 ----
|
|---|
| 1712 | _systemVars.playSpeech = true;
|
|---|
| 1713 |
|
|---|
| 1714 | // check all files and look out if we can find a file that wouldn't exist if this was the demo version
|
|---|
| 1715 | ! if (_systemVars.isMac) {
|
|---|
| 1716 | ! for (int fcnt = 0; fcnt < ARRAYSIZE(_macCdFileList); fcnt++) {
|
|---|
| 1717 | ! if (Common::File::exists(_macCdFileList[fcnt].name)) {
|
|---|
| 1718 | ! fileExists[fcnt] = true;
|
|---|
| 1719 | ! flagsToBool(foundTypes, _macCdFileList[fcnt].flags);
|
|---|
| 1720 | ! if (!(_macCdFileList[fcnt].flags & FLAG_DEMO))
|
|---|
| 1721 | ! isFullVersion = true;
|
|---|
| 1722 | ! if (_macCdFileList[fcnt].flags & FLAG_CD2)
|
|---|
| 1723 | ! cd2FilesFound = true;
|
|---|
| 1724 | ! } else {
|
|---|
| 1725 | ! flagsToBool(missingTypes, _macCdFileList[fcnt].flags);
|
|---|
| 1726 | ! fileExists[fcnt] = false;
|
|---|
| 1727 | ! }
|
|---|
| 1728 | ! }
|
|---|
| 1729 | ! } else {
|
|---|
| 1730 | ! for (int fcnt = 0; fcnt < ARRAYSIZE(_pcCdFileList); fcnt++) {
|
|---|
| 1731 | ! if (Common::File::exists(_pcCdFileList[fcnt].name)) {
|
|---|
| 1732 | ! fileExists[fcnt] = true;
|
|---|
| 1733 | ! flagsToBool(foundTypes, _pcCdFileList[fcnt].flags);
|
|---|
| 1734 | ! if (!(_pcCdFileList[fcnt].flags & FLAG_DEMO))
|
|---|
| 1735 | ! isFullVersion = true;
|
|---|
| 1736 | ! if (_pcCdFileList[fcnt].flags & FLAG_CD2)
|
|---|
| 1737 | ! cd2FilesFound = true;
|
|---|
| 1738 | ! } else {
|
|---|
| 1739 | ! flagsToBool(missingTypes, _pcCdFileList[fcnt].flags);
|
|---|
| 1740 | ! fileExists[fcnt] = false;
|
|---|
| 1741 | ! }
|
|---|
| 1742 | }
|
|---|
| 1743 | }
|
|---|
| 1744 |
|
|---|
| 1745 | ***************
|
|---|
| 1746 | *** 388,400 ****
|
|---|
| 1747 | somethingMissing |= missingTypes[i];
|
|---|
| 1748 | if (somethingMissing) { // okay, there *are* files missing
|
|---|
| 1749 | // first, update the fileExists[] array depending on our changed missingTypes
|
|---|
| 1750 | ! for (int fileCnt = 0; fileCnt < ARRAYSIZE(_cdFileList); fileCnt++)
|
|---|
| 1751 | ! if (!fileExists[fileCnt]) {
|
|---|
| 1752 | ! fileExists[fileCnt] = true;
|
|---|
| 1753 | ! for (int flagCnt = 0; flagCnt < 8; flagCnt++)
|
|---|
| 1754 | ! if (missingTypes[flagCnt] && ((_cdFileList[fileCnt].flags & (1 << flagCnt)) != 0))
|
|---|
| 1755 | ! fileExists[fileCnt] = false; // this is one of the files we were looking for
|
|---|
| 1756 | ! }
|
|---|
| 1757 | if (missingTypes[TYPE_IMMED]) {
|
|---|
| 1758 | // important files missing, can't start the game without them
|
|---|
| 1759 | showFileErrorMsg(TYPE_IMMED, fileExists);
|
|---|
| 1760 | --- 498,520 ----
|
|---|
| 1761 | somethingMissing |= missingTypes[i];
|
|---|
| 1762 | if (somethingMissing) { // okay, there *are* files missing
|
|---|
| 1763 | // first, update the fileExists[] array depending on our changed missingTypes
|
|---|
| 1764 | ! if (_systemVars.isMac) {
|
|---|
| 1765 | ! for (int fileCnt = 0; fileCnt < ARRAYSIZE(_macCdFileList); fileCnt++)
|
|---|
| 1766 | ! if (!fileExists[fileCnt]) {
|
|---|
| 1767 | ! fileExists[fileCnt] = true;
|
|---|
| 1768 | ! for (int flagCnt = 0; flagCnt < 8; flagCnt++)
|
|---|
| 1769 | ! if (missingTypes[flagCnt] && ((_macCdFileList[fileCnt].flags & (1 << flagCnt)) != 0))
|
|---|
| 1770 | ! fileExists[fileCnt] = false; // this is one of the files we were looking for
|
|---|
| 1771 | ! }
|
|---|
| 1772 | ! } else {
|
|---|
| 1773 | ! for (int fileCnt = 0; fileCnt < ARRAYSIZE(_pcCdFileList); fileCnt++)
|
|---|
| 1774 | ! if (!fileExists[fileCnt]) {
|
|---|
| 1775 | ! fileExists[fileCnt] = true;
|
|---|
| 1776 | ! for (int flagCnt = 0; flagCnt < 8; flagCnt++)
|
|---|
| 1777 | ! if (missingTypes[flagCnt] && ((_pcCdFileList[fileCnt].flags & (1 << flagCnt)) != 0))
|
|---|
| 1778 | ! fileExists[fileCnt] = false; // this is one of the files we were looking for
|
|---|
| 1779 | ! }
|
|---|
| 1780 | ! }
|
|---|
| 1781 | if (missingTypes[TYPE_IMMED]) {
|
|---|
| 1782 | // important files missing, can't start the game without them
|
|---|
| 1783 | showFileErrorMsg(TYPE_IMMED, fileExists);
|
|---|
| 1784 | diff -cr scummvm.old/engines/sword1/sword1.h scummvm/engines/sword1/sword1.h
|
|---|
| 1785 | *** scummvm.old/engines/sword1/sword1.h Sat Sep 23 06:46:07 2006
|
|---|
| 1786 | --- scummvm/engines/sword1/sword1.h Sun Sep 24 14:18:05 2006
|
|---|
| 1787 | ***************
|
|---|
| 1788 | *** 63,68 ****
|
|---|
| 1789 | --- 63,69 ----
|
|---|
| 1790 | uint8 showText;
|
|---|
| 1791 | uint8 language;
|
|---|
| 1792 | bool isDemo;
|
|---|
| 1793 | + bool isMac;
|
|---|
| 1794 |
|
|---|
| 1795 | uint8 cutscenePackVersion;
|
|---|
| 1796 | };
|
|---|
| 1797 | ***************
|
|---|
| 1798 | *** 100,106 ****
|
|---|
| 1799 | Music *_music;
|
|---|
| 1800 | Control *_control;
|
|---|
| 1801 | static const uint8 _cdList[TOTAL_SECTIONS];
|
|---|
| 1802 | ! static const CdFile _cdFileList[];
|
|---|
| 1803 | };
|
|---|
| 1804 |
|
|---|
| 1805 | } // End of namespace Sword1
|
|---|
| 1806 | --- 101,108 ----
|
|---|
| 1807 | Music *_music;
|
|---|
| 1808 | Control *_control;
|
|---|
| 1809 | static const uint8 _cdList[TOTAL_SECTIONS];
|
|---|
| 1810 | ! static const CdFile _pcCdFileList[];
|
|---|
| 1811 | ! static const CdFile _macCdFileList[];
|
|---|
| 1812 | };
|
|---|
| 1813 |
|
|---|
| 1814 | } // End of namespace Sword1
|
|---|
| 1815 | diff -cr scummvm.old/engines/sword1/text.cpp scummvm/engines/sword1/text.cpp
|
|---|
| 1816 | *** scummvm.old/engines/sword1/text.cpp Sat Sep 23 06:46:07 2006
|
|---|
| 1817 | --- scummvm/engines/sword1/text.cpp Sun Oct 1 18:31:39 2006
|
|---|
| 1818 | ***************
|
|---|
| 1819 | *** 48,54 ****
|
|---|
| 1820 | _font = (uint8*)_resMan->openFetchRes(_fontId);
|
|---|
| 1821 |
|
|---|
| 1822 | _joinWidth = charWidth( SPACE ) - 2 * OVERLAP;
|
|---|
| 1823 | ! _charHeight = FROM_LE_16(_resMan->fetchFrame(_font, 0)->height); // all chars have the same height
|
|---|
| 1824 | _textBlocks[0] = _textBlocks[1] = NULL;
|
|---|
| 1825 | }
|
|---|
| 1826 |
|
|---|
| 1827 | --- 48,54 ----
|
|---|
| 1828 | _font = (uint8*)_resMan->openFetchRes(_fontId);
|
|---|
| 1829 |
|
|---|
| 1830 | _joinWidth = charWidth( SPACE ) - 2 * OVERLAP;
|
|---|
| 1831 | ! _charHeight = _resMan->getUint16(_resMan->fetchFrame(_font, 0)->height); // all chars have the same height
|
|---|
| 1832 | _textBlocks[0] = _textBlocks[1] = NULL;
|
|---|
| 1833 | }
|
|---|
| 1834 |
|
|---|
| 1835 | ***************
|
|---|
| 1836 | *** 92,99 ****
|
|---|
| 1837 |
|
|---|
| 1838 | memcpy( _textBlocks[slot]->runTimeComp, "Nu ", 4);
|
|---|
| 1839 | _textBlocks[slot]->compSize = 0;
|
|---|
| 1840 | ! _textBlocks[slot]->width = TO_LE_16(sprWidth);
|
|---|
| 1841 | ! _textBlocks[slot]->height = TO_LE_16(sprHeight);
|
|---|
| 1842 | _textBlocks[slot]->offsetX = 0;
|
|---|
| 1843 | _textBlocks[slot]->offsetY = 0;
|
|---|
| 1844 |
|
|---|
| 1845 | --- 92,99 ----
|
|---|
| 1846 |
|
|---|
| 1847 | memcpy( _textBlocks[slot]->runTimeComp, "Nu ", 4);
|
|---|
| 1848 | _textBlocks[slot]->compSize = 0;
|
|---|
| 1849 | ! _textBlocks[slot]->width = _resMan->toUint16(sprWidth);
|
|---|
| 1850 | ! _textBlocks[slot]->height = _resMan->toUint16(sprHeight);
|
|---|
| 1851 | _textBlocks[slot]->offsetX = 0;
|
|---|
| 1852 | _textBlocks[slot]->offsetY = 0;
|
|---|
| 1853 |
|
|---|
| 1854 | ***************
|
|---|
| 1855 | *** 111,117 ****
|
|---|
| 1856 | uint16 Text::charWidth(uint8 ch) {
|
|---|
| 1857 | if (ch < SPACE)
|
|---|
| 1858 | ch = 64;
|
|---|
| 1859 | ! return FROM_LE_16(_resMan->fetchFrame(_font, ch - SPACE)->width);
|
|---|
| 1860 | }
|
|---|
| 1861 |
|
|---|
| 1862 | uint16 Text::analyzeSentence(uint8 *text, uint16 maxWidth, LineInfo *line) {
|
|---|
| 1863 | --- 111,117 ----
|
|---|
| 1864 | uint16 Text::charWidth(uint8 ch) {
|
|---|
| 1865 | if (ch < SPACE)
|
|---|
| 1866 | ch = 64;
|
|---|
| 1867 | ! return _resMan->getUint16(_resMan->fetchFrame(_font, ch - SPACE)->width);
|
|---|
| 1868 | }
|
|---|
| 1869 |
|
|---|
| 1870 | uint16 Text::analyzeSentence(uint8 *text, uint16 maxWidth, LineInfo *line) {
|
|---|
| 1871 | ***************
|
|---|
| 1872 | *** 158,165 ****
|
|---|
| 1873 | FrameHeader *chFrame = _resMan->fetchFrame(_font, ch - SPACE);
|
|---|
| 1874 | uint8 *chData = ((uint8*)chFrame) + sizeof(FrameHeader);
|
|---|
| 1875 | uint8 *dest = sprPtr;
|
|---|
| 1876 | ! for (uint16 cnty = 0; cnty < FROM_LE_16(chFrame->height); cnty++) {
|
|---|
| 1877 | ! for (uint16 cntx = 0; cntx < FROM_LE_16(chFrame->width); cntx++) {
|
|---|
| 1878 | if (*chData == LETTER_COL)
|
|---|
| 1879 | dest[cntx] = pen;
|
|---|
| 1880 | else if ((*chData == BORDER_COL) && (!dest[cntx])) // don't do a border if there's already a color underneath (chars can overlap)
|
|---|
| 1881 | --- 158,165 ----
|
|---|
| 1882 | FrameHeader *chFrame = _resMan->fetchFrame(_font, ch - SPACE);
|
|---|
| 1883 | uint8 *chData = ((uint8*)chFrame) + sizeof(FrameHeader);
|
|---|
| 1884 | uint8 *dest = sprPtr;
|
|---|
| 1885 | ! for (uint16 cnty = 0; cnty < _resMan->getUint16(chFrame->height); cnty++) {
|
|---|
| 1886 | ! for (uint16 cntx = 0; cntx < _resMan->getUint16(chFrame->width); cntx++) {
|
|---|
| 1887 | if (*chData == LETTER_COL)
|
|---|
| 1888 | dest[cntx] = pen;
|
|---|
| 1889 | else if ((*chData == BORDER_COL) && (!dest[cntx])) // don't do a border if there's already a color underneath (chars can overlap)
|
|---|
| 1890 | ***************
|
|---|
| 1891 | *** 168,174 ****
|
|---|
| 1892 | }
|
|---|
| 1893 | dest += sprWidth;
|
|---|
| 1894 | }
|
|---|
| 1895 | ! return FROM_LE_16(chFrame->width);
|
|---|
| 1896 | }
|
|---|
| 1897 |
|
|---|
| 1898 | FrameHeader *Text::giveSpriteData(uint32 textTarget) {
|
|---|
| 1899 | --- 168,174 ----
|
|---|
| 1900 | }
|
|---|
| 1901 | dest += sprWidth;
|
|---|
| 1902 | }
|
|---|
| 1903 | ! return _resMan->getUint16(chFrame->width);
|
|---|
| 1904 | }
|
|---|
| 1905 |
|
|---|
| 1906 | FrameHeader *Text::giveSpriteData(uint32 textTarget) {
|
|---|