Project Perfect Mod Forums
:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::


The time now is Mon Dec 09, 2024 11:14 pm
All times are UTC + 0
What's that about Overlay(Data)Pack again?
Moderators: Community Tools Developpers
Post new topic   Reply to topic Page 1 of 1 [5 Posts] Mark the topic unread ::  View previous topic :: View next topic
Author Message
RP
Commander


Joined: 12 Jul 2012
Location: Mapping God Heaven

PostPosted: Sun Feb 21, 2021 8:31 pm    Post subject:  What's that about Overlay(Data)Pack again? Reply with quote  Mark this post and the followings unread

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]));
                }
            }
        }



Screenshot_20210221_212008.png
 Description:
 Filesize:  1.59 MB
 Viewed:  2983 Time(s)

Screenshot_20210221_212008.png



_________________


Mental Omega 3.0 Mission creator - Creator of FinalOmega: APYR 3.0 Map Editor

/ppm/'s stupidity

Back to top
View user's profile Send private message
E1 Elite
General


Joined: 28 May 2013

PostPosted: Mon Feb 22, 2021 4:36 am    Post subject: Reply with quote  Mark this post and the followings unread

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.

Have updated ModEnc on this - https://www.modenc.renegadeprojects.com/OverlayPack

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.

Back to top
View user's profile Send private message
RP
Commander


Joined: 12 Jul 2012
Location: Mapping God Heaven

PostPosted: Mon Feb 22, 2021 10:58 am    Post subject: Reply with quote  Mark this post and the followings unread

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:
Code:
Add Overlay: X=37 Y=21 Index=0 Frame=6
Add Overlay: X=48 Y=32 Index=0 Frame=5
Add Overlay: X=52 Y=32 Index=2 Frame=6
Add Overlay: X=48 Y=33 Index=0 Frame=5
Add Overlay: X=52 Y=33 Index=2 Frame=0
Add Overlay: X=27 Y=39 Index=203 Frame=6
Add Overlay: X=28 Y=39 Index=203 Frame=10
Add Overlay: X=29 Y=39 Index=203 Frame=0
Add Overlay: X=30 Y=39 Index=203 Frame=12
Add Overlay: X=27 Y=40 Index=203 Frame=0
Add Overlay: X=37 Y=48 Index=0 Frame=5
Add Overlay: X=48 Y=73 Index=203 Frame=6
Add Overlay: X=49 Y=73 Index=203 Frame=10
Add Overlay: X=50 Y=73 Index=203 Frame=10
Add Overlay: X=51 Y=73 Index=203 Frame=10
Add Overlay: X=52 Y=73 Index=203 Frame=10
Add Overlay: X=53 Y=73 Index=203 Frame=12
Add Overlay: X=54 Y=73 Index=0 Frame=6
Add Overlay: X=48 Y=74 Index=203 Frame=5
Add Overlay: X=53 Y=74 Index=203 Frame=5
Add Overlay: X=54 Y=74 Index=0 Frame=5
Add Overlay: X=42 Y=75 Index=203 Frame=4
Add Overlay: X=48 Y=75 Index=203 Frame=0
Add Overlay: X=53 Y=75 Index=203 Frame=0
Add Overlay: X=54 Y=75 Index=0 Frame=0
Add Overlay: X=42 Y=80 Index=203 Frame=5
Add Overlay: X=48 Y=80 Index=203 Frame=5
Add Overlay: X=53 Y=80 Index=203 Frame=5
Add Overlay: X=54 Y=80 Index=0 Frame=5
Add Overlay: X=45 Y=84 Index=237 Frame=0
Add Overlay: X=48 Y=96 Index=203 Frame=3
Add Overlay: X=49 Y=96 Index=203 Frame=10
Add Overlay: X=50 Y=96 Index=203 Frame=10
Add Overlay: X=51 Y=96 Index=203 Frame=10
Add Overlay: X=52 Y=96 Index=203 Frame=10
Add Overlay: X=53 Y=96 Index=203 Frame=9



Screenshot_20210222_115531.png
 Description:
 Filesize:  1.14 MB
 Viewed:  2946 Time(s)

Screenshot_20210222_115531.png



_________________


Mental Omega 3.0 Mission creator - Creator of FinalOmega: APYR 3.0 Map Editor

/ppm/'s stupidity

Back to top
View user's profile Send private message
RP
Commander


Joined: 12 Jul 2012
Location: Mapping God Heaven

PostPosted: Mon Feb 22, 2021 3:58 pm    Post subject: Reply with quote  Mark this post and the followings unread

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



Screenshot_20210222_165028.png
 Description:
 Filesize:  1.37 MB
 Viewed:  2913 Time(s)

Screenshot_20210222_165028.png



Screenshot_20210222_164801.png
 Description:
 Filesize:  1.46 MB
 Viewed:  2913 Time(s)

Screenshot_20210222_164801.png



Screenshot_20210222_164727.png
 Description:
 Filesize:  1.34 MB
 Viewed:  2913 Time(s)

Screenshot_20210222_164727.png



_________________


Mental Omega 3.0 Mission creator - Creator of FinalOmega: APYR 3.0 Map Editor

/ppm/'s stupidity

Back to top
View user's profile Send private message
CCHyper
Defense Minister


Joined: 07 Apr 2005

PostPosted: Mon Feb 22, 2021 7:13 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hey RP, great to see you have continued your work with the map editor, it's looking great!

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] Mark the topic unread ::  View previous topic :: View next topic
 
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.


Write only two of the following words separated by a sharp: Brotherhood, unity, peace! 

 
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


Powered by phpBB © phpBB Group

[ Time: 0.2311s ][ Queries: 18 (0.0149s) ][ Debug on ]