commit b72b6139d28a12c7a2c6b50c8ab48d59b5fe3003
parent a841c11d21765a4447f7ff00562dbd136c03886b
Author: Erik Letson <hmagellan@hmagellan.com>
Date: Sun, 25 Apr 2021 17:08:47 -0500
Set the stage for generic quitable modes
Diffstat:
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/constants.py b/src/constants.py
@@ -90,7 +90,7 @@ OTHER_STATS = ["HP", "EXP", "LVL", "RNK"]
# Enums
STATE_MODES = enum.Enum('STATE_MODES', 'Main_Menu_Mode Base_Mode Battle_Mode Still_Scene_Mode')
-CTRL_MODES = enum.Enum('CTRL_MODES', 'No_Control Main_Menu_Normal Base_Normal Base_Dialog Turn_Normal Turn_Select_Move Turn_Select_Attack Turn_Watch_Move Turn_Watch_Attack Turn_Display_Stats Turn_Watch_Guard Battle_Dialog Battle_Intro Battle_Resolve Still_Scene_Normal')
+CTRL_MODES = enum.Enum('CTRL_MODES', 'No_Control Main_Menu_Normal Base_Normal Base_Dialog Turn_Normal Turn_Select_Move Turn_Select_Attack Turn_Choose_Skill Turn_Choose_Item Turn_Select_Push Turn_Watch_Move Turn_Watch_Attack Turn_Display_Stats Turn_Watch_Guard Battle_Dialog Battle_Intro Battle_Resolve Still_Scene_Normal')
FACE_DIR = enum.Enum('FACE_DIR', 'U D L R')
GAME_EFFECTS = enum.Enum('GAME_EFFECTS', 'ef_game_dummy ef_game_quit ef_game_switch_mode ef_game_switch_control')
MENU_EFFECTS = enum.Enum('MENU_EFFECTS', 'ef_menu_dummy')
diff --git a/src/interface.py b/src/interface.py
@@ -37,6 +37,13 @@ class GameInterface(subsystem.GameSubsystem):
self.double_click_timer = 0
self.double_click_mousepos = None
self.old_mousepos = None
+ self.quitable_modes = [
+ CTRL_MODES.Turn_Select_Move,
+ CTRL_MODES.Turn_Select_Attack,
+ CTRL_MODES.Turn_Select_Push,
+ CTRL_MODES.Turn_Choose_Skill,
+ CTRL_MODES.Turn_Choose_Item
+ ]
def handle_events(self, events):
"""
@@ -67,7 +74,7 @@ class GameInterface(subsystem.GameSubsystem):
if event.key == pygame.K_s or event.key == pygame.K_q:
self.bus.perform_turn_manager_display_stats(None)
self.game.control_mode = CTRL_MODES.Turn_Normal
- elif self.game.control_mode == CTRL_MODES.Turn_Select_Move or self.game.control_mode == CTRL_MODES.Turn_Select_Attack:
+ elif self.game.control_mode in self.quitable_modes:
if event.key == pygame.K_q:
self.game.control_mode = CTRL_MODES.Turn_Normal
self.bus.perform_load_board_overlay()