Author Topic: Loading a game goes back to default zoom level  (Read 1211 times)

0 Members and 1 Guest are viewing this topic.

Offline Jagged_One

Loading a game goes back to default zoom level
« on: July 13, 2020, 10:58:22 AM »
Does anyone know of a way to make the game load at the same size as it was saved ? Here's what I mean: due to my vision problems, I have to zoom the game 2-3 levels (2-3 taps of the 'z' key) in order to see it well enough to play my micro-managed game (single-player only...I don't play multi-player). However, when I re-load a game I have saved, it loads at the "default zoom level", i.e., two "zooms" above the tiniest, rather than the zoom level of my game when I saved it, forcing me to re-zoom every time I re-load. Not the end of the world, but still...

Does anyone know a way to make the game re-load at the zoom level it was saved at ? I have tried Thinker 2.0 and PRACX 1.11 and neither have helped. Since I play with both, I am hoping that perhaps that level of flexibility might exist in one of them (probably PRACX), but I have not found it so far.

I wasn't sure whether to post this here or in MODS....

Any help would be greatly appreciated !!

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: Loading a game goes back to default zoom level
« Reply #1 on: July 13, 2020, 04:47:18 PM »
I don't see any Preferences for zoom level.  Without a Preference, I don't think there's anything that would be saved in a game file.  There are on / off and sliders for 4 audio settings, so if they had wanted to do something like that for zoom, they could have.  I say they didn't.

For Thinker or PRACX, I bet you'd be making a feature request.  I don't think saving the zoom in a game file would be really what's wanted.  Rather, it would be saving the zoom in your Alpha Centauri.ini or some such, so that your installation of the game is at a particular zoom level.  That way your zoom preferences only affect you and don't affect someone you're sharing a saved game with.

Offline Jagged_One

Re: Loading a game goes back to default zoom level
« Reply #2 on: July 16, 2020, 11:34:17 PM »
I was hoping PRACX might have a way to specify a "default zoom level" (for want of a better term) in a .ini file, i.e., w/e the game is started or loaded, this is the level of zoom that is displayed. It would sure help my game-playing "convenience level"....

Offline Jagged_One

Re: Loading a game goes back to default zoom level
« Reply #3 on: July 19, 2020, 06:01:12 PM »
Apparently this forum is dead... :(

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: Loading a game goes back to default zoom level
« Reply #4 on: July 20, 2020, 01:50:57 AM »
This forum isn't dead.  You got the correct answer out of me, and nobody felt like chiming in to say otherwise, because it's the correct answer.  I mean, I even went and looked at the game's settings to verify.  The original devs simply didn't think this was something that anyone would ever want to do, on a per-installation basis.  They figured you'd just zoom up or zoom down as you will.

If you want features out of PRACX or Thinker, you need to find and post in their development threads.  How they will respond, depends on if the problem is interesting to them, or easy, and how busy they are.  YMMV.

Offline Jagged_One

Re: Loading a game goes back to default zoom level
« Reply #5 on: July 20, 2020, 04:39:47 AM »
Thank you.
I apologize for not taking your original reply more seriously. :)

Offline bvanevery

  • Emperor of the Tanks
  • Thinker
  • *
  • Posts: 6370
  • €659
  • View Inventory
  • Send /Gift
  • Allows access to AC2's quiz & chess sections for 144 hours from time of use.  You can't do without Leadship  Must. have. caffeine. -Ahhhhh; good.  Premium environmentally-responsible coffee, grown with love and care by Gaian experts.  
  • Planning for the next 20 years of SMACX.
  • AC2 Hall Of Fame AC Text modder Author of at least one AAR
    • View Profile
    • Awards
Re: Loading a game goes back to default zoom level
« Reply #6 on: July 20, 2020, 04:58:35 AM »
No prob.

Offline scient

Re: Loading a game goes back to default zoom level
« Reply #7 on: July 29, 2020, 01:38:31 AM »
This was easy enough to trace.

Console::on_key_click > Console::zoom

