Return to repo list

heart-of-gold

Tactical RPG written in python, using pygame.
Return to HMagellan.com

commit 61dfc70d41c72141b7f57337659a775afd21d2f4
parent 33a4d188fa0c0f5331fa6da82b6beb6496d928f6
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Sun, 31 Jan 2021 17:02:34 -0600

framework for npc convo at base

Diffstat:
Adata/json/npc/dialogs/jisella.json | 13+++++++++++++
Msrc/base.py | 15+++++++++++++++
Msrc/bus.py | 2++
Msrc/constants.py | 2+-
Msrc/scene.py | 7+++++++
5 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/data/json/npc/dialogs/jisella.json b/data/json/npc/dialogs/jisella.json @@ -0,0 +1,13 @@ +{ + "dia0" : { + "speaker" : "Jisella", + "name_font" : "A", + "name_pos" : [20, 480], + "line_font" : "A", + "voice" : "Voice2", + "portrait" : "jisella_actor_portrait", + "min_es" : 0, + "max_es" : 10, + "line" : "Test dialog 1" + } +} diff --git a/src/base.py b/src/base.py @@ -32,12 +32,27 @@ class BaseManager(manager.Manager): self.base_entities = pygame.sprite.LayeredDirty() self.tile_cursor = None + # Event stages + self.current_event_stage = 0 + def load_base_from_file(self, filename): """ Load the base from a given definition JSON. """ pass + def play_base_dialog(self, scenefile = None, definition = None): + """ + Play through a dialog in the base. If no + scenefile is provided, construct a dialog + definition from the provided definition. + """ + self.game.control_mode = CTRL_MODES.Base_Dialog + if scenefile != None: + self.bus.perform_scene_manager_load_scene_from_file(scenefile) + elif definition != None: + self.bus.perform_scene_manager_load_scene_from_def(definition) + def load_ui_elements(self): """ Load the UI elemenst of the BaseManager. diff --git a/src/bus.py b/src/bus.py @@ -123,6 +123,8 @@ class ManagerBus(subsystem.GameSubsystem): self.game.base_manager.position_tile_cursor(tile_pos) def perform_scene_manager_load_scene_from_file(self, scenefile): 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_display_move_range_of_piece(self, piece): diff --git a/src/constants.py b/src/constants.py @@ -89,7 +89,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 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_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') SCENE_EFFECTS = enum.Enum('SCENE_EFFECTS', 'ef_scene_dummy ef_scene_delay ef_scene_fade ef_scene_scroll_camera ef_scene_snap_camera ef_scene_spawn_piece') diff --git a/src/scene.py b/src/scene.py @@ -40,6 +40,13 @@ class SceneManager(manager.Manager): self.current_scene = StillScene(self, scenefile) self.current_scene.cycle_script_segment() + def load_still_scene_from_def(self, definition): + """ + Load a still scene from a provided dict + definition rather than a json file. + """ + pass + def effect_extension(self, effect): """ SceneManager-only effects for trigger_effects.