commit 12ecbde4d91d9f59789902726f80c7fc4ca0fc1d
parent 9674b9145b1082e35bdb2acb57e30a2c9586c6a2
Author: Erik Letson <hmagellan@hmagellan.com>
Date: Sun, 25 Apr 2021 18:31:35 -0500
can now speed-up dialog to skip it
Diffstat:
3 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/src/bus.py b/src/bus.py
@@ -129,8 +129,8 @@ class ManagerBus(subsystem.GameSubsystem):
self.game.scene_manager.load_still_scene_from_file(scenefile)
def perform_scene_manager_load_scene_from_def(self, definition):
self.game.scene_manager.load_still_scene_from_def(definition)
- def perform_continue_current_scene_script(self):
- self.game.scene_manager.current_scene.continue_script()
+ def perform_click_current_scene(self):
+ self.game.scene_manager.current_scene.be_clicked()
def perform_display_move_range_of_piece(self, piece):
self.game.board_manager.display_as_move_range(piece, self.game.piece_manager.get_piece_max_legal_move(piece))
def perform_display_attack_range_of_piece(self, piece):
diff --git a/src/interface.py b/src/interface.py
@@ -121,7 +121,7 @@ class GameInterface(subsystem.GameSubsystem):
# Handle cycling script segments during scenes in base mode
elif self.game.control_mode == CTRL_MODES.Base_Dialog:
- self.bus.perform_continue_current_scene_script()
+ self.bus.perform_click_current_scene()
# Battle mode behavior
elif self.game.state_mode == STATE_MODES.Battle_Mode:
@@ -167,14 +167,14 @@ class GameInterface(subsystem.GameSubsystem):
# StillScene in-battle dialog options
elif self.game.control_mode == CTRL_MODES.Battle_Dialog:
- self.bus.perform_continue_current_scene_script()
+ self.bus.perform_click_current_scene()
# Still-scene mode behavior
elif self.game.state_mode == STATE_MODES.Still_Scene_Mode:
# Normal still-scene control
if self.game.control_mode == CTRL_MODES.Still_Scene_Normal:
- self.bus.perform_continue_current_scene_script()
+ self.bus.perform_click_current_scene()
# Keepover
self.old_mousepos = mousepos
diff --git a/src/scene.py b/src/scene.py
@@ -114,6 +114,9 @@ class StillScene(object):
self.fonts = {}
self.text_speed = 1
self.text_write_timer = 0
+ self.text_boost = 1
+ self.max_text_boost = 10
+ self.voice_playable = True
self.current_text_char_index = 0
self.continue_ready = False
self.max_line = 0
@@ -202,6 +205,8 @@ class StillScene(object):
self.current_portrait_rect = None
self.current_text_char_index = 0
self.line_number = 0
+ self.text_boost = 1
+ self.voice_playable = True
self.current_line_starting_index = 0
self.displayed_characters = []
sh = self.manager.bus.fetch("sheet_manager", "sheets")
@@ -255,7 +260,7 @@ class StillScene(object):
# Otherwise, write a new char and switch up the appropriate vals
else:
self.text_write_timer = 0
- self.current_text_char_index += 1
+ self.current_text_char_index += self.text_boost
self.displayed_strings[self.line_number] = self.current_text_string[self.current_line_starting_index:self.current_text_char_index]
# Check if we need to add a new line
@@ -314,12 +319,23 @@ class StillScene(object):
def continue_script(self):
"""
- Trigger the script cycle. Activated by something
- else.
+ Continue the current script if we are ready.
"""
if self.continue_ready and self.script_index < len(self.script) - 1:
self.cycle_script_segment()
+ def be_clicked(self):
+ """
+ Handle a mouse click during the scene playing
+ """
+ # Continue the scene if we are ready to
+ if self.continue_ready:
+ self.continue_script()
+ # Otherwise, speed-up the text display
+ else:
+ self.text_boost = self.max_text_boost
+ self.voice_playable = False
+
def setup_delay(self, timer):
"""
Setup a scene delay for the given amount of time.
@@ -433,5 +449,5 @@ class StillScene(object):
surface.blit(t, (self.text_area_topleft[0] + xoff, self.text_area_topleft[1] + (self.current_font_height * l) + 2))
l += 1
- if self.current_voice != None and not self.continue_ready:
+ if self.current_voice != None and self.voice_playable and not self.continue_ready:
self.play_voice()