Skip to content

Commit

Permalink
ok its not worth doing this
Browse files Browse the repository at this point in the history
  • Loading branch information
Lilaa3 committed Jan 21, 2024
1 parent e589273 commit 5a9f64d
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions fast64_internal/sm64/animation/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class SM64_AnimPair:
values: list[int] = dataclasses.field(default_factory=list)

# Used during merging
values_index: int | None = None
offset: int | None = None

def clean_frames(self):
Expand Down Expand Up @@ -242,36 +241,36 @@ def find_offset(unconnected_value_table: list[SM64_AnimPair], pair: SM64_AnimPai
offset = None
for values in unconnected_value_table:
for i, j in zip(pair.values[0 : len(values)], values[0 : len(pair.values)]):
offset = added_index.offset
offset = pair.offset
if abs(i - j) > 1:
offset = None
break
if len(values) < len(pair.values):
values.extend(pair.values[len(pair.values) - 1 :])
return offset

print("Merging values and creating tables.")

value_table, indices_table, unconnected_value_table = (
value_table, indices_table, added_indices = (
SM64_ShortArray(self.valuesReference, True),
SM64_ShortArray(self.indicesReference, False),
[],
)

# Here is what has to happen
# We need to have way to coheralate pairs with unconnected values and be able to change what
# unconnected value one connects to and its offset into it
# We need to be able to add onto unconnected values as to merge every time its possible
# We may even want to merge multiple times to compress stuff down further
# AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
for pair in self.pairs:
if len(pair.values) > MAX_U16:
max_frame = len(pair.values)
if max_frame > MAX_U16:
raise PluginError("Index pair has too many frames.")
pair.clean_frames()

unconnected_value_table.append(pair.values)
pair.clean_frames()
pairValues: list[int] = pair.values[0:max_frame]
existing_offset = find_offset(added_indices, pairValues)
if existing_offset is None:
offset: int = len(value_table.data)
pair.offset = offset
value_table.data.extend(pairValues)
added_indices.append(pair)
else:
offset: int = existing_offset

for pair in self.pairs:
indices_table.data.extend([len(pair.values), offset])

return value_table, indices_table
Expand Down

0 comments on commit 5a9f64d

Please sign in to comment.