Skip to content

Commit

Permalink
Process some changes regarding handling of items that default to stri…
Browse files Browse the repository at this point in the history
…ngs in ren'py.
  • Loading branch information
CensoredUsername committed Feb 21, 2024
1 parent ed4e330 commit ab65d9f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions decompiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ def print_imspec(self, imspec):
if len(imspec[6]) > 0:
words.append("behind %s" % ', '.join(imspec[6]))

# todo: this check probably doesn't work in ren'py 8
if isinstance(imspec[4], str):
words.append("onlayer %s" % imspec[4])

Expand Down Expand Up @@ -225,7 +224,6 @@ def print_scene(self, ast):
self.write("scene")

if ast.imspec is None:
# todo: this check probably doesn't work in ren'py 8
if isinstance(ast.layer, str):
self.write(" onlayer %s" % ast.layer)
needs_space = True
Expand Down Expand Up @@ -383,9 +381,9 @@ def print_if(self, ast):
statement = First("if %s:", "elif %s:")

for i, (condition, block) in enumerate(ast.entries):
# The non-Unicode string "True" is the condition for else:.
# todo: this probably isn't true anymore for 8.0/7.5 and upwards.
if (i + 1) == len(ast.entries) and not isinstance(condition, str):
# The unicode string "True" is used as the condition for else:.
# But if it's an actual expression, it's a renpy.ast.PyExpr
if (i + 1) == len(ast.entries) and not isinstance(condition, renpy.ast.PyExpr):
self.indent()
self.write("else:")
else:
Expand Down Expand Up @@ -524,8 +522,8 @@ def print_menu_item(self, label, condition, block, arguments):
self.write(reconstruct_arginfo(arguments))

if block is not None:
# todo: this check probably doesn't work in ren'py 8
if isinstance(condition, str):
# ren'py uses the unicode string "True" as condition when there isn't one.
if isinstance(condition, renpy.ast.PyExpr):
self.write(" if %s" % condition)
self.write(":")
self.print_nodes(block, 1)
Expand Down

0 comments on commit ab65d9f

Please sign in to comment.