Ticket #8042: savepalmanipulate.diff
File savepalmanipulate.diff, 9.0 KB (added by , 22 years ago) |
---|
-
scummvm\scumm\scumm.
old new 851 851 852 852 int _drawObjectQueNr; 853 853 byte _drawObjectQue[200]; 854 int16 _palManipStart, _palManipEnd, _palManipCounter; 854 byte _palManipStart, _palManipEnd; 855 uint16 _palManipCounter; 856 byte *_palManipPalette; 857 byte *_palManipIntermediatePal; 855 858 uint32 gfxUsageBits[200]; 856 859 byte *_shadowPalette; 857 860 int _shadowPaletteSize; -
scummvm\scumm\resource_v2.
old new 61 61 62 62 _shadowPaletteSize = 256; 63 63 _shadowPalette = (byte *) calloc(_shadowPaletteSize, 1); // FIXME - needs to be removed later 64 65 // Jamieson630: palManipulate variable initialization 66 _palManipCounter = 0; 67 _palManipPalette = 0; // Will allocate when needed 68 _palManipIntermediatePal = 0; // Will allocate when needed 69 64 70 _numFlObject = 50; 65 71 allocateArrays(); 66 72 -
scummvm\scumm\resource_v3.
old new 84 84 85 85 _shadowPaletteSize = 256; 86 86 _shadowPalette = (byte *) calloc(_shadowPaletteSize, 1); // stupid for now. Need to be removed later 87 88 // Jamieson630: palManipulate variable initialization 89 _palManipCounter = 0; 90 _palManipPalette = 0; // Will allocate when needed 91 _palManipIntermediatePal = 0; // Will allocate when needed 92 87 93 _numFlObject = 50; 88 94 allocateArrays(); 89 95 -
scummvm\scumm\saveload.
old new 400 400 MKLINE(Scumm, _switchRoomEffect2, sleByte), 401 401 MKLINE(Scumm, _BgNeedsRedraw, sleByte), 402 402 403 // Jamieson630: variables for palManipulate 404 MKLINE(Scumm, _palManipStart, sleByte), 405 MKLINE(Scumm, _palManipEnd, sleByte), 406 MKLINE(Scumm, _palManipCounter, sleUint16), 407 403 408 MKARRAY(Scumm, gfxUsageBits[0], sleUint32, 200), 404 409 MKLINE(Scumm, gdi._transparency, sleByte), 405 410 MKARRAY(Scumm, _currentPalette[0], sleByte, 768), … … 505 510 MKLINE(Scumm, _switchRoomEffect2, sleByte), 506 511 MKLINE(Scumm, _BgNeedsRedraw, sleByte), 507 512 513 // Jamieson630: variables for palManipulate 514 MKLINE(Scumm, _palManipStart, sleByte), 515 MKLINE(Scumm, _palManipEnd, sleByte), 516 MKLINE(Scumm, _palManipCounter, sleUint16), 517 508 518 MKARRAY(Scumm, gfxUsageBits[0], sleUint32, 200), 509 519 MKLINE(Scumm, gdi._transparency, sleByte), 510 520 MKARRAY(Scumm, _currentPalette[0], sleByte, 768), … … 634 644 635 645 if (_shadowPaletteSize) 636 646 s->saveLoadArrayOf(_shadowPalette, _shadowPaletteSize, 1, sleByte); 647 if (_palManipCounter) { 648 if (!_palManipPalette) 649 _palManipPalette = (byte *)calloc(0x300, 1); 650 if (!_palManipIntermediatePal) 651 _palManipPalette = (byte *)calloc(0x300, 1); 652 s->saveLoadArrayOf(_palManipPalette, 0x300, 1, sleByte); 653 s->saveLoadArrayOf(_palManipIntermediatePal, 0x600, 1, sleByte); 654 } 637 655 638 656 s->saveLoadArrayOf(_classData, _numGlobalObjects, sizeof(_classData[0]), sleUint32); 639 657 -
scummvm\scumm\gfx.
old new 554 554 byte *startptr2, *endptr2; 555 555 int num; 556 556 byte tmp[6]; 557 byte tmp2[6];558 557 559 558 if (!_palManipCounter) 560 559 return; 561 560 562 startptr = getResourceAddress(rtTemp, 4) + start * 6; 563 endptr = getResourceAddress(rtTemp, 4) + end * 6; 564 565 startptr2 = getResourceAddress(rtTemp, 5) + start * 6; 566 endptr2 = getResourceAddress(rtTemp, 5) + end * 6; 567 561 startptr = _palManipPalette + start * 3; 562 endptr = _palManipPalette + end * 3; 563 startptr2 = _palManipIntermediatePal + start * 6; 564 endptr2 = _palManipIntermediatePal + end * 6; 568 565 num = end - start; 569 566 570 567 if (!endptr) { … … 573 570 } 574 571 575 572 if (!direction) { 576 memmove(tmp, endptr, 6);577 memmove(startptr + 6, startptr, num * 6);578 memmove(startptr, tmp, 6);579 memmove(tmp 2, endptr2, 6);573 memmove(tmp, endptr, 3); 574 memmove(startptr + 3, startptr, num * 3); 575 memmove(startptr, tmp, 3); 576 memmove(tmp, endptr2, 6); 580 577 memmove(startptr2 + 6, startptr2, num * 6); 581 memmove(startptr2, tmp 2, 6);578 memmove(startptr2, tmp, 6); 582 579 } else { 583 memmove(tmp, startptr, 6);584 memmove(startptr, startptr + 6, num * 6);585 memmove(endptr, tmp, 6);586 memmove(tmp 2, startptr2, 6);580 memmove(tmp, startptr, 3); 581 memmove(startptr, startptr + 3, num * 3); 582 memmove(endptr, tmp, 3); 583 memmove(tmp, startptr2, 6); 587 584 memmove(startptr2, startptr2 + 6, num * 6); 588 memmove(endptr2, tmp 2, 6);585 memmove(endptr2, tmp, 6); 589 586 } 590 587 } 591 588 … … 2459 2456 } 2460 2457 } 2461 2458 2462 void Scumm::palManipulateInit(int start, int end, int string_id, int time )2459 void Scumm::palManipulateInit(int start, int end, int string_id, int time, int nothing) 2463 2460 { 2461 byte *pal, *target, *between; 2462 byte *string1, *string2, *string3; 2463 int i; 2464 2464 2465 _palManipStart = start; 2465 2466 _palManipEnd = end; 2466 2467 _palManipCounter = 0; 2467 2468 byte *startptr = getResourceAddress(rtTemp, 4); 2469 if (startptr) 2470 nukeResource(rtTemp, 4); 2471 startptr = createResource(rtTemp, 4, 256 * 6); 2472 if (!startptr) { 2473 warning("palManipulateInit(%d,%d,%d,%d): Cannot create rtTemp resource index 4\n", start, end, string_id, time); 2474 return; 2475 } 2476 startptr += _palManipStart * 6; 2477 2478 byte *endptr = getResourceAddress(rtTemp, 5); 2479 if (endptr) 2480 nukeResource(rtTemp, 5); 2481 endptr = createResource(rtTemp, 5, 256 * 6); 2482 if (!endptr) { 2483 warning("palManipulateInit(%d,%d,%d,%d): Cannot create rtTemp resource index 5\n", start, end, string_id, time); 2484 return; 2485 } 2486 endptr += _palManipStart * 6; 2487 2488 byte *curptr = _currentPalette + _palManipStart * 3; 2489 byte *string1ptr = getStringAddress(string_id) + _palManipStart; 2490 byte *string2ptr = getStringAddress(string_id + 1) + _palManipStart; 2491 byte *string3ptr = getStringAddress(string_id + 2) + _palManipStart; 2492 if (!string1ptr || !string2ptr || !string3ptr) { 2468 2469 if (!_palManipPalette) 2470 _palManipPalette = (byte *)calloc(0x300, 1); 2471 if (!_palManipIntermediatePal) 2472 _palManipIntermediatePal = (byte *)calloc(0x600, 1); 2473 2474 pal = _currentPalette + start * 3; 2475 target = _palManipPalette + start * 3; 2476 between = _palManipIntermediatePal + start * 6; 2477 2478 string1 = getStringAddress(string_id) + start; 2479 string2 = getStringAddress(string_id + 1) + start; 2480 string3 = getStringAddress(string_id + 2) + start; 2481 if (!string1 || !string2 || !string3) { 2493 2482 warning("palManipulateInit(%d,%d,%d,%d): Cannot obtain string resources %d, %d and %d\n", 2494 2483 start, end, string_id, time, string_id, string_id + 1, string_id + 2); 2495 2484 return; 2496 2485 } 2497 2486 2498 int i; 2499 for (i = _palManipStart; i <= _palManipEnd; ++i) { 2500 *((uint16 *)startptr) = ((uint16) *curptr++) << 8; 2501 *((uint16 *)endptr) = ((uint16) *string1ptr++) << 8; 2502 startptr += 2; 2503 endptr += 2; 2504 *((uint16 *)startptr) = ((uint16) *curptr++) << 8; 2505 *((uint16 *)endptr) = ((uint16) *string2ptr++) << 8; 2506 startptr += 2; 2507 endptr += 2; 2508 *((uint16 *)startptr) = ((uint16) *curptr++) << 8; 2509 *((uint16 *)endptr) = ((uint16) *string3ptr++) << 8; 2510 startptr += 2; 2511 endptr += 2; 2487 for (i = start; i < end; ++i) { 2488 *target++ = *string1++; 2489 *target++ = *string2++; 2490 *target++ = *string3++; 2491 *(uint16*)between = ((uint16) *pal++) << 8; 2492 between += 2; 2493 *(uint16*)between = ((uint16) *pal++) << 8; 2494 between += 2; 2495 *(uint16*)between = ((uint16) *pal++) << 8; 2496 between += 2; 2512 2497 } 2513 2498 2514 2499 _palManipCounter = time; … … 2516 2501 2517 2502 void Scumm::palManipulate() 2518 2503 { 2519 byte *srcptr, *destptr; 2520 byte *pal; 2504 byte *target, *pal, *between; 2521 2505 int i, j; 2522 2506 2523 2507 if (!_palManipCounter) 2524 2508 return; 2525 2509 2526 srcptr = getResourceAddress(rtTemp, 4) + _palManipStart * 6; 2527 destptr = getResourceAddress(rtTemp, 5) + _palManipStart * 6; 2528 if (!srcptr || !destptr) 2529 return; 2530 2510 target = _palManipPalette + _palManipStart * 3; 2531 2511 pal = _currentPalette + _palManipStart * 3; 2512 between = _palManipIntermediatePal + _palManipStart * 6; 2532 2513 2533 i = _palManipStart; 2534 while (i < _palManipEnd) { 2535 j = (*((uint16 *)srcptr) += (*(uint16 *)destptr - *((uint16 *)srcptr)) / _palManipCounter); 2514 for (i = _palManipStart; i < _palManipEnd; ++i) { 2515 j = (*((uint16 *)between) += ((*target++ << 8) - *((uint16 *)between)) / _palManipCounter); 2536 2516 *pal++ = j >> 8; 2537 srcptr += 2; 2538 destptr += 2; 2539 2540 j = (*((uint16 *)srcptr) += (*(uint16 *)destptr - *((uint16 *)srcptr)) / _palManipCounter); 2517 between += 2; 2518 j = (*((uint16 *)between) += ((*target++ << 8) - *((uint16 *)between)) / _palManipCounter); 2541 2519 *pal++ = j >> 8; 2542 srcptr += 2; 2543 destptr += 2; 2544 2545 j = (*((uint16 *)srcptr) += (*(uint16 *)destptr - *((uint16 *)srcptr)) / _palManipCounter); 2520 between += 2; 2521 j = (*((uint16 *)between) += ((*target++ << 8) - *((uint16 *)between)) / _palManipCounter); 2546 2522 *pal++ = j >> 8; 2547 srcptr += 2; 2548 destptr += 2; 2549 2550 i++; 2523 between += 2; 2551 2524 } 2552 2525 setDirtyColors(_palManipStart, _palManipEnd); 2553 2526 _palManipCounter--; 2554 if (!_palManipCounter) {2555 nukeResource(rtTemp, 4);2556 nukeResource(rtTemp, 5);2557 }2558 2527 } 2559 2528 2560 2529 void Scumm::unkRoomFunc3(int unk1, int unk2, int rfact, int gfact, int bfact)