18 bool ok = basePalette.decode(
"pal.dat");
21 std::unique_ptr<PL2> pl2 = PL2::CreateFromPalette(basePalette);
24 std::unique_ptr<PL2> pl2File = std::make_unique<PL2>();
25 fs.read(pl2File.get(),
sizeof(
PL2));
27 const bool sameBase = pl2->basePalette == pl2File->basePalette;
29 CHECK(pl2->basePalette == pl2File->basePalette);
30 for (
size_t i = 0; i < 32; i++)
31 CHECK(pl2->lightLevelVariations[i].indices == pl2File->lightLevelVariations[i].indices);
32 for (
size_t i = 0; i < 16; i++)
33 CHECK(pl2->invColorVariations[i].indices == pl2File->invColorVariations[i].indices);
35 CHECK(pl2->selectedUnitShift.indices == pl2File->selectedUnitShift.indices);
36 for (
size_t blendLevel = 0; blendLevel < 3; blendLevel++)
37 for (
size_t i = 0; i < 256; i++)
38 CHECK(pl2->alphaBlend[blendLevel][i].indices
39 == pl2File->alphaBlend[blendLevel][i].indices);
41 for (
size_t i = 0; i < 256; i++)
42 CHECK(pl2->additiveBlend[i].indices == pl2File->additiveBlend[i].indices);
44 for (
size_t i = 0; i < 256; i++)
45 CHECK(pl2->multiplicativeBlend[i].indices == pl2File->multiplicativeBlend[i].indices);
47 for (
size_t i = 0; i < 111; i++)
48 CHECK(pl2->hueVariations[i].indices == pl2File->hueVariations[i].indices);
51 for (
size_t i = 0; i < 14; i++)
52 CHECK(pl2->unknownColorVariations[i].indices == pl2File->unknownColorVariations[i].indices);
54 CHECK(pl2->redTones.indices == pl2File->redTones.indices);
55 CHECK(pl2->greenTones.indices == pl2File->greenTones.indices);
56 CHECK(pl2->blueTones.indices == pl2File->blueTones.indices);
58 for (
size_t i = 0; i < 256; i++)
59 CHECK(pl2->maxComponentBlend[i].indices == pl2File->maxComponentBlend[i].indices);
61 CHECK(pl2->darkenedColorShift.indices == pl2File->darkenedColorShift.indices);
62 for (
size_t i = 0; i < 13; i++)
64 CHECK(pl2->textColors[i] == pl2File->textColors[i]);
65 CHECK(pl2->textColorShifts[i].indices == pl2File->textColorShifts[i].indices);
Precomputed palette variations in the form of palette shifts.
TEST_CASE("DCC decoding BaalSpirit.dcc")
Try to decode BaalSpirit.dcc.
Wrapper around POSIX file io, same as ifstream but without iostream formatting.
Helper to load a Diablo 2 palette (.pal/.dat format)