Skip to content

Commit 81b408f

Browse files
committed
Added a modal GUI.
- This is used to inform the player or to ask them a question, along with buttons to cancel or do other actions. - Replaced the main menu tutorial question and pause leave confirmation question with the modal system. - Added modals for all sorts of "advanced..." bullet points that just unceremoniously opened the manual.
1 parent efab2da commit 81b408f

File tree

18 files changed

+696
-446
lines changed

18 files changed

+696
-446
lines changed

game_data/base/gui/help_menu.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ hardcoded_items{
4141
}
4242
manual{
4343
center=22.0000 54.0000
44-
size=36.0000 4.0000
44+
size=28.0000 4.0000
4545
description=Link to the manual.
4646
}
4747
category{

game_data/base/gui/main_menu_tutorial.txt

Lines changed: 0 additions & 33 deletions
This file was deleted.

game_data/base/gui/modal.txt

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name=Modal dialog
2+
description=GUI for any sort of modal dialog that shows up to ask the player something.
3+
maker=Espyo
4+
version=1.0.0
5+
engine_version=1.0.0
6+
hardcoded_items{
7+
title{
8+
center=50.0000 9.0000
9+
size=92.0000 10.0000
10+
description=The modal dialog's title text.
11+
}
12+
prompt{
13+
center=50.0000 50.0000
14+
size=92.0000 32.0000
15+
description=Whatever the modal dialog needs to tell the player.
16+
}
17+
button_area{
18+
center=50.0000 83.0000
19+
size=92.0000 10.0000
20+
description=Area where the buttons go. Their horizontal position and width is dynamically adjusted based on how many there are.
21+
}
22+
back_input{
23+
center=5.0000 87.0000
24+
size=4.0000 4.0000
25+
description=Icon of the input bound to the back button.
26+
}
27+
tooltip{
28+
center=50.0000 96.0000
29+
size=96.0000 4.0000
30+
description=Tooltip of the focused menu item.
31+
}
32+
}
33+
custom_items

game_data/base/gui/options_menu_top.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ hardcoded_items{
4040
description=Misc. page button.
4141
}
4242
advanced{
43-
center=87.0000 86.0000
44-
size=22.0000 8.0000
43+
center=87.0000 87.0000
44+
size=22.0000 6.0000
4545
description=Advanced options information bullet point.
4646
}
4747
tooltip{

game_data/base/gui/pause_menu_confirmation.txt

Lines changed: 0 additions & 49 deletions
This file was deleted.

manual/content/changelog.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ <h3 id="1.1.0-making">Content-making changes</h3>
6060
<li><span class="cl-a">Added</span> descriptions to the hardcoded GUI items, visible in the item list in the <a href="gui.html">GUI editor</a>. The full lists have been removed from the manual page as a result.</li>
6161
<li><span class="cl-a">Added</span> some GUI colors to the <a href="game_config.html">game configuration</a>.</li>
6262
<li><span class="cl-a">Added</span> some edge sector patching tools to the <a href="area.html">area editor</a>. useful for when you have sectors broken beyond normal repair.</li>
63+
<li><span class="cl-a">Added</span> a modal dialog <a href="gui.html">GUI definition</a>.</li>
6364
<li><span class="cl-c">Changed</span> the <code>print</code> <a href="events_and_actions.html">script action</a> to show the latest and the past lines, instead of just the latest.</li>
6465
</ul>
6566

@@ -74,6 +75,7 @@ <h3 id="1.1.0-compatibility">compatibility changes</h3>
7475
<li><span class="cl-c">Changed</span> some <a href="gui.html">GUI</code> items that used to be hardcoded to instead be custom items.</li>
7576
<li><span class="cl-c">Changed</span> the <a href="mob_leader.html">leader's</code> <code>lying</code> animation to <code>sleeping</code>.</li>
7677
<li><span class="cl-c">Changed</span> the way hardcoded <a href="gui.html">GUI items</code> are stored in GUI definitions. Instead of one property per item in a <code>positions</code> block, each item is a sub-block inside of a <code>hardcoded_items</code> block.</li>
78+
<li><span class="cl-c">Changed</span> how some prompts work so that they use the modal dialog <a href="gui.html">GUI definition</code> instead of their own definitions. The main menu tutorial question and pause menu confirmation question GUI definitions were removed.</li>
7779
<li><span class="cl-d">Deprecated</span> the <code>cursor_speed</code>, <code>cursor_cam_weight</code>, <code>show_counter_on_cursor</code>, and <code>advanced</code> &gt; <code>p*_mouse_moves_cursor</code> <a href="options.html">options</a>. Play 1.1.0 to automatically rename them to the new names <code>leader_cursor_speed</code>, <code>leader_cursor_cam_weight</code>, <code>show_leader_cursor_counter</code>, and <code>controls</code> &gt; <code>p*_mouse_moves_leader_cursor</code>.</li>
7880
<li><span class="cl-d">Deprecated</span> the <code>cursor_speed</code>, <code>cursor_cam_weight</code>, and <code>show_counter_on_cursor</code> <a href="options.html">options</a>. Play 1.1.0 to automatically rename them to the new names <code>leader_cursor_speed</code>, <code>leader_cursor_cam_weight</code>, and <code>show_leader_cursor_counter</code>.</li>
7981
<li><span class="cl-d">Deprecated</span> the <code>menu_selected</code>, <code>cursor</code>, and <code>cursor_counter</code> <a href="system_content_names.html">system content</a> properties. Please rename them to <code>menu_focused</code>, <code>leader_cursor</code>, and <code>leader_cursor_counter</code>.</li>

manual/content/game_config.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,13 +174,13 @@ <h2 id="gui-colors">GUI colors</h2>
174174
</tr>
175175
<tr>
176176
<td>pause_bg</td>
177-
<td>Background for menus that pause the game.</td>
177+
<td>Background for the pause menu and other such menus.</td>
178178
<td>Color</td>
179179
<td>25 46 70 204</td>
180180
</tr>
181181
<tr>
182182
<td>pause_vignette</td>
183-
<td>Background vignette bitmap for menus that pause the game.</td>
183+
<td>Background vignette bitmap for the pause menu and other such menus.</td>
184184
<td>Color</td>
185185
<td>140 182 224 44</td>
186186
</tr>

source/source/content/other/gui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -756,7 +756,7 @@ class GuiManager {
756756
bool destroy();
757757

758758

759-
private:
759+
protected:
760760

761761
//--- Members ---
762762

source/source/core/game.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "audio.h"
3030
#include "game_config.h"
3131
#include "misc_structs.h"
32+
#include "modal_gui.h"
3233
#include "options.h"
3334
#include "shaders.h"
3435

@@ -184,6 +185,9 @@ class Game {
184185
//List of mob categories.
185186
CategoryManager mobCategories;
186187

188+
//Current modal dialog, if any.
189+
ModalGuiManager modal;
190+
187191
//Mouse cursor information.
188192
MouseCursor mouseCursor;
189193

@@ -204,7 +208,7 @@ class Game {
204208

205209
//Player actions in this frame.
206210
vector<Inpution::Action> playerActions;
207-
211+
208212
//List of all possible inventory items.
209213
InventoryItemDatabase inventoryItems;
210214

0 commit comments

Comments
 (0)