コード例 #1
0
ファイル: BlockViewer.py プロジェクト: bonimy/SMB3-Foundry
    def on_paint(self, event):
        event.Skip()

        dc = wx.BufferedPaintDC(self)

        bg_color = get_bg_color_for(self.object_set, 0)
        dc.SetBackground(wx.Brush(wx.Colour(bg_color)))

        dc.Clear()

        pattern_table = PatternTable(self.object_set)
        palette = load_palette(self.object_set, 0)
        tsa_data = ROM.get_tsa_data(self.object_set)

        horizontal = self.sprites_horiz

        block_length = Block.WIDTH * self.zoom

        for i in range(self.sprites):
            block = Block(i, palette, pattern_table, tsa_data)

            x = (i % horizontal) * block_length
            y = (i // horizontal) * block_length

            block.draw(dc, x, y, block_length)

        return
コード例 #2
0
    def __init__(self, object_set, palette_index):
        wx.InitAllImageHandlers()
        png = wx.Image("data/gfx.png")

        rows_per_object_set = 256 // 64

        y_offset = 12 * rows_per_object_set * Block.HEIGHT

        self.png_data = png.GetSubImage(
            wx.Rect(0, y_offset, png.GetWidth(),
                    png.GetHeight() - y_offset))

        self.palette_group = load_palette(object_set, palette_index)
コード例 #3
0
ファイル: Level.py プロジェクト: bonimy/SMB3-Foundry
    def _draw_floor(self, dc, block_length):
        floor_level = 26
        floor_block_index = 86

        palette_group = load_palette(self.object_set_number,
                                     self._object_palette_index)
        pattern_table = PatternTable(self._graphic_set_index)
        tsa_data = ROM().get_tsa_data(self.object_set_number)

        floor_block = Block(floor_block_index, palette_group, pattern_table,
                            tsa_data)

        for x in range(self.width):
            floor_block.draw(dc, x * block_length, floor_level * block_length,
                             block_length)
コード例 #4
0
    def __init__(self, world_index):
        super(WorldMap, self).__init__(0, world_index, None)

        self.name = f"World {world_index} - Overworld"

        self.pattern_table = PatternTable(OVERWORLD_GRAPHIC_SET)
        self.palette_group = load_palette(OVERWORLD_OBJECT_SET, 0)

        start = ROM.W_LAYOUT_OS_LIST[world_index - 1]
        end = ROM.rom_data.find(0xFF, start)

        self.offset = start

        self.object_set = OVERWORLD_OBJECT_SET
        self.tsa_data = ROM.get_tsa_data(self.object_set)

        self.objects = []

        obj_data = ROM().bulk_read(end - start, start)

        self._load_objects(obj_data)

        self._calc_size()
コード例 #5
0
 def set_palette_group_index(self, palette_group_index):
     self.palette_group_index = palette_group_index
     self.palette_group = load_palette(self.object_set,
                                       self.palette_group_index)