{% set typename = path[0] %}
{% set typenames = path[0] %}
{% set isobj = False %}
{% if path[0] == 'objs' %}
{% set typename = 'Object' %}
{% set typenames = 'Objects' %}
{% set isobj = True %}
{% elif path[0] == 'scenes' %}
{% set typename = 'Scene' %}
{% set typenames = 'Scenes' %}
{% endif %}
{% if not rec %}
{% if path|length > 1 %}
Item "{{ path[1] }}" at {{ typenames }} not found
{% else %}
Select {{ typename|lower }} from outline
{% endif %}
{% else %}
{{ typename }}{% if rec.idx in sim.dlg_idx %}
(dialog {{ rec.idx|fmt_dlg }}){% endif %}
Index: {{ rec.idx }} (0x{{ "%X" % rec.idx }})
Name: {{ rec.name }}
{% if tran %}
Name(t): {{ rec.name|_t('obj' if isobj else 'scn') }}
{% if rec.name in sim.names %}
Alias(t): {{ sim.names[rec.name]|_t('obj') }}
{% endif %}
{% if rec.name in sim.invntr %}
Invntr(t): {{ sim.invntr[rec.name]|_t('inv') }}
{% endif %}
{% else %}{# if tran #}
{% if rec.name in sim.names %}
Alias: {{ sim.names[rec.name] }}
{% endif %}
{% if rec.name in sim.invntr %}
Invntr: {{ sim.invntr[rec.name] }}
{% endif %}
{% endif %}{# if tran #}
{% if rec.cast %}
{% set r = rec.cast[0] %}{% set g = rec.cast[1] %}{% set b = rec.cast[2] %}
{% set colval = "#%02X%02X%02X" % (r, g, b) %}
{% set bg = 0 %}{% if (r + g * 2 + b) // 3 < 160 %}{% set bg = 255 %}{% endif %}
Cast: {{ colval }}
{% endif %}{# if rec.cast #}
{% if isobj %}{% set scncnt = [] %}
{% for scn in sim.scenes %}
{% for ref in scn.refs %}
{% if ref[0].idx == rec.idx and not scncnt %}
Refered by scenes:
{{ scn.idx|fmt_scene(True) }}{% do scncnt.append(1) %}
{% endif %}
{% endfor %}{# for ref #}
{% endfor %}{# for scn #}
{% else %}{# isobj #}{% if rec.refs is none %}No references
{% elif rec.refs|length == 0 %}Empty references
{% else %}
References: {{ rec.refs|length }}
{% set fmtd = rec.refs|length|fmt_dec %}
{% for ref in rec.refs %}
{{ fmtd.format(loop.index) }}) {{ ref[0].idx|fmt_obj }}{% for arg in ref[1:] %} {{ arg|fmt_num32 }}{% endfor %}
{% endfor %}{# for ref #}
{% endif %}
{% endif %}{# isobj #}
{% set resused = [] %}
{% set dlgused = [] %}
{% if rec.idx in sim.dlg_idx %}
{% do dlgused.append(rec.idx) %}{% endif %}
Handlers: {{ rec.acts|length }}
{% set fmtra = rec.acts|length|fmt_dec %}
{% for act in rec.acts %}
{% set cmt = ''%}
{% set msg = act.act_op|fmt_opcode %}
{% if act.act_status != 255 or act.act_ref != 65535 %}
{% set msg = msg + ' 0x%02X' % act.act_status %}
{% if act.act_ref == rec.idx %}
{% set msg = msg + ' THIS' %}
{% else %}{# act.act_ref == rec.idx #}
{% if act.act_ref in sim.obj_idx %}
{% set msg = msg + ' ' + act.act_ref|fmt_obj %}
{% set cmt = ' // ' + act.act_ref|fmt_obj(True) %}
{% else %}{# act.act_ref in sim.obj_idx #}
{% set msg = msg + ' 0x%X' % act.act_ref %}
{% endif %}{# act.act_ref in sim.obj_idx #}
{% endif %}{# act.act_ref == rec.idx #}
{% endif %}{# act.act_status != 255 or act.act_ref != 65535 #}
{{ fmtra.format(loop.index - 1) }}) on {{ msg }}, ops: {{ act.ops|length }}{{ cmt|fmt_cmt }}
{% set fmtao = act.ops|length|fmt_dec %}
{% for op in act.ops %}
{{ fmtao.format(loop.index - 1)|fmt_cmt }}) {{ op.op_code|fmt_opcode }}{% set cmt = '' %}
{% if op.op_ref == rec.idx %} THIS{% else %} {{ op.op_ref|fmt_obj_scene }}{% set cmt = ' // ' + op.op_ref|fmt_obj_scene(True) %}{% endif %}
{% if op.op_arg1 != 65535 and op.op_arg1 not in resused and op.op_arg1 in sim.res %}
{% do resused.append(op.op_arg1) %}
{% endif %}
{{ op.op_arg1|fmt_num16 }} {{ op.op_arg2|fmt_num16 }} {{ op.op_arg3|fmt_num16 }}{{ cmt|fmt_cmt }}{% if op.op_code == 17 and op.op_ref not in dlgused %}
{% do dlgused.append(op.op_ref) %}
{% endif %}
{% endfor %}
{% endfor %}
{% if resused %}
Used resources: {{ resused|length }}
{% for res_id in resused %}
{{ res_id|fmt_res(True) }}
{% endfor %}
{% endif %}{# if resused #}
{% if dlgused %}
Used dialog groups: {{ dlgused|length }}
{% for grp_id in dlgused %}
{{ grp_id|fmt_dlg(True) }}
{% endfor %}
{% endif %}{# if resused #}
{% if isobj %}{% set wasmsg = [] %}
{% for msg in sim.msgs %}
{% if msg.obj.idx == rec.idx %}
{% if not wasmsg %}
Messages
{% do wasmsg.append(1) %}
{% endif %}
{{ msg.idx|fmt_msg(True) }}
{% endif %}
{% endfor %}{# msg in sim.msgs #}
{% endif %}{# isobj #}
{% set oplst = {} %}
{% for obj2 in sim.objects + sim.scenes if obj2.idx != rec.idx %}
{% for act in obj2.acts %}
{% set actidx = loop.index - 1 %}
{% set wasop = [] %}
{% for op in act.ops if op.op_ref == rec.idx %}
{% if not wasop %}
{% set arr = oplst.get(op.op_code, []) %}
{% do arr.append((obj2.idx, act.act_op, actidx)) %}
{% do oplst.update([(op.op_code, arr,)]) %}
{% do wasop.append(1) %}
{% endif %}
{% endfor %}{# ops #}
{% endfor %}{# acts #}
{% endfor %}{# obj+scenes #}
{% set klst = OPCODES.keys()|list %}
{% do klst.sort() %}
{% for k in klst if k in oplst %}
Used in {{ k|fmt_opcode }}:
{% for oid, htp, hid in oplst[k] %}
{{ oid|fmt_obj_scene }} on {{ htp|fmt_opcode }} #{{ '%d' % hid }} {{ ('// ' + oid|fmt_obj_scene(True))|fmt_cmt }}
{% endfor %}{# oplst[k] #}
{% endfor %}{# klist #}
{% if not isobj and rec.persp %}
Perspective:
{{ ' {}, {}, {}, {}, {}'.format(*rec.persp) }}
{% endif %}
{% if not isobj and rec.entareas %}
Enter areas: {{ rec.entareas|length }}
{% for sf, oo in rec.entareas %}
from: {{ sf.idx|fmt_scene(True) }}
on: {{ oo.idx|fmt_obj(True) }}
{% endfor %}{# entareas #}
{% endif %}
{% endif %}{# if rec #}