Rename flag NO_HUD to NO_UI (code) (#432)

This commit is contained in:
Julian Murgia
2021-11-11 22:46:00 +01:00
committed by GitHub
parent 023dc211de
commit e4bc9ecccf
4 changed files with 17 additions and 17 deletions

View File

@@ -173,7 +173,7 @@ func _test_event_flags() -> bool:
var esc = """ var esc = """
:test | TK :test | TK
:test2 | TK NO_TT :test2 | TK NO_TT
:test3 | TK NO_TT NO_HUD :test3 | TK NO_TT NO_UI
""" """
var script = escoria.esc_compiler.compile(esc.split("\n")) var script = escoria.esc_compiler.compile(esc.split("\n"))
@@ -197,7 +197,7 @@ func _test_event_flags() -> bool:
assert(subject.name == "test3") assert(subject.name == "test3")
assert(subject.flags & ESCEvent.FLAG_TK != 0) assert(subject.flags & ESCEvent.FLAG_TK != 0)
assert(subject.flags & ESCEvent.FLAG_NO_TT != 0) assert(subject.flags & ESCEvent.FLAG_NO_TT != 0)
assert(subject.flags & ESCEvent.FLAG_NO_HUD != 0) assert(subject.flags & ESCEvent.FLAG_NO_UI != 0)
return true return true

View File

@@ -13,7 +13,7 @@ class_name ESCEvent
# Regex identifying an ESC event # Regex identifying an ESC event
const REGEX = \ const REGEX = \
'^:(?<name>[^|]+)( \\|\\s*(?<flags>( ' + \ '^:(?<name>[^|]+)( \\|\\s*(?<flags>( ' + \
'(TK|NO_TT|NO_HUD|NO_SAVE)' + \ '(TK|NO_TT|NO_UI|NO_SAVE)' + \
')+))?$' ')+))?$'
@@ -23,15 +23,15 @@ const REGEX = \
# * NO_TT: stands for "No tooltip". It hides the tooltip for the duration of # * NO_TT: stands for "No tooltip". It hides the tooltip for the duration of
# the event. Probably not very useful, because events having multiple # the event. Probably not very useful, because events having multiple
# say commands in them are automatically hidden. # say commands in them are automatically hidden.
# * NO_HUD: stands for "No HUD". It hides the HUD for the duration of the # * NO_UI: stands for "No User Inteface". It hides the UI for the duration of
# event. Useful when you want something to look like a cut scene but not #  the event. Useful when you want something to look like a cut scene but not
# disable input for skipping dialog. # disable input for skipping dialog.
# * NO_SAVE: disables saving. Use this in cut scenes and anywhere a # * NO_SAVE: disables saving. Use this in cut scenes and anywhere a
# badly-timed autosave would leave your game in a messed-up state. # badly-timed autosave would leave your game in a messed-up state.
enum { enum {
FLAG_TK = 1, FLAG_TK = 1,
FLAG_NO_TT = 2, FLAG_NO_TT = 2,
FLAG_NO_HUD = 4, FLAG_NO_UI = 4,
FLAG_NO_SAVE = 8 FLAG_NO_SAVE = 8
} }
@@ -62,8 +62,8 @@ func _init(event_string: String):
self.flags |= FLAG_TK self.flags |= FLAG_TK
if "NO_TT" in _flags: if "NO_TT" in _flags:
self.flags |= FLAG_NO_TT self.flags |= FLAG_NO_TT
if "NO_HUD" in _flags: if "NO_UI" in _flags:
self.flags |= FLAG_NO_HUD self.flags |= FLAG_NO_UI
if "NO_SAVE" in _flags: if "NO_SAVE" in _flags:
self.flags |= FLAG_NO_SAVE self.flags |= FLAG_NO_SAVE
else: else:

View File

@@ -150,17 +150,17 @@ func perform_inputevent_on_object(
"_on_no_tooltip_event_finished" "_on_no_tooltip_event_finished"
) )
if event_flags & ESCEvent.FLAG_NO_HUD and \ if event_flags & ESCEvent.FLAG_NO_UI and \
not escoria.event_manager.is_connected( not escoria.event_manager.is_connected(
"event_finished", "event_finished",
self, self,
"_on_no_hud_event_finished" "_on_no_ui_event_finished"
): ):
escoria.main.current_scene.game.hide_ui() escoria.main.current_scene.game.hide_ui()
escoria.event_manager.connect( escoria.event_manager.connect(
"event_finished", "event_finished",
self, self,
"_on_no_hud_event_finished" "_on_no_ui_event_finished"
) )
if event_flags & ESCEvent.FLAG_NO_SAVE and \ if event_flags & ESCEvent.FLAG_NO_SAVE and \
@@ -314,23 +314,23 @@ func _on_no_tooltip_event_finished(_return_code: int, _event_name: String):
) )
# Called when an event having "NO_HUD" flag is finished. # Called when an event having "NO_UI" flag is finished.
# #
# ## Parameters # ## Parameters
# #
# - _return_code: The ESCExecution return code sent by the events manager. # - _return_code: The ESCExecution return code sent by the events manager.
# - _event_name: the name of the event # - _event_name: the name of the event
func _on_no_hud_event_finished(_return_code: int, _event_name: String): func _on_no_ui_event_finished(_return_code: int, _event_name: String):
escoria.main.current_scene.game.show_ui() escoria.main.current_scene.game.show_ui()
if escoria.event_manager.is_connected( if escoria.event_manager.is_connected(
"event_finished", "event_finished",
self, self,
"_on_no_hud_event_finished" "_on_no_ui_event_finished"
): ):
escoria.event_manager.disconnect( escoria.event_manager.disconnect(
"event_finished", "event_finished",
self, self,
"_on_no_hud_event_finished" "_on_no_ui_event_finished"
) )

4
game/rooms/room11/esc/mysterious_circle_nohud.esc Executable file → Normal file
View File

@@ -1,3 +1,3 @@
:look | NO_HUD :look | NO_UI
say player "NO_HUD" say player "NO_UI"