dshepsis / OkamiMap

Resource for the locations of items and other objects in the video game Okami
https://dshepsis.github.io/OkamiMap/
1 stars 1 forks source link

Calculate scale factors for map textures #3

Open dshepsis opened 3 years ago

dshepsis commented 3 years ago

Every map requires its own scale and position adjustments to match up with in-game coordinates. These are probably somehow available through reverse engineering, but until we understand the game better, they'll have to be calculated by simply adjusting the map so that things like treasure icons line up with their expected locations on the map. This won't be easily possible on all maps, but most of them should be calculable with some work.

The scale data is stored in the mapInfo.json file under the leafletScale and leafletNEOffset properties for each info object. These values have all been filled in with the same default in order to get things working, but will be adjusted individually as I work through them.

zysim commented 3 years ago

I'm assuming NE in leafletNEOffset means "north east"?

dshepsis commented 3 years ago

Yes. It's the position of the center of the map image layer. Perhaps a better name would be leafletCenter or something.

zysim commented 3 years ago

Tried doing the manual way with just Ponc'tan. It's... not a good solution for sure. It's basically impossible to be accurate.

dshepsis commented 3 years ago

I have some ideas for more robust solutions. We can teleport Ammy around and see how that affects her map icon coordinates, and I have found a value which seems to represent overall map scale, but to be truly accurate will probably require decomping the code for rendering the maps.

zysim commented 3 years ago

TP Ammy around Sounds like a much better solution than just brute forcing ha

dshepsis commented 3 years ago

As of https://github.com/dshepsis/OkamiMap/commit/84c2d4d3e5cbfcc2dd8a82b5d8701436f6acbbdf, this has been solved for everything except dungeons. I never ended up manually calculating the scale/position for each map, only for Shinshu, but was able to discover the relevant values in the game's memory via reverse engineering. Dungeon maps are much more complicated, being composed of many separate images for each room, so they will take more time.