# HG changeset patch # User Thibaut Girka # Date 1341864832 -7200 # Node ID b07e2f71f240ac21adae75997fca992cfc4ac4bd # Parent cb1460b9b6cf6ce62fb6ebf27d0921d8aca0221f Empty ECL stack when calling a callback. diff --git a/pytouhou/vm/eclrunner.py b/pytouhou/vm/eclrunner.py --- a/pytouhou/vm/eclrunner.py +++ b/pytouhou/vm/eclrunner.py @@ -142,7 +142,9 @@ class ECLRunner(object): self.stack = [] - def switch_to_sub(self, sub): + def switch_to_sub(self, sub, preserve_stack=False): + if not preserve_stack: + self.stack = [] self.running = True self.frame = 0 self.sub = sub @@ -407,7 +409,7 @@ class ECLRunner(object): list(self.variables), self.comparison_reg)) self.variables[0] = param1 self.variables[4] = param2 - self.switch_to_sub(sub) + self.switch_to_sub(sub, preserve_stack=True) @instruction(36)