MapWinAll is a ptr to array of eight MapWin structs (007D3C3C). In this case, it uses the primary MapWin at offset 0. Inside MapWin struct at offset 0001DD98 is an int that stores the zoom level.

It looks like max zoomed in is value of 16 and max zoomed out is value of -14. Zoom steps in increments of -2/+2. Standard zoom in is 0 and standard zoom out is -6.

It doesn't look like this value is retained at all, only for current game state. If someone were to patch this in, I would recommend adding a check at the end of mapwin_system_init(int) (00471030) that gets called on loading game.

This is assuming you have already parsed in a value to some memory location from ini file.

mov     esi, offset MapWinAll
mov     eax, [esi]
mov     ecx, <STORED VALUE MEM LOCATION>
mov     dword ptr [eax+1DD98h], ecx

Unfortunately, someone else will have to implement this since I've stopped binary patching to work on decompilation project.

Offline scient

Re: Loading a game goes back to default zoom level
« Reply #8 on: August 17, 2020, 07:20:21 PM »
So while working on some other code, I came across where it's reading in the zoom level from a saved game. This same code is run even when starting a new game. I've successfully patched it to override to a specific zoom level. Not as extendable as reading from the ini file, but figured this might still help you out in the meantime.

Search:  85 C9 8B 0D 6C 5D 94 00 74 18 56 6A 01 85 C9 6A 04
Replace: C7 00 10 00 00 00 8B CF 6A 01 E8 9B 3B EC FF EB 37

The section in red is the override zoom level in little endian hex. You can either play around with it, or if you know your desired zoom level value based on my previous post I can provide the correct patch data.

Assembly replace code inside game_io():
005A69A6      C700 10000000 MOV DWORD PTR DS:[EAX],10 ; storing desired zoom level (16, max zoomed in)
005A69AC      8BCF                MOV ECX,EDI ; MapWin this ptr for call below
005A69AE      6A 01               PUSH 1 ; mirroring map refresh in Console::zoom code
005A69B0      E8 9B3BECFF    CALL 0046A550 ; MapWin::draw_map > mirroring map refresh in Console::zoom code
005A69B5      EB 37               JMP SHORT 005A69EE ; skipping to next section


Edit:
After testing some more, this doesn't seem to fully work. It looks like the root issue is a bug. The zoom level is stored in the saved game (along with some other MapWin data) and read in as part of loading a save. Then other code re-initializes MapWin variable wiping loaded value to default. Plan on working on code related to loading/saving in near future. I'll create a bug report on OpenSMACX issue tracker for zoom level not working properly.
« Last Edit: August 17, 2020, 07:56:35 PM by scient »

 

* User

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Select language:

* Community poll

SMAC v.4 SMAX v.2 (or previous versions)
-=-
24 (7%)
XP Compatibility patch
-=-
9 (2%)
Gog version for Windows
-=-
103 (32%)
Scient (unofficial) patch
-=-
40 (12%)
Kyrub's latest patch
-=-
14 (4%)
Yitzi's latest patch
-=-
89 (28%)
AC for Mac
-=-
3 (0%)
AC for Linux
-=-
6 (1%)
Gog version for Mac
-=-
10 (3%)
No patch
-=-
16 (5%)
Total Members Voted: 314
AC2 Wiki Logo
-click pic for wik-

* Random quote

Look at any photograph or work of art. If you could duplicate exactly the first tiny dot of color, and then the next and the next, you would end with a perfect copy of the whole, indistinguishable from the original in every way, including the so-called 'moral value' of the art itself. Nothing can transcend its smallest elements.
~CEO Nwabudike Morgan 'The Ethics of Greed'

* Select your theme

*
Templates: 5: index (default), PortaMx/Mainindex (default), PortaMx/Frames (default), Display (default), GenericControls (default).
Sub templates: 8: init, html_above, body_above, portamx_above, main, portamx_below, body_below, html_below.
Language files: 4: index+Modifications.english (default), TopicRating/.english (default), PortaMx/PortaMx.english (default), OharaYTEmbed.english (default).
Style sheets: 0: .
Files included: 45 - 1228KB. (show)
Queries used: 36.

[Show Queries]