From a0d4981e4f5e1cc03506324a602cf4468b6eee90 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Thu, 28 Jul 2022 10:07:12 -0300 Subject: Add bare support to RenPy 8 --- game/01_init.rpy | 14 ++++++++++---- game/03_init.rpy | 6 +++--- game/gui/battle.rpy | 10 +++++----- game/misc.rpy | 3 ++- game/options.rpy | 2 ++ 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/game/01_init.rpy b/game/01_init.rpy index bcc8052..0b6eb48 100644 --- a/game/01_init.rpy +++ b/game/01_init.rpy @@ -30,8 +30,14 @@ init -3 python: # Ren'Py should come with Python 2.7.10 (2710), but just in case # After all, I only tested with 2.7.10, 2.7.13 and 2.7.15 - if (PYTHON_VERSION < 2700 or PYTHON_VERSION > 3000): - raise Exception("WARNING: Python version is not 2.7\nStrange bugs may happen on your client.\n\nClick on \"Ignore\" to continue.\nClick on \"Quit\" to exit.") + print(PYTHON_VERSION) + if (PYTHON_VERSION < 2700): + raise Exception("WARNING: Python version is too old\nStrange bugs may happen on your client.\n\nClick on \"Ignore\" to continue.\nClick on \"Quit\" to exit.") + # From Python 3.6.x up to Python 3.9.x supported + elif (PYTHON_VERSION > 3600 and PYTHON_VERSION < 4000): + pass + else: + raise Exception("WARNING: Python version is too recent\nStrange bugs may happen on your client.\n\nClick on \"Ignore\" to continue.\nClick on \"Quit\" to exit.") # Configuration config.autoreload = False @@ -286,7 +292,7 @@ init -3 python: #page.close() return surf - except Exception, e: + except Exception as e: if renpy.config.missing_image_callback: im = renpy.config.missing_image_callback(self.loc) if im is None: @@ -357,7 +363,7 @@ init -3 python: ver=int(x.text) except: stdout("IMPOSSIBLE TO DETERMINE VERSION") - raise Exception("Could not estabilish a connection to update server:\n%s is not valid." % x.text) # TODO: Show this beautifully? + raise Exception("Could not estabilish a connection to update server:\n%s is not valid." % repr(x.text)) # TODO: Show this beautifully? # TODO: Should we set a "ver"? if (int(persistent.version) < ver): diff --git a/game/03_init.rpy b/game/03_init.rpy index 8398f78..b6e4e8d 100644 --- a/game/03_init.rpy +++ b/game/03_init.rpy @@ -144,7 +144,7 @@ init python: print("ERROR: Not a regular display name") return name - # Loads a sound called VAL + # Loads a sound called VAL (FIXME) def get_sfx(val, ext=".mp3"): # Search for the sound show_img(val, False, ext=ext) @@ -328,7 +328,7 @@ init python: else: addr="extra/%s%s" % (img.replace(" ", "_"), ext) - f=open(get_path(addr), "w") + f=open(get_path(addr), "wb") stdout("Downloading additional file: %s" % img.replace(" ", "_")) try: x=requests.get("%s://%s/assets/%s?token=%s" % (ifte(persistent.ssl_enabled, "https", "http"), HOST, img.replace(" ", "_"), get_token()), verify=False) # , timeout=8.0 → Need to handle sudden death @@ -369,7 +369,7 @@ init python: # Image exists, but wasn't loaded yet if (path != ERR_INVALID and path is not None): - print("Detected not loaded image") + print("Detected not loaded image: %s" % path[0]) # Valid Image Extensions: PNG, JPG, JPEG, GIF, WEBP if ext in [".png", ".jpg", ".jpeg", ".gif", ".webp"]: # Maybe it is an unit diff --git a/game/gui/battle.rpy b/game/gui/battle.rpy index 7579dce..d92a38a 100644 --- a/game/gui/battle.rpy +++ b/game/gui/battle.rpy @@ -65,7 +65,7 @@ init python: # FIXME: Allow to drag spheres around def c_swap(idx): global csid - if csid is None: + if csid == None: csid = copy.copy(idx) return o1 = copy.copy(Battle["spheres"][csid]) @@ -176,7 +176,7 @@ screen battle_core(): selected_idle ("gfx/sphere/s/"+str(Battle["spheres"][0])+".png") hover ("gfx/sphere/"+str(Battle["spheres"][0])+".png") selected_hover ("gfx/sphere/s/"+str(Battle["spheres"][0])+".png") - selected csid is 0 + selected csid == 0 action Function(c_swap, 0) keysym "alt_1" xpos 0.125 @@ -225,7 +225,7 @@ screen battle_core(): selected_idle ("gfx/sphere/s/"+str(Battle["spheres"][1])+".png") hover ("gfx/sphere/"+str(Battle["spheres"][1])+".png") selected_hover ("gfx/sphere/s/"+str(Battle["spheres"][1])+".png") - selected csid is 1 + selected csid == 1 action Function(c_swap, 1) keysym "alt_2" xpos 0.375 @@ -274,7 +274,7 @@ screen battle_core(): selected_idle ("gfx/sphere/s/"+str(Battle["spheres"][2])+".png") hover ("gfx/sphere/"+str(Battle["spheres"][2])+".png") selected_hover ("gfx/sphere/s/"+str(Battle["spheres"][2])+".png") - selected csid is 2 + selected csid == 2 action Function(c_swap, 2) keysym "alt_3" xpos 0.625 @@ -323,7 +323,7 @@ screen battle_core(): selected_idle ("gfx/sphere/s/"+str(Battle["spheres"][3])+".png") hover ("gfx/sphere/"+str(Battle["spheres"][3])+".png") selected_hover ("gfx/sphere/s/"+str(Battle["spheres"][3])+".png") - selected csid is 3 + selected csid == 3 action Function(c_swap, 3) keysym "alt_4" xpos 0.875 diff --git a/game/misc.rpy b/game/misc.rpy index 5dc1e6a..3de3cf4 100644 --- a/game/misc.rpy +++ b/game/misc.rpy @@ -266,7 +266,8 @@ init python: try: show_img(c[0], False) except: - print("Unable to load %s" % c) + print("Unable to load %s" % str(c)) + traceback.print_exc() print("Loaded %d images in %d seconds." % (len(persistent.allfiles), now() - t)) label add_server: diff --git a/game/options.rpy b/game/options.rpy index ebc2048..01403a2 100644 --- a/game/options.rpy +++ b/game/options.rpy @@ -261,3 +261,5 @@ init python: define build.include_update = True +define config.allow_underfull_grids = True + -- cgit v1.2.3-60-g2f50