papermario/tools/splat/util/palettes.py
Ethan Roseman 73af4eb5a0
Tables & Chairs (sorry no chairs actually) (#800)
* git subrepo pull --force tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "ec7bd4868e"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "ec7bd4868e"
git-subrepo:
  version:  "0.4.3"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "2f68596"

* wips

* more

* wipperz

* it workz

* mdl_make_local_vertex_copy

* sleep_bubble finished + gfx

* fire_breath gfx

* func_800F0490

* func_800EFE2C

* 8a860 funcs

* cleanup + dead cod

* dead clean

* git subrepo pull --force tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "a1730f38ad"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "a1730f38ad"
git-subrepo:
  version:  "0.4.5"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "aa416e4"

* cleanup + splat prep

* git subrepo pull --force tools/splat

subrepo:
  subdir:   "tools/splat"
  merged:   "4e5fca24a5"
upstream:
  origin:   "https://github.com/ethteck/splat.git"
  branch:   "master"
  commit:   "4e5fca24a5"
git-subrepo:
  version:  "0.4.5"
  origin:   "https://github.com/ingydotnet/git-subrepo"
  commit:   "aa416e4"

* bits

* clean

* bss c -> asm

* btl_update_starpoints_display

* is_debug + cleanup

* load_script / 190B20 data

* all the symz

* clean

* cleanup + stuff
2022-10-04 23:09:23 +09:00

33 lines
1.1 KiB
Python

from typing import Dict
from segtypes.n64.ci import N64SegCi
from segtypes.n64.palette import N64SegPalette as Palette
from segtypes.common.group import CommonSegGroup
# Resolve Raster#palette and Palette#raster links
def initialize(all_segments):
def process(segments):
raster_map: Dict[str, N64SegCi] = {}
palette_map: Dict[str, Palette] = {}
for segment in segments:
if isinstance(segment, Palette):
palette_map[segment.name] = segment
if isinstance(segment, N64SegCi):
raster_map[segment.name] = segment
if isinstance(segment, CommonSegGroup):
process(segment.subsegments)
for raster_name in raster_map:
raster = raster_map[raster_name]
# print(f"{raster_name} -> {raster.palette_name}")
raster.palette = palette_map.get(raster.palette_name)
for palette_name in palette_map:
palette = palette_map[palette_name]
# print(f"{palette_name} -> {palette.raster_name}")
palette.raster = raster_map.get(palette.raster_name)
process(all_segments)