Skip to content

Fix nav map background issues #33

@BC46

Description

@BC46

In FL there is an infamous issue where if you zoom in on the nav map, close it, and reopen it, sometimes the nav map background texture is initially zoomed in. This happens because FL reads uninitialized memory. To fix it, simply set the initial zoom value in the constructor of the nav map object.

A second problem happens when you zoom in, and then switch to the universe map. The background in the fade-out transition looks more zoomed in than the current nav map background.

Image

I made notes on how to fix both issues:

nav map + 0x340
0049F297: nav map zoom fix when closing menu while already zoomed in
This is the problem: [0x4a4] is uninitialized when neuronetnavmap is created.
Thus FL reads an uninitialized value every frame.
Fix: set [0x4a4] in constructor
This call is responsible for borking nav map when zooming in and changing to universe view 004965AC

mov ecx, dword ptr ds:[0x005C6D90]
mov eax, [ecx]
mov edx, [eax]
push 0x49652E
push [ebx + 0x354]
push eax
call dword ptr ds:[edx+0x9C] 9c = SetTransform

Call 0xa0 in the engine vftable to get the position of the zoomed nav map and use it to set the normal nav map
When system map is opened again, reset the zoomed nav map to default

call this to fix scale of the zoom map when switching to universe maybe? 004965AC (note, this function copies 12 * 4 bytes from buffer)
Use this function to obtain scale data 00496522
Universe map button is clicked here 00493726
Player map (system map) button is clicked here 00494C05
0x478 is a bool and means animationInProgress
Scale is calculated like this: 
*(float *)(nav_map + 0x3f8) = *(float *)(nav_map + 0x4a8) / (*(float *)(nav_map + 0x4a0)
scale = *(float *)(nav_map + 0x3f8) * 1.5;
where 1.5 is referenced here 0049652E

When implementing the nav map fix, check if the nav map buttons in the top bar and "open trade routes" still work as expected


00 00 C0 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 C0 3F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 C0 3F 00 00 00 00 00 00 00 00 8F C2 35 BF


005C5F69

00490CEE

0049325C
00496512
00492B30

fade in and out for zoomed nav map 0049604B
0049326D

change these to 37c to do something:
0049325C
00496512

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions