Skip to content

Commit

Permalink
Feature: Dynamically apply the limit for ActionD params
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddi-z committed May 20, 2020
1 parent 6817087 commit 74cc45f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nml/actions/action6.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from nml import free_number_list, 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 = 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.")

def print_stats():
"""
Expand Down
12 changes: 8 additions & 4 deletions nml/ast/grf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,9 +23,11 @@
"""
Statistics about registers used for parameters.
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.
The 2nd field is the maximum amount of parameter registers available.
After preprocessing the GRF block, the limit for L{action6.free_parameters} is set to
the number of reserved params.
"""
param_stats = [0, 0x40]
param_stats = [0, 0x80]

def print_stats():
"""
Expand Down Expand Up @@ -132,6 +134,8 @@ def pre_process(self):
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)
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')
Expand Down

0 comments on commit 74cc45f

Please sign in to comment.