View Issue Details

IDProjectCategoryView StatusLast Update
0005323The Dark ModCodingpublic25.09.2021 04:28
Reporterstgatilov Assigned Tostgatilov  
Status suspendedResolutionopen 
Product VersionTDM 2.08 
Target VersionTDM 2.10 
Summary0005323: Improve menu GUI and remove unexpected overrides of menu GUI files
DescriptionIt seems that about 20 FMs override menu files which should not be overridden.
This often have bad effect of being unable to change or fix these files.

It would be good to add missing capabilities to core GUI, and remove overriding files from FMs.
Additional InformationDiscussions:
TagsNo tags attached.


parent of 0005341 resolvedstgatilov Menu Music can't be switched off during a mission 
parent of 0005669 resolvedstgatilov MIssion intro not showing sometimes 
related to 0005574 feedbackstgatilov Debrief Video: Cuts to Menu Before Start 




09.08.2020 03:25

administrator   ~0012719

Here are some necessary customizations I've heard about:
* Skipping some screen(s) in briefing sequence: BRIEFING, success, diffuculty, objectives
* Changing background image: title, briefing (figures on title page should be removable)
* Changing music
* Changing "wait until ready screen" (already works well)
* "problem with the custom guis is how long and full of comments they are, making it difficult to find something specific."

A better thing would be refactor GUI code, so that every screen includes some customizable file.
I'm not sure I'll be able to do it...


14.08.2020 05:46

administrator   ~0012733

Huge effort spent on refactoring state skipping in GUI scripts.
Now MainMenuModeSelect simple calls same-named C++ cmd, instead of doing all the complicated logic by itself.

As the result, it allowed to properly implement disabling of the following FM-owned states:
In order to achieve that, I introduced pseudostates MM_STATE_FORWARD and MM_STATE_BACKWARD, which don't define any GUI. Somewhat similar to MM_STATE_MAINMENU, it is detected by state switching code (which is now in C++) and redirected to proper target state.


14.08.2020 05:56

administrator   ~0012734

Last edited: 31.08.2020 16:46

Speaking of commits, the following preliminary ones add new features and don't change/break any behavior:
  r8923. Fixed GUI cmd concatenation bug. That was responsible for hazards like "initChoicelog", not the overflow.
  r8924+r8948. Set mapStartCmd GUI variable when "start new game" is clicked. Before that, it was set independently in shop and in objectives code.
  r8925. Added public method idUserInterface::ResetWindowTime.
  r8926. Added public method to idParser for getting defines. This is going to be used to access FM-customized GUI defines from C++ code.
  r8927. All defines in GUI scripts which are present at the end of parsing are saved now. They can be accessed with GetStateXXX methods, prepending '#' charactar to the name of define.
  r15993. Updating comments with information about new (FFmpeg-based) videos.
  r15995. Removed unused MainMenuWatchDog and commented Debug from GUI scripts.

This pair of commits refactors MainMenuModeSelect (moves to C++):
  r8928. Implemented GUI command mainmenumodeselect. It replaces the code from "MainMenuModeSelect::onTime 0" in GUI scripts.
  r15996. Big chunk of GUI code in "MainMenuModeSelect::onTime 0" replaced with call to "mainmenumodeselect" C++ command.
They can already break FMs which override GUI files which they should NOT override.

This pair adds FORWARD/BACKWARD system and supports states skipping:
  r8929. Added FORWARD/BACKWARD actions and implemented state skipping in "mainmenumodeselect" cmd.
  r15997. Added FORWARD/BACKWARD main menu pseudostate, use it where appropriate, supported state skipping.


22.08.2020 06:21

administrator   ~0012746

I have extracted the major changes into branch 8323_mainmenu and reverted them in trunk.

The following commits were moved:
  8928, 8929
  15996, 15997


31.08.2020 16:53

administrator   ~0012769

Here are some more changed which went into trunk.

This is generic change (not even for GUI) --- logfile improvement:
  r8954. When writing messages to logfile (DM_LOG), print relative path to source file instead of absolute.

