Initial combat rotation

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.
Post Reply
User avatar
thunderchero
Site Administrator aka Fleet Admiral
Site  Administrator aka Fleet Admiral
Posts: 7969
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Initial combat rotation

Post by thunderchero »

I am looking to adjust the Initial combat rotation on wide screen versions

here is what you get in wide screen now
hidden.jpg
hidden.jpg (128.31 KiB) Viewed 692 times
the fed ship is off screen. :shock:

but if I rotate clockwise 15 - 20 degrees you get this
want.jpg
want.jpg (128.82 KiB) Viewed 692 times
is there any way to rotate initial combat 15-20 degrees clockwise?

I have no idea where to start looking though code

Edit;
the "Top" button in "views" is where it rotates to now
the reset button take view almost exactly where I want it :wink:

maybe I should start looking in the area of *b_views.wdf and look for 6903 or 6904 widget towards and from target (either should work)
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1962
Joined: Sun Apr 27, 2008 2:00 am

Re: Initial combat rotation

Post by Spocks-cuddly-tribble »

I also noticed the default issue worsens with changed resolutions.

Tactical camera code is a mess. Me, Tethys and Flocke tried to improve some issues. In the end: hard pass! :mad: viewtopic.php?p=53612#p53612

Random notes from some old tests:
5CAE98 integer_for_camera_switch ?

sub_49A630 tactical_camera__newObj_missile_iniZOOM

-> sub_49B37C ui_tactical_camera

sub_49C4B0 tactical_camera_2_cinematic0

sub_49C0B0 set_camera_position

sub_496540 cc0_TC_Animations_HitPoints

0049A263                 jbe     switch_camera_if_too_close
0x99663 -> 0F 86 ED 02 00  00 -> 90 90 90 90 90 90

0049A286                 jz      direction_change?
0x99686 -> 0F 84  E9 01 00 00 -> 90 90 90 90 90 90

0049A29E                 jnb     too_far?
0x9969E -> 0F 83 D1 01 00 00 -> 90 90 90 90 90 90

49A3C6                 jbe     short from_switch
0x997C6 -> 76 14 -> EB 14 -> nop

0049A53C                 jbe     from_switch
0x9993C ->  0F 86 -> 90 E9

0049A3E3                 jz      short loc_49A403
0x997E3 -> 74 1E -> EB -> nop
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: 7969
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Initial combat rotation

Post by thunderchero »

Ok I found where to edit "top" in *b_view.wdf

if I change 004AB53C B8 05 00 00 00 -> B8 04 00 00 00 or B8 03 00 00 00
the top button responds the same as "from target" or "towards target" I can't tell difference.
but does not effect Initial combat rotation though
004AB530 53                      push    ebx
004AB531 51                      push    ecx
004AB532 BB 02 00 00 00          mov     ebx, 2
004AB537 BA 01 00 00 70          mov     edx, 70000001h
004AB53C B8 05 00 00 00          mov     eax, 5
004AB541 E8 EA F0 FE FF          call    UI_Tactical_Camera_49A630
starting at 004AB86C code will call 5 sub-section (1 for each type of view)
calls subs
4AB530 (top)
4AB4E0 (chase)
4AB490 (reverse)
4AB440 (from target)
4AB3F0 (toward target)

with info above I did find a location to edit (maybe 2 locations)
at 004959A0 B8 05 00 00 00 mov eax, 5
change B8 05 00 00 00 -> B8 04 00 00 00 at 0x0094da1

