Files
@ 9723a5ab27d6
Branch filter:
Location: light9/light8/sub_analyzer.py - annotation
9723a5ab27d6
3.7 KiB
text/x-python
fight coffeescript on how to get ctor called
Ignore-this: b74e7e5547fb234716862e5dfa4e2885
Ignore-this: b74e7e5547fb234716862e5dfa4e2885
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | a995fd1a8f03 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 174b35926067 174b35926067 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 174b35926067 174b35926067 174b35926067 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 45b12307c695 | #!/usr/bin/python
from Subs import *
from Patch import *
from types import TupleType
from Config import patch, subs
import re
import Patch
Patch.reload_data(0)
subusage = {}
# colors = 'ROGBVndcihs'
colors = 'ndcihs'
color_chart = {
'1-01' : 'ROYd', # broadway (morning - afternoon)
'1-02' : 'i', # int. mission
'1-03' : 'R', # phone booth
'1-04' : 'RBVh', # hotbox
'1-05' : 'RBd', # off broadway
'1-06' : 'ROYd', # ext. mission
'1-07' : 'ROYn', # gambler intro, off broadway
'1-08' : 'ROBIVc', # havana, clubs
'1-09' : 'ROYBIVc', # havana, outside, night
'1-10' : 'BVn', # ext. mission, night (4am)
'2-01' : 'RBIVh', # hotbox
'2-02' : 'RBn', # more can i wish you
'2-03' : 'GBs', # sewer (crap game)
'2-04' : 'Bn', # sue me
'2-05' : 'i', # int. mission
'2-06' : '', # marry
'2-07' : 'd', # broadway finale
}
scene_names = {
'1-01' : 'broadway (morning to afternoon)',
'1-02' : 'int. mission',
'1-03' : 'phone booth',
'1-04' : 'hotbox',
'1-05' : 'guys and dolls (off broadway)',
'1-06' : 'ext. mission, lunch time',
'1-07' : 'gambler intro, off broadway',
'1-08' : 'havana, clubs',
'1-09' : 'havana, outside, night',
'1-10' : 'ext. mission, night (4am)',
'2-01' : 'hotbox',
'2-02' : 'more can i wish you',
'2-03' : 'sewer (crap game)',
'2-04' : 'sue me',
'2-05' : 'rock the boat (int. mission)',
'2-06' : 'marry (trav)',
'2-07' : 'finale (broadway)',
}
sub_to_scene = {}
# blacklist is a list of *prefixes* to light names that won't be shown
blacklist = 'god upfill red blue cyc oran sidefill'.split()
blacklist.extend(['side l','side r'])
for subname, levdict in subs.items():
if type(subname) == TupleType:
subname = subname[0]
oldname = subname
subname = re.sub(r'\*(\d-\d+)-.*', r'\1', subname)
if oldname == subname: continue
sub_to_scene[oldname] = subname
subname = oldname # restore 'em. restore 'em good.
if not levdict:
print "Warning: %s is useless (empty sub)." % subname
else:
for ch, lev in levdict.items():
if lev:
ch = resolve_name(ch)
subusage.setdefault(ch, [])
subusage[ch].append((lev, subname))
def twist(l):
return [(b,a) for a,b in l]
def format_usage(ch, usage):
if max([ch.startswith(pre) for pre in blacklist]):
return
usage=twist(usage)
usage.sort()
# usage.reverse()
usage=twist(usage)
print "======= %s ======= (%d uses)" % (ch, len(usage))
if 1:
use_str = ''
for lev, sub in usage:
if lev>30:
if sub_to_scene[sub] in color_chart:
subcolors = color_chart[sub_to_scene[sub]]
col_str = ''
for c in colors:
if c in subcolors: col_str += c
else: col_str += ' '
print col_str,
else:
print ' ' * len(colors),
scenename = scene_names.get(sub_to_scene[sub], '')
levbar="*"*(lev//5)
print ' %3d %-20s\t%-30s %s' % (lev, levbar,sub, scenename)
else:
use_str = '\n '.join(["%d\t%s" % (lev, sub) for lev, sub in usage])
print ' ' + use_str
subitems = subusage.items()
subitems.sort()
for ch, usage in subitems:
if 0:
usedict = {}
for lev, subname in usage: # remove duplicates
usedict[subname] = max(lev, usedict.get(subname, 0))
newusage = [(lev, sub) for sub, lev in usedict.items()]
format_usage(ch, newusage)
else:
format_usage(ch, usage)
|