Skip to content

Commit 74cc45f

Browse files
committed
Feature: Dynamically apply the limit for ActionD params
1 parent 6817087 commit 74cc45f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

nml/actions/action6.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from nml import free_number_list, generic
1717
from nml.actions import base_action
1818

19-
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.")
19+
free_parameters = free_number_list.FreeNumberList(list(range(0, 0x80)), "No free parameters available to use for internal computations.", "No unique free parameters available for internal computations.")
2020

2121
def print_stats():
2222
"""

nml/ast/grf.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
with NML; if not, write to the Free Software Foundation, Inc.,
1414
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."""
1515

16-
from nml import expression, generic, grfstrings, global_constants
17-
from nml.actions import action8, action14
16+
from nml import expression, free_number_list, generic, grfstrings, global_constants
17+
from nml.actions import action6, action8, action14
1818
from nml.ast import base_statement
1919

2020
palette_node = None
@@ -23,9 +23,11 @@
2323
"""
2424
Statistics about registers used for parameters.
2525
The 1st field is the largest parameter register used.
26-
The 2nd field is the maximum amount of parameter registers available. This is where L{action6.free_parameters} begins.
26+
The 2nd field is the maximum amount of parameter registers available.
27+
After preprocessing the GRF block, the limit for L{action6.free_parameters} is set to
28+
the number of reserved params.
2729
"""
28-
param_stats = [0, 0x40]
30+
param_stats = [0, 0x80]
2931

3032
def print_stats():
3133
"""
@@ -132,6 +134,8 @@ def pre_process(self):
132134
raise generic.ScriptError("No free parameters available. Consider assigning <num> manually and combine multiple bool parameters into a single bitmask parameter using <bit>.", self.pos)
133135
if param_num > param_stats[0]:
134136
param_stats[0] = param_num
137+
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.")
138+
135139

136140
def debug_print(self, indentation):
137141
generic.print_dbg(indentation, 'GRF')

0 commit comments

Comments
 (0)