Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Dynamically apply the limit for ActionD params #149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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