TheAssemblyArmada / Vanilla-Conquer

Vanilla Conquer provides clean, cross-platform builds of the C&C Remastered Collection and the standalone legacy games.
Other
358 stars 54 forks source link

Classical 320x200 resolution is unsupported #646

Closed giulianobelinassi closed 3 years ago

giulianobelinassi commented 3 years ago

Both DOS versions of TD and RA ran in 320x200 mode, which is currently unsupported in Vanilla-Conquer.

OmniBlade commented 3 years ago

Indeed they did. However there is no appetite amongst the current developers to properly handle the DOS graphics and enable a 320x200 mode and some of the code that still existed to support it has been removed to clean up unused code.

It still exists in the git history for this repository though, so if anyone wanted to take on adding porper support we'd be open to discussions on how best to do it and how to integrate it into the engine.

giulianobelinassi commented 3 years ago

A quick test shows that setting resolution to 321x200 the game works fine (but menus are outscalled), while setting 320x200 shows a weird colored menu with no clickable buttons, which I can't simply get past. I can't see any mention of the game trying to load the low resolution version of HTITLE.PCX, so this may be a good starting point.

I also took a quick look into the commit messages and could not find any message saying that the author mentioned that he/she removed the old render engine, so pointing the last commit which this part of code is untouched can be helpful.

I may try to restore this mode myself.

giulianobelinassi commented 3 years ago

Screenshot from 2021-06-29 00-42-12

320x200: Managed to get the TITLE.CPS to load by copying Westwood CPS load code from Dune 2. Mission select list adjust itself, but main menu does not. Maingame does not work (black screen with cursor and music only. Could select a commando on blackout mission)

hifi commented 3 years ago

If you can get this working with minimal code changes so that things would scale/snap into different mode based on the window size dynamically (theoretically, the game can't currently switch assets on-the-fly) it would be splendid.

I suggest if you really work on this you create incremental pull requests that add things piece by piece without interfering with the hires mode and in a way it's easy to switch it (like an ini key) and things scale/position automatically without absolute positioning of menu items. Though I suppose if the window size is less than 640x400 it could just use the lowres mode automatically but it would also be interesting to use the lowres mode in higher resolution with a manual override.

So yeah, hack on it first to see how much work is required to get it working properly and then plan on how to upstream it once you have in-game working even remotely correctly. The only thing I wouldn't want is hundreds of ifdefs or comparisons everywhere for absolute positioning of items except where it makes sense (like the sidebar).

Is the CPS load code different from what TD/RA already has in vanilla? There's Load_Uncompress that seems to be used for loading CPS files.

Thanks for working on this!

giulianobelinassi commented 3 years ago

I just managed to get the VQA player to display videos correctly on 320x200. As for #ifdefs, I don't think it will be necessary. However, I will have to check for the scale factor in many places, so it will definitely won't get as clean as I think you are expecting.

About the CPS code: Not sure. I tough it was removed from the C&C code, as I could not find any function which explicitly load an CPS file. So I just ported the implementation from OpenDUNE, which worked nicely.

giulianobelinassi commented 3 years ago

Screenshot from 2021-06-29 15-49-12

giulianobelinassi commented 3 years ago

I managed to get the ingame engine to work. Sidebar drawing seems broken so far. Screenshot from 2021-06-29 17-30-49

OmniBlade commented 3 years ago

https://github.com/TheAssemblyArmada/Vanilla-Conquer/blob/6aca35736090ac89ecca2aab42b6616aec8748f8/common/load.cpp#L214 is the CPS loading code. Its called from Load_Picture in each games jshell.cpp file which is called in RA even in hi-res mode to load the palette.cps in Init_Color_Remaps.

Regarding scaling, a lot of the menus already have code to handle a scale factor as well which hasn't been cleaned out yet. If you want to restore it properly and add it to other things that need it to work at both scales, go for it.

giulianobelinassi commented 3 years ago

After adding the missing assets from DOS C&C: Screenshot from 2021-06-29 18-59-05

Looking on the assets files, I cannot find other shape files for the sidebar. I wonder if this was draw using code rather than shape files. Did the original code had this logic?

giulianobelinassi commented 3 years ago

Had to do some work to get the buttons to display somewhat correctly while not breaking the 640x400 version. If you look more carefully, you will see that "REPAIR" have more space between the letters than in original DOS version. Screenshot from 2021-06-29 23-43-08

giulianobelinassi commented 3 years ago

It is working. However, gameplay is quite annoying because the scroll hitboxes on right and bottom corner are not capturing the mouse correctly.

[edit] Got the mouse to work correctly

Screenshot from 2021-06-30 13-13-15

hifi commented 3 years ago

Excellent work! How easy do you see splitting it up into manageable PRs is?

giulianobelinassi commented 3 years ago

Excellent work! How easy do you see splitting it up into manageable PRs is?

I need to implement an resolution reading mechanism from conquer.ini first and do some code cleanup. After that, the feature is ready to be merged.

hifi commented 3 years ago

You can probably start with a boolean key to toggle lores and we can work up from there to make things more flexible.

giulianobelinassi commented 3 years ago

I am editing the code to use Get_Resolution_Factor() for this. Returns 0 if lowres, 1 else. I exported ScreenWidth everywhere and hardcode tested for 320, which is not a good way of doing things.