Make the menu buttons work

This commit is contained in:
2020-03-21 18:50:26 +00:00
parent be4229b8fe
commit 46925c09d1
5 changed files with 194 additions and 66 deletions

View File

@@ -201,3 +201,64 @@ This seems to be done by choosing a different sprite to draw every N ticks. They
are laid out sequentially, but I don't yet know how to animate them. It's likely
to be the same approach as used for other obj files.
Looking at Main.mnu, it points at the object fail Main.obj. This has 118
sprites, which can be described as follows:
| Start | Count | Desc |
| ------ | ----- | ---- |
| 0 | 1 | Background image |
| 1 | 3 | New game button: base, pressed, disabled |
| 4 | 3 | Load game button: base, pressed, disabled |
| 7 | 3 | Multiplayer button: base, pressed, disabled |
| 10 | 3 | Settings button: base, pressed, disabled |
| 13 | 3 | Quit button: base, pressed, disabled |
| 16 | 20 | New game button: 20 animation frames |
| 36 | 20 | Load game button: 20 animation frames |
| 56 | 20 | Multiplayer button: 20 animation frames |
| 76 | 20 | Settings button: 20 animation frames |
| 96 | 20 | Quit button: 20 animation frames |
| 116 | 1 | Section of background ("Menu title") |
| 117 | 1 | Version hotspot |
So we have 5 buttons with very similar characteristics, but at different sprite
offsets, and two distinct ranges per button, plus some others. Here's some
attributes plucked from `Main.mnu`:
| Name | (SUB)MENUTYPE | "Active" | "SPRITEID" | "DRAW TYPE" | "SHARE" |
| ---------- | ------------- | -------- | ---------- | ----------- | ------- |
| Background | 1 | 1 | 0 | 0 | -1 |
| Start menu | 1 | 1 | -1 | 0 | -1 |
| New game | 228 | 1,0 | 16,-1,1 | 20 | 1 |
| Load game | 228 | 1,0 | 36,-1,4 | 20 | 4 |
| MP game | 228 | 1,0 | 56,-1,7 | 20 | 7 |
| Options | 228 | 1,0 | 76,-1,10 | 20 | 10 |
| Quit | 228 | 1,0 | 96,-1,13 | 20 | 13 |
| Menu title | 61 | 1 | -1 | 0 | 116 |
| V hotspot | 61 | 1 | -1 | 0 | 117 |
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`.
### `ACTIVE`
There are only 4 values seen across all menus: `0`, `1`, `1,0`, `102` and `1,1`.
Perhaps this represents possible states?
### Sprite selection
For the background (`MENUTYPE: 1`), this points simply at the sprite index in
the object file. For the start menu, it's `-1` (no sprite, I assume). For the
menu title and version hotspot (`MENUTYPE: 61`, it's `-1` too.
For the buttons, it's a list pointing to the start of the 20 animated frames,
`-1`, then the start of the 3 static frames.
`DRAW TYPE` is the number of animated frames. We only use the animated frames
when the button is focused. `SHARE` repeats the start of the static frames, and
is the only place they're found for the menu title and version hotspot.