Adding detailed logging for GUI scripts (enabled under LC_MAINMENU/LT_DEBUG settings in darkmod.ini):
  r8955. Save source location in every idGuiScript and print it when gui cmd is issued.
  r8956. Report all events happening to all windows to logfile, with a simple spam filter.
Without it I could hardly debug any of the stupid problems that I face all the time!

One "decapsulation" method:
  r8957. Added idSession::GetGui method, allowing to get active, mainmenu, etc. GUI at any moment.

And minor cleanup of GUI code:
  r16012. Main menu cleanup: notime 0 should be everywhere.


31.08.2020 16:55

administrator   ~0012770

And these changes went into branch.

Music is now tied to main state, no more separate state switcher.
  r8959. Music state is now tied to main state (aka "mode"). MainMenuMusicSelect GUI script should no longer be used.
  r16014. MainMenuMusicSelect is now empty: music is controlled by C++ code, tied to the main "mode" state.

Serious change of how initialization works (due to problems with menu after engine restart):
  r16015. Major changes in how MainMenuStartUp works.
  r8960. Drop main menu "mode" explicitly when starting game and when changing language.


30.05.2021 17:32

administrator   ~0014056

Restored branch after 9 months of inactivity:
  r9413. Now MAINMENI and BRIEFING_VIDEO are direct neighbors, without MOD_SELECT in-between.
  r9415. Ammended commit 9413: going back from BRIEFING should yield MAINMENU now too.
  r16287. Transition from MAINMENI_NOTINGAME for starting the mission must use FORWARD transition. This allows it so support state skipping.
  r16288. Removed recently added hack to switch to INGAME version in MainMenuStateInit. Now C++ code takes care of that.
Recall that Obsttorte changed mission start sequence: now we go from MAINMENU directly to BRIEFING_VIDEO, and MOD_SELECT is just a separate page of menu.

After that I started working on background layers system.
So that mapper could easily define which of the layers are visible in every state (custom layers can also be defined),

A few commits went into trunk:
  r9416. Added idStr::Split and idStr::Join.
  r9417. Error when "set" GUI command is called with less than two arguments.
The first one is about idlib: wanted to add these functions for a long time already...
The second commit is changing assert/out-of-bounds access to readable common->Error.

Some refactoring of branch-specific code (naming convention for destructor/constructor):
  r9419. Now we store one string "stateToggle" instead of two strings "constructor" + "destructor" for states.
  r16289. Renamed SettingsGuiSizeState's constructor/destructor to follow common naming conventions.

Finally, the actual changes for background layers:
  r9420. Refactored various background stuff into the system of background layers.
  r16290. Refactored various background stuff into the system of background layers.
  r16291. Don't enable/disable figures background manually. Now state-switching C++ code takes care of it.
Extracted code from main menu and from success screen into main manu.
Also added "black screen" layer, in case someone wants it (note: not having any background means showing the last screen from game).


05.06.2021 11:46

administrator   ~0014071

More changes in branch.

First of all, here are some minor stuff (fixing issues from former changes):
    r16292. Use FORWARD transition when Escape is hit in several cases.
    r16293. Minor fixes.
    r16294. Added file guis/mainmenu_background_custom.gui, where mappers can define custom backgrounds for their FMs.
    r16295. Removed some code which handles backgrounds (they should not be touched directly anymore).
    r16297. Many fixes for background layers.

Then several interdependent major changes were made:
    r9422. Now idUserInterface can be compiled with a set of predefined macros.
    r9423. Major changes: reload main menu GUI on every invocation, use main menu GUI for mission failure screen.
    r16296. Major changes: restart GUI turned into a state of main menu GUI.

1) Main menu is now deleted and recreated on game start, game end, and moving to next mission in campaign.
  Previously main menu existed forever, which made it very hard to avoid some dirty state leftover from previous invocation.
  Getting in-game main menu to start up was terribly hard, as far as I remember.
2) Thanks to p.1, separate restart (mission failed) GUI has been turned into a state of main menu GUI.
  So backgrounds, music, state switching --- all of these systems now work for mission failure screen too.
