Update charts implementation
@@ -7,6 +7,7 @@ from fs_helpers import *
class ChartList:
def __init__(self, file_entry):
self.file_entry = file_entry
+ self.file_entry.decompress_data_if_necessary()
data = self.file_entry.data
self.num_charts = read_u32(data, 0)
@@ -26,13 +27,13 @@ class Chart:
data = self.file_entry.data
self.offset = offset
- self.index_plus_1 = read_u8(data, self.offset)
+ self.texture_id = read_u8(data, self.offset)
self.owned_chart_index_plus_1 = read_u8(data, self.offset+1)
self.number = read_u8(data, self.offset+2)
self.type = read_u8(data, self.offset+3)
- self.sector_x = read_u8(data, self.offset+4)
- self.sector_y = read_u8(data, self.offset+5)
+ self.sector_x = read_s8(data, self.offset+4)
+ self.sector_y = read_s8(data, self.offset+5)
offset = self.offset + 6
self.possible_random_positions = []
@@ -44,13 +45,13 @@ class Chart:
def save_changes(self):
data = self.file_entry.data
- write_u8(data, self.offset, self.index_plus_1)
+ write_u8(data, self.offset, self.texture_id)
write_u8(data, self.offset+1, self.owned_chart_index_plus_1)
write_u8(data, self.offset+2, self.number)
write_u8(data, self.offset+3, self.type)
- write_u8(data, self.offset+4, self.sector_x)
- write_u8(data, self.offset+5, self.sector_y)
+ write_s8(data, self.offset+4, self.sector_x)
+ write_s8(data, self.offset+5, self.sector_y)
for possible_pos in self.possible_random_positions:
possible_pos.save_changes()
