From 4617baa37c8178ae64dca58b948a13643fd9e86b Mon Sep 17 00:00:00 2001 From: "Johannes E. Krause" Date: Wed, 20 May 2020 15:50:27 +0200 Subject: [PATCH] Feature: Dynamically apply the limit for ActionD params --- nml/actions/action6.py | 4 ++-- nml/ast/grf.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/nml/actions/action6.py b/nml/actions/action6.py index 318f39ed..581a325f 100644 --- a/nml/actions/action6.py +++ b/nml/actions/action6.py @@ -13,10 +13,10 @@ with NML; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.""" -from nml import free_number_list, generic +from nml import generic from nml.actions import base_action -free_parameters = free_number_list.FreeNumberList(list(range(0x40, 0x80)), "No free parameters available to use for internal computations.", "No unique free parameters available for internal computations.") +free_parameters = None def print_stats(): """ diff --git a/nml/ast/grf.py b/nml/ast/grf.py index 2cdc41de..5452e82e 100644 --- a/nml/ast/grf.py +++ b/nml/ast/grf.py @@ -13,8 +13,8 @@ with NML; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.""" -from nml import expression, generic, grfstrings, global_constants -from nml.actions import action8, action14 +from nml import expression, free_number_list, generic, grfstrings, global_constants +from nml.actions import action6, action8, action14 from nml.ast import base_statement palette_node = None @@ -25,7 +25,7 @@ The 1st field is the largest parameter register used. The 2nd field is the maximum amount of parameter registers available. This is where L{action6.free_parameters} begins. """ -param_stats = [0, 0x40] +param_stats = [0, 0x80] def print_stats(): """ @@ -132,6 +132,8 @@ def pre_process(self): raise generic.ScriptError("No free parameters available. Consider assigning manually and combine multiple bool parameters into a single bitmask parameter using .", self.pos) if param_num > param_stats[0]: param_stats[0] = param_num + action6.free_parameters = free_number_list.FreeNumberList(list(range(param_stats[0], 0x80)), "No free parameters available to use for internal computations.", "No unique free parameters available for internal computations.") + def debug_print(self, indentation): generic.print_dbg(indentation, 'GRF')