Skip to content

Commit

Permalink
Support UserStatements with blocks in order to support the layeredima…
Browse files Browse the repository at this point in the history
…ge statement
  • Loading branch information
CensoredUsername committed Dec 31, 2018
1 parent 53d6ff1 commit 65a43d2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions decompiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@ def print_init(self, ast):
(ast.priority == -500 + self.init_offset and isinstance(ast.block[0], renpy.ast.Screen)) or
(ast.priority == self.init_offset and isinstance(ast.block[0], renpy.ast.Style)) or
(ast.priority == 500 + self.init_offset and isinstance(ast.block[0], renpy.ast.Testcase)) or
(ast.priority == 0 + self.init_offset and isinstance(ast.block[0], renpy.ast.UserStatement) and ast.block[0].line.startswith("layeredimage ")) or
# Images had their default init priority changed in commit 679f9e31 (Ren'Py 6.99.10).
# We don't have any way of detecting this commit, though. The closest one we can
# detect is 356c6e34 (Ren'Py 6.99). For any versions in between these, we'll emit
Expand Down Expand Up @@ -724,6 +725,19 @@ def print_userstatement(self, ast):
self.indent()
self.write(ast.line)

if hasattr(ast, "block") and ast.block:
with self.increase_indent():
self.print_lex(ast.block)

def print_lex(self, lex):
for file, linenumber, content, block in lex:
self.advance_to_line(linenumber)
self.indent()
self.write(content)
if block:
with self.increase_indent():
self.print_lex(block)

@dispatch(renpy.ast.Style)
def print_style(self, ast):
self.require_init()
Expand Down

0 comments on commit 65a43d2

Please sign in to comment.