Allow dialogues to be hidden or shown

To do this, MENU and SUBMENU are split into two types (at last), and
a Widget type is introduced. This should allow lots of code to be
removed at some point.
This commit is contained in:
2020-04-14 03:14:49 +01:00
parent dc131939f4
commit 786d261f98
18 changed files with 1034 additions and 847 deletions

View File

@@ -140,59 +140,71 @@ files.
## `MENUTYPE`
Here's the full list of
Here's the full list of values for `MENUTYPE`:
| Value | Meaning |
| ----- | ------------ |
| 0 | `Background` |
| 1 | `Menu` |
| 2 | `DragMenu` |
| 3 | `RadioMenu` ??? - only seen in `LevelPly` and `LoadGame` around select-one items |
| 45 | `MainBackground` ??? - only seen in `MainGame` and `MainGameChaos` |
| 300 | `Dialogue` |
The `MENUTYPE` acts as a logical grouping of a set of objects onscreen, and
gives strong hints about how to handle their children.
## `SUBMENUTYPE`
## (Sub)menu types
The types seem to refer to different types of UI widget. Here's a list of unique
values:
| Value | Meaning |
|-------|---------|
| 0 | Background |
| 1 | Logical menu grouping? |
| 2 | ? |
| 3 | Standard button? |
| 30 | Equipment? |
| 31 | "Character helmet" / "Slot" |
| 40 | "X Line Y" |
| 41 | "X Line Y" |
| 45 | ? |
| 45,10,11,9 | ? |
| 45,11,12,10 | ? |
| 45,14,15,13 | ? |
| 45,17,18,16 | ? |
| 45,3,4,2 | ? |
| 45,5,6,4 | ? |
| 45,6,7,5 | ? |
| 45,7,8,6 | ? |
| 45,8,9,7 | ? |
| 45,9,10,8 | ? |
| 50 | ? |
| 60 | Other text to display? (`UltEquip.mnu`) |
| 61 | Text to display |
| 70 | Hypertext to display |
| 91 | ? |
| 100 | ? |
| 110 | ? |
| 120 | ? |
| 200 | Drop-down button? |
| 205 | Single list box item? |
| 220 | Psyker power? |
| 221 | Page? |
| 228 | Big buttons in `Main.mnu` |
| 232 | ? |
| 233 | ? |
| 300 | Pop-up dialog box |
| 400,0,0,{8, 16} | ? |
| 400,22,22,{2, 4, 5, 6, 7, 8, 9, 9, 10, 13, 16} | ? |
| 400,30,-1,5 | ? |
| 405,0,0,{8, 16} | ? |
| 405,22,22,{2, 4, 5, 6, 7, 8, 9, 10, 13, 16} | ? |
| 405,30,-1,5 | ? |
| 3 | `Button` |
| 30 | `DoorHotspot1` |
| 31 | `DoorHotspot2` |
| 40 | `LineKbd` |
| 41 | `LineBriefing` |
| 45 | `Thumb` |
| 50 | `InvokeButton` |
| 60 | `DoorHotspot3` |
| 61 | `Overlay` |
| 70 | `Hypertext` |
| 91 | `Checkbox` |
| 100 | `EditBox` |
| 110 | `InventorySelect` |
| 120 | `RadioButton` |
| 200 | `DropdownButton` |
| 205 | `ComboBoxItem` |
| 220 | `AnimationSample` |
| 221 | `AnimationHover` |
| 228 | `MainButton` |
| 232 | `Slider` |
| 233 | `StatusBar` |
| 400 | `ListBoxUp` |
| 405 | `ListBoxDown` |
`400`, `405`, and `45`, can all accept 4 values for `SUBMENUTYPE` in a
comma-separated list. These records combine to form a `TListBox` control, with a
number of visible slots that act as a viewport. There is a draggable vertical
slider (the "thumb") to show where in the full list the viewport is, and up +
down buttons to move the position of the thumb by one, so it's feasible that
these values tell us about the available steps.
Here are the values in `Briefing.mnu`:
```
#rem..........List Box Menu
MENUTYPE : 1 # List Box Menu
SUBMENUTYPE: 400,22,22,13 # Scroll Up
SUBMENUTYPE: 405,22,22,13 # Scroll Down
SUBMENUTYPE: 45, 14,15,13 # Thumb
```
There are 13 elements in this listbox, which sorts out the fourth number (but
what is it used for?). The other two need more investigation.
## Positioning
@@ -205,6 +217,9 @@ successfully, for instance:
![](img/Options.mnu.png)
However, it's *not* sufficient to put all the items for `MainGame.mnu` in the
right place.
## Animation
This seems to be done by choosing a different sprite to draw every N ticks. They
@@ -248,36 +263,6 @@ attributes plucked from `Main.mnu`:
The buttons, menu title and version hotspot are submenus of the start menu.
### `MENUTYPE`
This is the only menu where we see a type of 228. ~750 other unique values are
observed, suggesting structure. For instance, we have `24`, `240`, `241` and
`2410`, but not `2411` or `2409`. Sometimes we have a comma-separated list,
e.g.: `400,30,-1,5`.
A listing of some currently-known values:
| Value | Type |
| ----- | ---------------- |
| 0 | Static image |
| 1 | Menu |
| 3 | Button |
| 45 | Thumb |
| 50 | Invoke? Button? |
| 61 | "Overlay" |
| 70 | "Hypertext" |
| 91 | Checkbox |
| 220 | Animation sample |
| 228 | Main menu button |
| 232 | Slider |
Hypothesis: `MENUTYPE` and `SUBMENUTYPE` are actually distinct lists of values.
So far, I've been treating them as the same thing, but, e.g., `MainGame.mnu` has
a `MENUTYPE: 45` which is labelled "MAIN BACKGROUND", while `SUBMENUTYPE: 45`
is tentatively labelled a "thumb" and used in text boxes. There are also a few
cases where I've had to manually override the `MENUTYPE` because it coincides
with `Button`.
### `ACTIVE`
There are only 4 values seen across all menus: `0`, `1`, `1,0`, `102` and `1,1`.