Development > Newbie Coding
Change order of resolutions list
bayo:
I remember if you close the game with the [ x ] button of the Windows manager (top-right) you lose your changes. Not sure about that.
Duke:
--- Quote from: geever on September 06, 2009, 11:48:28 pm ---config.cfg? Is it writeable?
--- End quote ---
Good hint, geever. That was probably part of the problem. But the final breakthrough was to use that little icon 'maintain resolution'. Then it changes and saves the new resolution.
May I suggest that we rename it to 'apply resolution' ?
@bayo:
raster's above fix also changes the magic numbers (1-22) in the resolution table. If they are *only* used as a return value from the drop-down-list, I think it's ok to change them. Do you know if they are also used for other purposes (eg. stored in config.cfg) ?
bayo:
OPTION_VIDEO_RESOLUTIONS (drop-down list content) is generated from the list of resolution description. Then, IDs will be right (GUI<->client), only the stored ID can became wrong (old vid_mode from the config.cfg (hmmm strange file name)).
Maybe there is an hidden dependency, the third value (the mode) from vid_modes but be the index of the mode into vid_modes. Then you can't sort resolutions without broking mode IDs.
Anyway, sorting rules should/can be a GUI point of vue. I mean you can sort OPTION_VIDEO_RESOLUTIONS options (CL_InitAfter(), vidModesOptions, cl_main.c) without sorting vid_modes, and add new modes at the end of the vid_modes list.
Mattn:
if someone is going to replace the vid_mode cvar and the magic numbers - go for it. we really only need vid_width and vid_height in our settings. maybe the magic numbers are still quite useful in the code, i'm not sure.
raster:
Hi all:
About the magic numbers, they seem needed to recover the resolution after exiting the game: first I just reordered the resolution without changing the magic number, and it seemed to work; but when I exited and launched it again, the resolution it used was wrong. I was selecting 1680x1050, with magic number 18, and when I relaunched UFOAI, the resolution selected was 1400x1050, which was the one in the position 18 in the reordered list. I, then, changed the magic values, and all worked fine.
So it seems that UFOAI stores that value in the configuration in order to retrieve the resolution the next time the game is launched.
Another detail about ordering: it's not possible to just use a generic string sorting function, because the resolution must be sorted first by vertical resolution, not by horizontal resolution. This is needed to ensure that, in small screens, the user will always be able to see the desired vertical resolutions.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version