diff pytouhou/resource/loader.py @ 220:0595315d3880

Fix SHT handling; change a few things to be closer to ZUN’s mind; and first stub of PCB support.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sun, 18 Dec 2011 14:14:32 +0100
parents 2cad2e84a49e
children 5afc75f71fed
line wrap: on
line diff
--- a/pytouhou/resource/loader.py
+++ b/pytouhou/resource/loader.py
@@ -5,6 +5,7 @@ from pytouhou.formats.std import Stage
 from pytouhou.formats.ecl import ECL
 from pytouhou.formats.anm0 import Animations
 from pytouhou.formats.msg import MSG
+from pytouhou.formats.sht import SHT
 
 
 from pytouhou.resource.anmwrapper import AnmWrapper
@@ -44,6 +45,7 @@ class Loader(object):
         self.instanced_anms = {}
         self.instanced_stages = {}
         self.instanced_msgs = {}
+        self.instanced_shts = {}
 
 
     def scan_archives(self, paths):
@@ -93,6 +95,13 @@ class Loader(object):
         return self.instanced_msgs[name]
 
 
+    def get_sht(self, name):
+        if name not in self.instanced_shts:
+            file = self.get_file(name)
+            self.instanced_shts[name] = SHT.read(file) #TODO: modular
+        return self.instanced_shts[name]
+
+
     def get_anm_wrapper(self, names):
         return AnmWrapper(self.get_anm(name) for name in names)