Posted: Sun Feb 21, 2021 8:31 pm Post subject:
What's that about Overlay(Data)Pack again?
I'm trying to decode the OverlayPack and OverlayDataPack sections.
While the application doesn't crash, the output also isn't very good looking.
As seen in the screenshot, I get only sandbags (probably frame 0 as well), starting at coordinate 0,0. It's SOV01T.MAP, so if anyone can provide reference data, that'd be nice.
There's only one source othat decodes those sections specifically, but LCW implementations can be found around the net.
So based on the implementation, I would guess it's OK.
Apparently there's no need to use the intput and output sizes the Pack-sections are built on.
Maybe it's due to how I interpret the index values...
The unused fields in the array, are they all set to -1 or 255 or what not?
Anyone perhaps got a clue as to what's going wrong here?
Here's the code I use to map the decoded data into individual overlay items, but that doesn't look wrong to me. I tried using 511 and the full size of the map as width/height constraints.
Code:
for (int y = 0; y < 511; ++y)
{
for (int x = 0; x < 511; ++x)
{
int index = x + y * 512;
int arrayIndex = indexData[index];
if (arrayIndex != 0xFF)
{
overlayItems.add(new OverlayItem(x, y, arrayIndex, frameData[index]));
}
}
}
Decoded overlay and its data packs are of fixed size of 262144 bytes (256k). Your loop would result in out of array index cases. Approach should be, for each valid cell in the map get index using the formula. TS/YR can have max map size based on Width + Height <= 512. A look up table could be made or computation could be done to get valid coordinates.
This tools subforum has 3 open source tools that manipulate overlay packs - Map Renderer, MapTool and MapResize, could refer those. For reference data, my last attachment of MapTool has logging feature which would list all overlays in a map, you could put a debug log in your tool as well to get that. QUICK_EDIT
It seems there is a problem in the decoding. I got a step further. I probably messed up a copy/repeat command or something as I get only -what appears to be- the first occurence of a certain overlay. Note that I do not yet map the index to the correct frame of the SHP.
The black fence near the Oil Derrick is visible
The wooden bridge is also visible (not in picture)
Sandbags, walls visible as well
This is the overlay added, much shorter than what MapTool prints:
Finally got it working. Turned out the command determination was incorrect and also some copy steps did not take the destination buffer offest at the start of chunk decoding. I took screenshots of al lthree stages:
- incorrect command determination and no-offset
- incorrect command determinattion
- OK
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum