Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.

[SOLVED] Just Cause 2: Convert world_pos vector to map coordinates

Featured Replies

  • Author
  • Localization

Pickle, posted Thu Aug 25, 2022 9:52 pm (73179)


I've used Rick Gibbed's tools to extract the files from pc0.arc and convert the BIN files to XML. I'm looking at \settings\icons_global.xml and I see lines like this.

Code:
-9019.082,486.125,2830.436

This line is the location of a military base named "Kem Komander Sutherland".

My problem is that I have no idea how to take these values and turn them into map coordinates like the ones used in-game. I've looked into vector algebra, but it doesn't appear that these values represent a Euclidean vector. I am certain that the first value is X and the last is Y. The middle value is unknown, but probably Z (altitude).

For reference, the above village is roughly located at (7360,19200) in-game. It's important to note that in-game coordinates do not have pinpoint accuracy due to the way the world map works. The game uses a 2048x2048 pixel image for the world map and the coordinates run from (0,0) in the top-left to (32768,32768) in the bottom-right. This means that each pixel on the map represents 16 meters.

Does anyone have any idea how this world_pos becomes the map coordinates?
  • Author
  • Localization

grandshot, posted Sat Aug 27, 2022 9:43 pm (73225)


I think it can be not ingame world coords, but its position of icon on 3d map model from PDA. Try to rip this map with 3d Ripper DX, for save forms, and check getted geometry. Maybe it push the mind to the right solution ;)
  • Author
  • Localization

Pickle, posted Sun Aug 28, 2022 4:43 pm (73237)


Thanks for the reply, grandshot. I forgot the PDA map is 3D; however, 3D Ripper DX won't work because JC2 is a DX10 game. Fortunately, I have found the solution a different way.

I used a memory scanner to find the player position in RAM. The player position uses the exact same coordinates as the world_pos vector. I was then able to determine the following info.

Code:
world_pos vector = (x,z,y)
(0,0,0) is center of map, this is (16384,16384) in map coordinates
North is -Y
South is Y
East is X
West is -X

Now converting world_pos to map coordinates is simple.

Code:
Kem Komander Sutherland world_pos = (-9019.082,486.125,2830.436)
X = 16384 -9019.082 = 7364.918
Y = 16384 2830.436 = 19214.436
Kem Komander Sutherland map coordinates = (7364.918,19214.436)

These map coordinates are an exact match to the ones found in JC2MapViewer.
Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.