Add non-regression test states and Bluetooth diagnostic script
- Introduced a new JSON file containing non-regression test states with detailed unit information, including positions, ages, and movement directions across multiple frames. - Added a shell script for Bluetooth diagnostics that checks system information, Bluetooth binaries, running processes, D-Bus status, Bluetooth controller details, and audio stack status, providing a comprehensive overview for troubleshooting.
This commit is contained in:
+59
-50
@@ -196,8 +196,12 @@ def resolve_keybindings(preferred_profile=None, preferred_file=None, render_engi
|
||||
|
||||
|
||||
class KeyBindings:
|
||||
def __init__(self, game):
|
||||
self.game = game
|
||||
self.bindings = {}
|
||||
|
||||
def _binding_sections_for_action(self):
|
||||
game_end_active, game_end_reason = getattr(self, "game_end", (False, None))
|
||||
game_end_active, game_end_reason = getattr(self.game, "game_end", (False, None))
|
||||
if game_end_active:
|
||||
if game_end_reason == "level_clear":
|
||||
return ["keybinding_level_clear", "keybinding_paused"]
|
||||
@@ -207,12 +211,12 @@ class KeyBindings:
|
||||
return ["keybinding_run_complete", "keybinding_paused"]
|
||||
return ["keybinding_paused"]
|
||||
|
||||
if getattr(self, "game_status", None) == "start_menu":
|
||||
if getattr(self, "menu_screen", None) == "level_intro":
|
||||
if getattr(self.game, "game_status", None) == "start_menu":
|
||||
if getattr(self.game, "menu_screen", None) == "level_intro":
|
||||
return ["keybinding_level_intro", "keybinding_start_menu"]
|
||||
return ["keybinding_start_menu"]
|
||||
|
||||
status = getattr(self, "game_status", None)
|
||||
status = getattr(self.game, "game_status", None)
|
||||
if status:
|
||||
return [f"keybinding_{status}"]
|
||||
|
||||
@@ -222,14 +226,14 @@ class KeyBindings:
|
||||
preferred_profile = None
|
||||
preferred_file = None
|
||||
|
||||
if hasattr(self, "profile_integration") and self.profile_integration:
|
||||
preferred_profile = self.profile_integration.get_setting("keybindings_profile")
|
||||
preferred_file = self.profile_integration.get_setting("keybindings_file")
|
||||
if hasattr(self.game, "profile_integration") and self.game.profile_integration:
|
||||
preferred_profile = self.game.profile_integration.get_setting("keybindings_profile")
|
||||
preferred_file = self.game.profile_integration.get_setting("keybindings_file")
|
||||
|
||||
bindings, source_path, profile_name, reason = resolve_keybindings(
|
||||
preferred_profile=preferred_profile,
|
||||
preferred_file=preferred_file,
|
||||
render_engine=getattr(self, "render_engine", None),
|
||||
render_engine=getattr(self.game, "render_engine", None),
|
||||
)
|
||||
|
||||
self.bindings = self._validate_bindings(bindings, source_path)
|
||||
@@ -255,7 +259,8 @@ class KeyBindings:
|
||||
continue
|
||||
|
||||
method_name = value.split("|", 1)[0]
|
||||
method = getattr(self, method_name, None)
|
||||
# Check both self (KeyBindings) and self.game (MiceMaze)
|
||||
method = getattr(self, method_name, getattr(self.game, method_name, None))
|
||||
if callable(method):
|
||||
validated[section_name][action] = value
|
||||
continue
|
||||
@@ -272,7 +277,7 @@ class KeyBindings:
|
||||
return validated
|
||||
|
||||
def trigger(self, action):
|
||||
if not hasattr(self, "bindings"):
|
||||
if not self.bindings:
|
||||
self.initialize_keybindings()
|
||||
|
||||
value = None
|
||||
@@ -286,77 +291,81 @@ class KeyBindings:
|
||||
|
||||
if "|" in value:
|
||||
method_name, *args = value.split("|")
|
||||
method = getattr(self, method_name, None)
|
||||
method = getattr(self, method_name, getattr(self.game, method_name, None))
|
||||
if callable(method):
|
||||
method(*args)
|
||||
return None
|
||||
|
||||
method = getattr(self, value, None)
|
||||
method = getattr(self, value, getattr(self.game, value, None))
|
||||
if callable(method):
|
||||
method()
|
||||
return None
|
||||
|
||||
|
||||
def spawn_rat(self):
|
||||
self.game.unit_manager.spawn_rat()
|
||||
|
||||
def spawn_new_bomb(self):
|
||||
self.spawn_bomb(self.pointer)
|
||||
self.game.unit_manager.spawn_bomb(self.game.pointer)
|
||||
|
||||
def spawn_new_mine(self):
|
||||
self.spawn_mine(self.pointer)
|
||||
self.game.unit_manager.spawn_mine(self.game.pointer)
|
||||
|
||||
def spawn_new_nuclear_bomb(self):
|
||||
self.spawn_nuclear_bomb(self.pointer)
|
||||
self.game.unit_manager.spawn_nuclear_bomb(self.game.pointer)
|
||||
|
||||
def spawn_new_gas(self):
|
||||
self.spawn_gas()
|
||||
self.game.unit_manager.spawn_gas()
|
||||
|
||||
def toggle_audio(self):
|
||||
self.render_engine.audio = not self.render_engine.audio
|
||||
self.audio = self.render_engine.audio
|
||||
if hasattr(self, "profile_integration") and self.profile_integration:
|
||||
self.profile_integration.set_setting("sound_enabled", self.audio)
|
||||
if not self.render_engine.audio:
|
||||
self.render_engine.stop_sound()
|
||||
self.game.render_engine.audio = not self.game.render_engine.audio
|
||||
self.game.audio = self.game.render_engine.audio
|
||||
if hasattr(self.game, "profile_integration") and self.game.profile_integration:
|
||||
self.game.profile_integration.set_setting("sound_enabled", self.game.audio)
|
||||
if not self.game.render_engine.audio:
|
||||
self.game.render_engine.stop_sound()
|
||||
|
||||
def toggle_pause(self):
|
||||
if getattr(self, "game_end", (False, None))[0]:
|
||||
if getattr(self.game, "game_end", (False, None))[0]:
|
||||
return
|
||||
|
||||
if self.game_status == "game":
|
||||
self.game_status = "paused"
|
||||
if self.game.state_machine.current_state == state_machine.GameState.PLAYING:
|
||||
self.game.state_machine.transition_to(state_machine.GameState.PAUSED)
|
||||
return
|
||||
|
||||
if self.game_status == "paused":
|
||||
self.game_status = "game"
|
||||
if self.game.state_machine.current_state == state_machine.GameState.PAUSED:
|
||||
self.game.state_machine.transition_to(state_machine.GameState.PLAYING)
|
||||
return
|
||||
|
||||
if self.game_status == "start_menu" and getattr(self, "menu_screen", None) == "start":
|
||||
self.reset_game()
|
||||
if self.game.state_machine.current_state == state_machine.GameState.START_MENU:
|
||||
self.game.reset_game()
|
||||
|
||||
def toggle_full_screen(self):
|
||||
self.full_screen = not self.full_screen
|
||||
self.render_engine.full_screen(self.full_screen)
|
||||
self.game.full_screen = not self.game.full_screen
|
||||
self.game.render_engine.full_screen(self.game.full_screen)
|
||||
|
||||
def quit_game(self):
|
||||
self.render_engine.close()
|
||||
self.game.render_engine.close()
|
||||
|
||||
def start_scrolling(self, direction):
|
||||
self.scrolling_direction = direction
|
||||
if not self.scrolling:
|
||||
self.scrolling = 1
|
||||
self.game.scrolling_direction = direction
|
||||
if not self.game.scrolling:
|
||||
self.game.scrolling = 1
|
||||
|
||||
def stop_scrolling(self):
|
||||
self.scrolling = 0
|
||||
self.game.scrolling = 0
|
||||
|
||||
def scroll(self):
|
||||
if self.scrolling:
|
||||
if not self.scrolling % 5:
|
||||
if self.scrolling_direction == "Up":
|
||||
self.scroll_cursor(y=-1)
|
||||
elif self.scrolling_direction == "Down":
|
||||
self.scroll_cursor(y=1)
|
||||
elif self.scrolling_direction == "Left":
|
||||
self.scroll_cursor(x=-1)
|
||||
elif self.scrolling_direction == "Right":
|
||||
self.scroll_cursor(x=1)
|
||||
self.scrolling += 1
|
||||
|
||||
if self.game.scrolling:
|
||||
if not self.game.scrolling % 5:
|
||||
if self.game.scrolling_direction == "Up":
|
||||
self.game.graphics.scroll_cursor(y=-1)
|
||||
elif self.game.scrolling_direction == "Down":
|
||||
self.game.graphics.scroll_cursor(y=1)
|
||||
elif self.game.scrolling_direction == "Left":
|
||||
self.game.graphics.scroll_cursor(x=-1)
|
||||
elif self.game.scrolling_direction == "Right":
|
||||
self.game.graphics.scroll_cursor(x=1)
|
||||
self.game.scrolling += 1
|
||||
|
||||
def axis_scroll(self, x, y):
|
||||
self.scroll_cursor(1 if x > 0 else -1, 1 if y > 0 else -1)
|
||||
self.game.graphics.scroll_cursor(1 if x > 0 else -1, 1 if y > 0 else -1)
|
||||
Reference in New Issue
Block a user