3) Thanks to p.1, two important pieces of information are now passed as macros: MM_INGAME and MM_CURRENTMISSION.
  This allows to use all macro-based customizations on per-mission basis in campaign.
  For instance, one can set different MM_BRIEFING_VIDEO_MATERIAL_1 for every mission via #ifdefing by MM_CURRENTMISSION.

Now we have two code path for briefing videos: gui-only and "SDK-controlled" ones.
The second was introduced later in order to support campaigns (and also to simplify workaround for ROQ 60 seconds restriction).
None of these problems apply now, so we can simply drop "SDK-controlled" code path as very rarely used one.
But to do this, we should first support gui-only debriefing videos --- exactly the same way as briefing videos work:
    r9424. Support debriefing videos not controlled by SDK.
    r16299. Added debriefing video not controlled by SDK, supported enabling it like all other states.

With all the changes, here is cleanup commit:
    r16298. Fixed some comments in main menu GUI files.

And a small fix for related issue 0005341:
  r9425. Make sure menu music setting affect main menu when in-game too.


14.07.2021 12:40

administrator   ~0014155

I think it's time for major update here.

First of all, a few generic improvements got into trunk:
  r9416. Added idStr::Split and idStr::Join.
  r9417. Error when "set" GUI command is called with less than two arguments.

All the other changes are in branch yet.

Various fixes for new approach:
  r9426. Fixed the choice between DEBRIEFING_VIDEO/SUCCESS when mission finishes successfully.
  r16302. Fixed the choice between DEBRIEFING_VIDEO/SUCCESS when mission finishes successfully.
  r16311. Removed hardcoded backgrounds from SHOP state.
  r9427. When switching to next mission, start from BRIEFING_VIDEO instead of BRIEFING.

Improving GUI code to make it more readable and cause less trouble:
  r16303. Undefine some macros to avoid redefinition warnings.
  r16304. Rewrote mainmenu_custom_defs.gui almost completely.
  r16305. Fix for previous commit: leave "#define MM_BRIEFING_VIDEO_LENGTH_1 10000" for backwards compatibility.
  r16310. Comment headers: do NOT override tdm_objectives*.gui.
  r16313. Better comments for the custom background sample.

Then implemented "meta" define to override typical set of backgrounds at once:
  r9433. Implmented "meta" backgrounds defines for.
  r16314. Added meta define MM_BACKGROUNDS_META_ALLSIMPLE.


08.08.2021 13:03

administrator   ~0014255

Merged all changed from trunk to branch.
Checked that it works as it did.

Then merged the branch back to trunk:
  r9552. Reintegrated branch 5323_mainmenu.
  r16340. Reintegrated branch 5323_mainmenu.

So, the story is almost over.
Only need to wait until 2.10 and update all the missions in the database.

Issue History

Date Modified Username Field Change
09.08.2020 02:01 stgatilov New Issue
09.08.2020 02:01 stgatilov Status new => assigned
09.08.2020 02:01 stgatilov Assigned To => stgatilov
09.08.2020 03:25 stgatilov Note Added: 0012719
14.08.2020 05:46 stgatilov Note Added: 0012733
14.08.2020 05:56 stgatilov Note Added: 0012734
22.08.2020 06:21 stgatilov Note Added: 0012746
31.08.2020 16:46 stgatilov Note Edited: 0012734
31.08.2020 16:53 stgatilov Note Added: 0012769
31.08.2020 16:55 stgatilov Note Added: 0012770
05.12.2020 12:28 stgatilov Target Version TDM 2.09 => TDM 2.10
17.12.2020 03:59 stgatilov Relationship added parent of 0005341
28.03.2021 16:47 stgatilov Relationship added related to 0005574
30.05.2021 17:32 stgatilov Note Added: 0014056
05.06.2021 11:46 stgatilov Note Added: 0014071
14.07.2021 12:40 stgatilov Note Added: 0014155
08.08.2021 13:03 stgatilov Note Added: 0014255
08.08.2021 13:03 stgatilov Status assigned => suspended
31.08.2021 14:26 stgatilov Relationship added related to 0005669
25.09.2021 04:28 stgatilov Relationship replaced parent of 0005669