Return to repo list

heart-of-gold

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

commit 93d32d1bc2c00bdaebc00854de7b3d034f2e92ef
parent 3b35871ce323da07978b1ff6d4561ff16215fa75
Author: Erik Letson <hmagellan@hmagellan.com>
Date:   Mon, 10 May 2021 17:19:59 -0500

some very minor work on save system

Diffstat:
Msrc/constants.py | 4++--
Msrc/subsystem.py | 4+++-
Msrc/turn.py | 2++
3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/constants.py b/src/constants.py @@ -40,7 +40,7 @@ JSON_PATH = os.path.join(DATA_PATH, "json") MENU_JSON_PATH = os.path.join(JSON_PATH, "menus") SCENE_JSON_PATH = os.path.join(JSON_PATH, "scenes") ACTORS_PATH = os.path.join(IMAGE_PATH, "actors") -SAVE_PATH = os.path.join(str(pathlib.Path.home), ".local", "HoG", "Savegames") +SAVE_PATH = os.path.join(str(pathlib.Path.home), ".local", "share", "heart-of-gold", "savegames") # Piece constants with open(os.path.join(JSON_PATH, "pieces.json")) as f: CHARBASE = json.load(f) @@ -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_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 Battle_Summary Still_Scene_Normal') +CTRL_MODES = enum.Enum('CTRL_MODES', 'No_Control Main_Menu_Normal Base_Normal Base_Dialog Base_Pause Base_Pause_Save Base_Pause_Load Turn_Normal Turn_Pause 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 Battle_Summary 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/subsystem.py b/src/subsystem.py @@ -1,4 +1,4 @@ -import pygame, os, json +import pygame, os, json, pathlib from .constants import * ################ @@ -81,6 +81,8 @@ class SaveSystem(GameSubsystem): self.active_save_env = {} def save_to_file(self, filename): + # TODO: Check if it exists and prompt to overwrite (maybe in a another object???) + # TODO: Make cross-platform compatible with open(os.path.join(SAVE_PATH, filename)) as sf: json.dump(self.active_save_env, sf) def load_from_file(self, filename): diff --git a/src/turn.py b/src/turn.py @@ -685,6 +685,8 @@ class SkillActionButton(ActionButton): """ SkillButton-specific activation effects. """ + # NOTE: In this button's case, the display will result as a consequence of the control + # mode change in the turn manager update method. self.manager.camera.snap_to_position(self.manager.current_active_piece.rect.center) class ItemActionButton(ActionButton):