editing zoom in view

General Modding Information/Questions; support/discussion/questions

Moderator: thunderchero

Forum rules
:idea: Please search before starting new topic. :idea:
There is a good chance it has already been asked.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7949
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

editing zoom in view

Post by thunderchero »

Hi Everyone,

I was looking at the zoom in view for ECM widescreen versions

when I add the 4:3 galaxy generation the zoom in view will also set to 4:3

I am looking for the values so zoom will use full area available, if this is even possible

edit
after testing some changes I think it will use H - W of galaxy size to create the shape of zoom in view.
questions are;
which H - W values?
is that value shared, (there are so many H - W values so I am hopeful it is not shared, but would need values changed for each map size

I added the white box to show available area in wdf file
zoom.jpg
zoom.jpg (179.46 KiB) Viewed 2021 times
next question is if full map could only set to width instead of height and still allow scrolling up and down? (I expect this would require complete recode)
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1944
Joined: Sun Apr 27, 2008 2:00 am

Re: editing zoom in view

Post by Spocks-cuddly-tribble »

thunderchero wrote: Tue Oct 04, 2022 10:44 amI think it will use H - W of galaxy size to create the shape of zoom in view.
questions are;
which H - W values?
is that value shared, (there are so many H - W values so I am hopeful it is not shared, but would need values changed for each map size
- Map size topic + QD IDA data base: viewtopic.php?p=8550#p8550
- Gowron hints subroutine 4DC280 -> QD says sub 53DBA0 = Widget_SetDimensions_ebx_x_edx_pixels
- Grid Multipliers aka sector sizes for (small),(medium),(large) + zoom view (default 60 part of your patches).

loc_4DC29F -> calculate_displayed_map_dimensions "If it's set too high, the map will not show at all" (vs wdf area)

-> shared = vanilla zoom-in rendering bug (map borders right & bottom depending on the shared map grid size) :dwn:


Extra zoom-in x/y Map Widget Dimensions (untested - I doubt it will always switch as intended):

4DC29A jmp relocation location

@ relocation location (zoom-in)

mov edi, 3Ch // sector size pixels
mov eax, [esi+8] // Map Widget Dimensions (default calulation adds an extra pixel to sum sectors * sector size)
mov [eax+0Ch], pixels total x
mov [eax+10h], pixels total y
jmp 4DC2C5


thunderchero wrote: Tue Oct 04, 2022 10:44 amnext question is if full map could only set to width instead of height and still allow scrolling up and down? (I expect this would require complete recode)
I first need to find the zoom-in scroll code to estimate the best option.



OT: How to open SCT + QD IDA database simultaneously for easy transcription?

And check out this vanilla AI glitch (romulan buildbase - colonize child task): :mad:
game1.sav
(64.02 KiB) Downloaded 51 times
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7949
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: editing zoom in view

Post by thunderchero »

Spocks-cuddly-tribble wrote: Wed Oct 05, 2022 12:18 am Extra zoom-in x/y Map Widget Dimensions (untested - I doubt it will always switch as intended):

4DC29A jmp relocation location

@ relocation location (zoom-in)

mov edi, 3Ch // sector size pixels
mov eax, [esi+8] // Map Widget Dimensions (default calulation adds an extra pixel to sum sectors * sector size)
mov [eax+0Ch], pixels total x
mov [eax+10h], pixels total y
jmp 4DC2C5
I tried the above here is the changes I made

Code: Select all

004DC29A E9 A1 F1 1A 00          jmp     loc_68B440      ; jumptable 004DC293 case 1

0068B440                         loc_68B440:
0068B440 BF 3C 00 00 00          mov     edi, 3Ch // sector size pixels
0068B445 8B 46 08                mov     eax, [esi+8] // Map Widget Dimensions (default calulation adds an extra pixel to sum sectors * sector size)
0068B448 C7 40 0C 70 52 01 00    mov     dword ptr [eax+0Ch], 15270h //pixels total x * ?
0068B44F C7 40 10 E0 AB 00 00    mov     dword ptr [eax+10h], 0ABE0h //pixels total y * ?
0068B456 E9 6A 0E E5 FF          jmp     loc_4DC2C5
1. still displays zoom view 4:3
2. "pixels total x/pixels total y" needs a multiplier, I set to * 80 (pixels per sector zoomed in) and right and bottom will scroll way past edge of map. :shock: If set to available area (1083 pixels x 550 pixels) I was only able to scroll 1/4 of the map (if that much) starting at top left and could not re-center zoom view to other parts of galaxy.

But at least it did not crash. :grin:
also this info might be helpful on full map view scrolling up down??
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1944
Joined: Sun Apr 27, 2008 2:00 am

Re: editing zoom in view

Post by Spocks-cuddly-tribble »

QD "sub_53DBA0 Widget_SetDimensions" -> might be not always true?

It's a logic puzzle. Here is unknow original codes:
004DC29F           mov   ebx, [esi+18h]                    ; A ?
004DC2A2           mov   edx, [esi+10h]                    ; - deviation 1 ?
004DC2A5           sub   ebx, edx
004DC2A7           mov   edx, ebx 
004DC2A9           imul  edx, edi                          ; (A - D1) * sector size
004DC2AC           mov   eax, [esi+14h]                    ; B ?
004DC2AF           sub   eax, [esi+0Ch]                    ; - deviation 2?
004DC2B2           add   ebx, edx                          ; [(A - D1) * sector size] + A - D1
004DC2B4           mov   edx, eax
004DC2B6           imul  edx, edi                          ; (B - D2) * sector size
004DC2B9           add   edx, eax                          ; [(B - D2) * sector size] + B - D2
004DC2BB           inc   ebx                               ; dimension y + 1
004DC2BC           inc   edx                               ; dimension x + 1
004DC2BD           mov   eax, [esi+8]
004DC2C0           call  Widget_SetDimensions_ebx_x_edx_pixels
004DC2C5           mov   eax, edi                          ; Sector_Size
004DC2C7           call  Map_Widget_Dimensions_1
004DC2CC           call  Map_Widget_Dimensions_2
004DC2D1           call  Map_Widget_Dimensions_3
004DC2D6           mov   eax, esi
004DC2D8           call  Map_Widget_Dimensions_4
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7949
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: editing zoom in view

Post by thunderchero »

I am not sure sector size is what needs editing to effect shape of what it displays.

I am thinking code is reading example; 52 x 39 (large galaxy) it will take pixels sector size of 13 + 1 * 39 + 1 = 547 total height used of 550 area
then this is applied though ds:galaxy.size?

if so we would need a placebo ds:galaxy.size for map display calculations?
after that all sector sizes and alignment multipliers would need adjustment.

but I have not had time to debug to confirm this

EDIT;
while debugging vanilla

Code: Select all

004DC2BB           inc   ebx                               ; dimension y + 1
004DC2BC           inc   edx                               ; dimension x + 1
I think this needs to be set to the available area for x and y instead of calculating (sector size + 1 * x/y + 1)
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1944
Joined: Sun Apr 27, 2008 2:00 am

Re: editing zoom in view

Post by Spocks-cuddly-tribble »

This code looks like:

([vertical map sectors -X?] * sector size) + (vertical map sectors -X?) +1

([horizontal map sectors -Y?] * sector size) + (horizontal map sectors -Y?) +1

I.e. (each displayed sectors * size + 1 pixel for grid) + 1 pixel for outer grid

Since the data is shared we need to know how/where X & Y get set.


Here is code for reference map size in sectors above "%c_zoom.wdf" (also shared for outer grid dimensions?):

Code: Select all

004D9B83           call  vertical_edges
004D9B88           mov   [esp+20h], eax                    ; vertical
004D9B8C           call  horizontal_edges
004D9B91           mov   [esp+24h], eax                    ; horizontal

004D9B83           call  vertical_edges     -> mov eax, vertical reference sectors for zoom.wdf ?
004D9B8C           call  horizontal_edges   -> mov eax, horizontal reference sectors for zoom.wdf ?

thunderchero wrote: Wed Oct 05, 2022 12:09 pm

Code: Select all

004DC2BB           inc   ebx                               ; dimension y + 1
004DC2BC           inc   edx                               ; dimension x + 1
I think this needs to be set to the available area for x and y instead of calculating (sector size + 1 * x/y + 1)
My above code does the same (ebx/edx only used for SetDimensions): :wink:

@ 4DC29F
mov eax, [esi+8]
mov [eax+0Ch], pixels horizontal -> = edx
mov [eax+10h], pixels vertical -> = ebx
jmp 4DC2C5
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7949
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: editing zoom in view

Post by thunderchero »

Spocks-cuddly-tribble wrote: Wed Oct 05, 2022 4:28 pm My above code does the same (ebx/edx only used for SetDimensions): :wink:
I tested this code change and got some interesting results. :shock:

Code: Select all

004DC2BB 43                      inc     ebx             ; height
004DC2BC 42                      inc     edx             ; width
004DC2BD 8B 46 08                mov     eax, [esi+8]    ; widge
-> jump to reloc 
004DC2BB E9 80 F1 1A 00          jmp     loc_68B440
0068B440 BB 25 02 00 00          mov     ebx, 225h 
0068B445 BA 3A 04 00 00          mov     edx, 43Ah
0068B44A 8B 46 08                mov     eax, [esi+8]
0068B44D E9 6E 0E E5 FF          jmp     loc_4DC2C0
zoom and full now display 16:9
zoom view does not scroll
after adjusting sector sizes and alignment multipliers full view filled 16:9 area (bottom 12 rows were out of display area)
full view would not scroll

edit; my conclusion so far, I think we need to change edx to 43Ah but mov original value to different registry so it can be restored after Widget_SetDimensions?

Note; we only need to adjust width, height is already calculated correctly. :wink:
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1944
Joined: Sun Apr 27, 2008 2:00 am

Re: editing zoom in view

Post by Spocks-cuddly-tribble »

I think zoom-in just copies zoom-out dimensions into code for "WidgetChildren":

Code: Select all

004DD26A           mov   ebx, esi                          ; copy zoom-out vertical dimension
004DD26C           mov   edx, ecx                          ; copy zoom-out horizontal dimension
004DD26E           mov   eax, [ebp+4]
004DD271           call  Widget_SetDimensions_ebx_x_edx_pixels
Just 6 extra bytes needed for custom values and there is plenty of pointless code we can use:

Code: Select all

@ 4DD26A

mov   ebx, vertical zoom-in dimension
mov   edx, horizontal zoom-in dimension
mov   eax, [ebp+4]
call  53DBA0
mov   edx, 1  zoom-in mode
mov   eax, ebp
call  4DC280
jmp   4DD48C
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7949
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: editing zoom in view

Post by thunderchero »

Spocks-cuddly-tribble wrote: Thu Oct 06, 2022 5:15 pm Just 6 extra bytes needed for custom values and there is plenty of pointless code we can use:

Code: Select all

@ 4DD26A

mov   ebx, vertical zoom-in dimension
mov   edx, horizontal zoom-in dimension
mov   eax, [ebp+4]
call  53DBA0
mov   edx, 1  zoom-in mode
mov   eax, ebp
call  4DC280
jmp   4DD48C
This was very interesting results,

not 100% sure but looks like zoom was 16:9
full view gets centered in available area so this moves zoomed to right (can not see 1/3 of area when in zoom)
zoom will scroll with above code (position causing strange effects when it displays in unused area)

you might be misunderstanding my goal of project

1. zoom and full use zoom code (so full view will scroll up and down)
2. zoom and full use 16:9 area instead of 4:3

after 1 and 2 is working I should be able to adjust sector pixel sizes and alignment multipliers to correctly fill full view (12 rows would scroll) and adjust zoom if necessary.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1944
Joined: Sun Apr 27, 2008 2:00 am

Re: editing zoom in view

Post by Spocks-cuddly-tribble »

I wasn't aware the scroll code is shared for zoom-out mode, so this might be a reasonable compromise (if easy to implement).

Still I prefer zoom-out with full galaxy view (scrolling each turn to check for fleets or other changes gets tiresome).
Plus the patch code could fix the vanilla map rendering bug.

My first posted code (with switch) plus last WidgetChildren zoom-in dimensions should switch zoom out/in 4:3/widescreen?
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7949
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: editing zoom in view

Post by thunderchero »

Spocks-cuddly-tribble wrote: Thu Oct 06, 2022 7:38 pm I'd prefer zoom-out with full galaxy view
then re-positioning the zoom area and full view to top left is all that is needed with last code.

Code: Select all

@ 4DD26A

mov   ebx, vertical zoom-in dimension
mov   edx, horizontal zoom-in dimension
mov   eax, [ebp+4]
call  53DBA0
mov   edx, 1  zoom-in mode
mov   eax, ebp
call  4DC280
jmp   4DD48C
everything else looked good.

here is how it looks with current code

new game or load save (first time it loads zoom is different)
NG.jpg
NG.jpg (172.91 KiB) Viewed 1827 times
Full view
ZF.jpg
ZF.jpg (163.97 KiB) Viewed 1827 times
this is where zoom is after new game changing to full view then back to zoom
ZFZ.jpg
ZFZ.jpg (166.21 KiB) Viewed 1827 times
Spocks-cuddly-tribble wrote: Thu Oct 06, 2022 7:38 pm My first posted code (with switch) plus last WidgetChildren zoom-in dimensions should switch zoom out/in 4:3/widescreen?
when I added code from your first post zoom and full view shifted further right
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1944
Joined: Sun Apr 27, 2008 2:00 am

Re: editing zoom in view

Post by Spocks-cuddly-tribble »

We're getting somewhere this looks better than expected.

With all above codes removed, removing/replacing this:

Code: Select all

004DD228           mov   eax, [ebp+8]
004DD22B           call  eax_address_of_eax_C
004DD230           mov   ecx, eax
004DD232           mov   eax, [ebp+8]
004DD235           call  eax_address_of_eax_10h
004DD23A           mov   esi, eax
with only this:

Code: Select all

mov ecx, horizontal zoom pixels (long/wide edge)
mov esi, vertical zoom pixels
might do the trick.
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7949
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: editing zoom in view

Post by thunderchero »

Spocks-cuddly-tribble wrote: Thu Oct 06, 2022 10:41 pm We're getting somewhere this looks better than expected.
might do the trick.
EDIT;
the above code is only used on new game load and load game,
When I ran a breakpoint on that line of code it was not triggered after first load (in zoom)
even first time "full" was created that line of code was not used.

So close,
new game load save first load of zoom is perfect
NG2.jpg
NG2.jpg (175.55 KiB) Viewed 1783 times
when changing to full view map is 4:3 map is correct but in unused area zoom remains
ZF2.jpg
ZF2.jpg (174.02 KiB) Viewed 1801 times
when you go back to zoom zoom shifts right again
ZFZ2.jpg
ZFZ2.jpg (176.92 KiB) Viewed 1801 times

I did test adjusting sector pixel sizes and alignment multipliers when it is correct galaxy does not display full or zoom (overflow issue on full?)
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1944
Joined: Sun Apr 27, 2008 2:00 am

Re: editing zoom in view

Post by Spocks-cuddly-tribble »

thunderchero wrote: Thu Oct 06, 2022 11:15 pmthe above code is only used on new game load and load game,
Yes, we know that. We fixed right shift in the default setup (tries to center rendering in defined area, but doesn't expect ratio deviations).

User zoom-in right shift can be fixed in loc_4DC0F6, but sub_4DBEE0 is shared/complex code (harder to analyse/fix).

I'd try to remove: 004DC109 call set_14_18__dev_0_5 ; set 0

Here is latest IDA database: https://workupload.com/file/bVsUUcvBe2m


The plan is to use parts of code for mapAI data types 7, E, F or 12h (black map background changed to transparent) to clear the zoom-out rendering issue: viewtopic.php?p=34204#p34204


EDIT: I'm searching for an unused tga in stbof.res. It looked like part of an empire selection screen. Any ideas?
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7949
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: editing zoom in view

Post by thunderchero »

Spocks-cuddly-tribble wrote: Fri Oct 07, 2022 9:43 pm I'd try to remove: 004DC109 call set_14_18__dev_0_5 ; set 0
would not go to full view when call was removed
Spocks-cuddly-tribble wrote: Fri Oct 07, 2022 9:43 pm EDIT: I'm searching for an unused tga in stbof.res. It looked like part of an empire selection screen. Any ideas?
sb_c01.tga is one of them I think
Spocks-cuddly-tribble wrote: Fri Oct 07, 2022 9:43 pm Here is latest IDA database: https://workupload.com/file/bVsUUcvBe2m
thanks

EDIT
Spocks-cuddly-tribble wrote: Fri Oct 07, 2022 9:43 pm User zoom-in right shift can be fixed in loc_4DC0F6
when I change the jump at;

004DBF76 0F 8C 9B 01 00 00 jl exit_keep_deviation_position_eax_ebx
to
004DBF76 0F 8C 96 01 00 00 jl jump to 4DC102 exit_set_dev_0:

right shift stopped and Full view is shifted full left
full.jpg
full.jpg (174.84 KiB) Viewed 1693 times
Post Reply

Return to “General Modding Information/Questions”