there are a couple option I found
01 = chase
02 = reverse
03, 04, 06, 08 = from target or towards target (I can't tell difference)
05 = top (default)
07 = reverse of chase but little closer
09 = crash
0A = same angle as 07 but further away
0B = first ship of your fleet close up

with set to 03, 04, 06, 08 got me this
04.jpg
04.jpg (129.78 KiB) Viewed 665 times
at 00495A75 B8 05 00 00 00 mov eax, 5 (might be "jump to" when rotation is interrupted by key stroke?)
so at 0x0094e76 I would keep same as 0x0094da1 above

EDIT
Jump to position at 00495996 BB 01 00 00 00 mov ebx, 1
change BB 01 00 00 00 -> BB 02 00 00 00 at 0x0094d97

instead of slowly rotating into position, it will jump directly to start position if set to 02.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1962
Joined: Sun Apr 27, 2008 2:00 am

Re: Initial combat rotation

Post by Spocks-cuddly-tribble »

Efficient approach and useful progress. :up:

But this has to work for any resolution, unless you want to edit even more trek.exe files for the installer. :mad:

Perhaps we can fix the messy focus during the initial view, where one can hardly follow what's going in most large/medium battles. :???:
At least without good hotkey knowledge and fast reaction.

Sub_49A630 tactical_camera_setting -> Input values:
EAX perspective?

1 chase
2 reverse
3 toward target
4 from target
5 top
7 ?
8 ? default 
9 ?
70000001 ?
70000004 ?


EBX switch mode? 

1 glide
2 instant


EDX viewed object index or?

70000000 default
70000001 keep old object view ?
70000002 ?
In case you want to search hex code of 'reset'? hotkey: viewtopic.php?p=30267#p30267

Code: Select all

004A768C           mov   eax, offset 4A54C8 tactical_camera_hotkeys
EDIT: I see Reset is an UI button as you say. Have you found the asm location?
Last edited by Spocks-cuddly-tribble on Wed Sep 13, 2023 9:04 pm, edited 4 times in total.
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: 7969
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Initial combat rotation

Post by thunderchero »

Spocks-cuddly-tribble wrote: Wed Sep 13, 2023 7:49 pm But this has to work for any resolution, unless you want to edit even more trek.exe files for the installer. :mad:
this would work on any resolution, just tested on 800 x 600
Spocks-cuddly-tribble wrote: Wed Sep 13, 2023 7:49 pm In case you want to search hex code of 'reset'?
"reset" button uses 03, 04, 06, 08

default Initial combat rotation uses 05

EDIT
Spocks-cuddly-tribble wrote: Wed Sep 13, 2023 7:49 pm EDIT: I see Reset is an UI button as you say. Have you found the asm location?
the *butil.wdf (reset button id 6106) is called at
004A7723 68 9C EB 57 00 push offset aCbutil_wdf ; "%cbutil.wdf"

this is right before the *b_views.wdf is called
004A77B3 68 D8 EB 57 00 push offset aCb_views_wdf ; "%cb_views.wdf"

both use sub 4AB6F0
004A781F E8 CC 3E 00 00 call UI_Tactical_TactView_4AB6F0

in sub 4AB6F0 at 004AB86A it starts calling the 5 type from *b_views.wdf
004AB86A 89 F8 mov eax, edi
004AB86C BA 30 B5 4A 00 mov edx, offset UI_Tactical_TactView_4AB530
004AB871 E8 5A 2D 09 00 call WDFRead_UnloadWDF
004AB876 8B 46 04 mov eax, [esi+4]
004AB879 E8 E2 1B 08 00 call PushBtn_SetClickCallback ; note the callback has two params, currently unknown
004AB87E BA E0 B4 4A 00 mov edx, offset UI_Tactical_TactView_4AB4E0
004AB883 8B 46 08 mov eax, [esi+8]
004AB886 E8 D5 1B 08 00 call PushBtn_SetClickCallback ; note the callback has two params, currently unknown
004AB88B BA 90 B4 4A 00 mov edx, offset UI_Tactical_TactView_4AB490
004AB890 8B 46 0C mov eax, [esi+0Ch]
004AB893 E8 C8 1B 08 00 call PushBtn_SetClickCallback ; note the callback has two params, currently unknown
004AB898 BA 40 B4 4A 00 mov edx, offset UI_Tactical_TactView_4AB440
004AB89D 8B 46 10 mov eax, [esi+10h]
004AB8A0 E8 BB 1B 08 00 call PushBtn_SetClickCallback ; note the callback has two params, currently unknown
004AB8A5 BA F0 B3 4A 00 mov edx, offset UI_Tactical_TactView_4AB3F0
004AB8AA 8B 46 14 mov eax, [esi+14h]
004AB8AD E8 AE 1B 08 00 call PushBtn_SetClickCallback ; note the callback has two params, currently unknown

It looks like the reset button use 004AB86C (05)
004AB86C BA 30 B5 4A 00 mov edx, offset UI_Tactical_TactView_4AB530

how I got to 004959A0 for Initial combat rotation I just got lucky following some of the sub-sections and noticed 05 value and gave it a try.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1962
Joined: Sun Apr 27, 2008 2:00 am

Re: Initial combat rotation

Post by Spocks-cuddly-tribble »

loc_4A5C40 Backspace Key  // sub_4A8CD0 -> 4A8E57 mov edx, offset 4A8B50 Reset Button

sub_496870 reset_camera_with_distance_rotation_X? -> shared for Reset/Bbackspace -> plus clear viewed object data (different codes, but do the same)

EAX 8 // perspective
EBX 2 // motion
EDX 70000000 // focus
call 49A630

Initial camera code reads like this:

If no player ships involved (special case for alliance fleet battle in own system sector or MP?) -> loc_495A70 (top, instant, total view)

Else (chase, instant, player ship) then (top, glide, total view)
00495A59           mov   ebp, 1                            ; chase -> moved to EAX
EAX and EDX work as a combo. Some EAX values show no difference without object focus.


EDIT:
Full screen camera setting for first sight of battle turns:

00497C76           mov   edx, ebp
00497C78           mov   eax, 3                        ; toward target
00497C7D           call  tactical_camera_view          ; toward target 70000002 or object fullscreen
00497C82           mov   eax, 9
00497C87           mov   edx, ebp
00497C89           xor   ebx, ebx
00497C8B           call  tactical_camera_view          ; 9 with ebx 0 70000002 or object fullscreen
Here we can change the messy battle view with other Perspective/Switch/Focus modes. :wink: Zoom-out glide still to be found.

But better would be increasing the default camera distance to the focused ship and allowed camera max distance before a forced auto camera relocation gets triggered. :idea:
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: 7969
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Initial combat rotation

Post by thunderchero »

this is just a guess

EDX viewed object index or?

70000000 default Center of combat?
70000001 your fleet focus?
70000002 enemy fleet focus?

just wondering where you are going with analyzing tactical camera code?

as for my needs this should work perfectly for wide screen versions
change B8 05 00 00 00 -> B8 04 00 00 00 at 0x0094da1
unless I am missing an issue with my changes?
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1962
Joined: Sun Apr 27, 2008 2:00 am

Re: Initial combat rotation

Post by Spocks-cuddly-tribble »

thunderchero wrote: Thu Sep 14, 2023 7:26 pmjust wondering where you are going with analyzing tactical camera code?
As told, the issue is the auto camera handling in full screen during first sight of tactical turns.
Small battle looks nice, but medium/large you only see a few ships due to forced camera relocations/focus. :dwn:
Albeit the issue improves in wide screen versions (I test mostly with default resolution). :up:
Test edits got me some nice camera effects and updated IDA with new knowledge for later projects, but wide screen option is good enough for now. :wink:

thunderchero wrote: Thu Sep 14, 2023 7:26 pmas for my needs this should work perfectly for wide screen versions
change B8 05 00 00 00 -> B8 04 00 00 00 at 0x0094da1
unless I am missing an issue with my changes?
Should be fine, but I'd go with both values:
004959A0    mov   eax, 5          ; top, glide (from player ship) , total view

00495A75    mov   eax, 5          ; top, instant (if no player ships?), total view
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: 7969
Joined: Fri Apr 25, 2008 2:00 am
Location: On a three month training mission, in command of the USS Valiant.

Re: Initial combat rotation

Post by thunderchero »

Spocks-cuddly-tribble wrote: Fri Sep 15, 2023 2:32 pm Should be fine, but I'd go with both values:
004959A0    mov   eax, 5          ; top, glide (from player ship) , total view

00495A75    mov   eax, 5          ; top, instant (if no player ships?), total view
planned on it :up:

I was able to get some different types of combat
In a 3 way combat 4:3 even has issues
4:3 using default 05, my fed ship is off screen to right (using 04 was no better)
43_05.jpg
43_05.jpg (82.08 KiB) Viewed 479 times
4:3 using 0A (using 0A all ships display even on wide screen)
43_0A.jpg
43_0A.jpg (81.72 KiB) Viewed 479 times
4:3 1v1 using 0A
1v1_0A.jpg
1v1_0A.jpg (79.9 KiB) Viewed 479 times
4:3 4 way with starbase using 0A (using 05 default all ships displayed also in 4:3)
3star_0A.jpg
3star_0A.jpg (84.21 KiB) Viewed 479 times
0A might be a better choice?

any other combat combos I should test?

All monsters I have tested so far are in same position as ship vs ship.
User avatar
Spocks-cuddly-tribble
Code Master
Code Master
Posts: 1962
Joined: Sun Apr 27, 2008 2:00 am

Re: Initial combat rotation

Post by Spocks-cuddly-tribble »

thunderchero wrote: Fri Sep 15, 2023 9:41 pm0A might be a better choice?
Not sure, looks uglier to me. For ECM widescreen I'd prefer 04.

3+ way and other special cases are not that important. Plus you already saw your ship during the zoom out glide. :wink:

IDA: https://workupload.com/file/MPAMUdjXSNe
I don't know how many bugs is too many but that point is reached somewhere before however many in BotF is.
Post Reply

Return to “General Modding Information/Questions”