I'm having trouble getting the bitmap stored with ResourceManager. It returns null.
I do something like this (Greatly simplified):
ResourceManager resourceManager = new ResourceManager(Outpost2GameDirectory);
std::unique_ptr<Stream::BidirectionalReader> stream = resourceManager->GetResourceStream("well0004", true);
// NOTE: I've also tried "well0004.bmp"
if (stream == nullptr)
return 0; // This happens. Stream is null.
return stream->Length();
Maybe I'm misunderstanding what ResourceManager does. I assumed it would search all the archives in the game directory for "well0004.bmp".
I can successfully get the BMPs using VolFile(Outpost2GameDirectory + "/art.vol") with ReadFileByName.
Hey guys, I'm going to work around this, but there's something I'd like to point out.
You have these very nice convenience functions. I use them to render the map:
std::size_t GetTileMappingIndex(std::size_t x, std::size_t y) const;
CellType GetCellType(std::size_t x, std::size_t y) const;
bool GetLavaPossible(std::size_t x, std::size_t y) const;
Only one problem - there aren't any setters!
It appears I have to copy the GetTileIndex implementation to my wrapper so I can modify the tiles.
I assume setters for those methods are all that are needed, and that the other bits of data in the Tile are for save games or something.
Anyway, you need at least some way of modifying tiles by XY coordinates.
I'm in the process of moving my projects to VS 2019. No problem with the mission SDK, but OP2 Utility is giving me a deprecation error:
Error C1189 #error: The <experimental/filesystem> header providing std::experimental::filesystem is deprecated by Microsoft and will be REMOVED. It is superseded by the C++17 <filesystem> header providing std::filesystem. You can define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING to acknowledge that you have received this warning.
OP2Utility C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.24.28314\include\experimental\filesystem 30
Hey there. The existing BMP support is looking quite good!
I'm able to view a large number of images, but there seems to be a problem with quite a few of them. I get the exception:
Too many colors listed on the indexed palette
Looking into it. It is because the "bitCount" of some images is 1, which, when calculated by ImageHeader.CalcMaxIndexedPaletteSize, is less than the palette length of 256 (1 << bitCount == 2). Every palette seems to be 256 in length.
Closer inspection of the bitCount shows that it can be either 1 or 8. 1 if the image is considered a "shadow", it is set to 1. It seems that "shadow" images need to have some kind of special treatment. Maybe a 2 color palette.
The image I've been debugging is at index 652.
I'm curious if anyone has any additional information or if I am entering unexplored territory.
EDIT: Confirmed that the issue is shadow images via ArtViewer by checking the failed indexes.
While I'm posting, I might as well also mention a possible bug I noticed when porting the Unit Tests:
TEST(ImageHeader, Create)
{
...
EXPECT_EQ(ImageHeader::DefaultPlanes, imageHeader.DefaultPlanes);
...
EXPECT_EQ(ImageHeader::DefaultImageSize, imageHeader.DefaultImageSize);
EXPECT_EQ(ImageHeader::DefaultXResolution, imageHeader.DefaultXResolution);
EXPECT_EQ(ImageHeader::DefaultYResolution, imageHeader.DefaultYResolution);
EXPECT_EQ(ImageHeader::DefaultUsedColorMapEntries, imageHeader.DefaultUsedColorMapEntries);
EXPECT_EQ(ImageHeader::DefaultImportantColorCount, imageHeader.DefaultImportantColorCount);
}
The above statements are referring to the same thing as far as I can tell. C# doesn't let you access class members this way, so I changed, for example, "imageHeader.DefaultPlanes" to "imageHeader.planes".