28 lines
1.7 KiB
Python
28 lines
1.7 KiB
Python
"""Octo drakemount.m2 (Source256, converted with m2_equipment_convert --creature, cameras stripped) as a native
|
|
MD21/SFID/TXID model on the existing drakemount FDIDs. Adds $FD1 keyed t=1466 on anim 94 (slot 24) - the same
|
|
jaw-synced roar time as the installed native model (roar-sync 3aa0); Octo's anim 94 has the same $BTH at 5300.
|
|
Octo's Jump (38) is an alias of its wing-flap Swim (42 var 1), so the moving jump flaps as on Octo."""
|
|
import struct, sys
|
|
from pathlib import Path
|
|
H = Path(__file__).resolve().parent
|
|
sys.path.insert(0, '/mnt/Games/@project/wt-master-merge/ops')
|
|
from casc_asset_package import model_container
|
|
SKINS = [474429, 4059003, 4059005, 4059006] # native drakemount SFID, replaced by Octo views 0-3
|
|
TXID = [0, 0, 0, 234565] # skin types 13/12/11 from CDI, saddle explicit
|
|
FD1_T = 1466
|
|
body = bytearray((H / 'octo-drakemount.md20').read_bytes())
|
|
n, so = struct.unpack_from('<II', body, 0x1C)
|
|
slots = [i for i in range(n) if struct.unpack_from('<H', body, so + 64 * i)[0] == 94]; assert slots == [24], slots
|
|
ne, eo = struct.unpack_from('<II', body, 0x100)
|
|
assert not any(body[eo + 36 * k:eo + 36 * k + 4] == b'$FD1' for k in range(ne))
|
|
def pad(): body.extend(bytes((-len(body)) % 16))
|
|
pad(); key_at = len(body); body.extend(struct.pack('<I', FD1_T))
|
|
pad(); outer = len(body)
|
|
for i in range(n): body.extend(struct.pack('<II', 1, key_at) if i in slots else struct.pack('<II', 0, 0))
|
|
pad(); new_eo = len(body); body.extend(body[eo:eo + 36 * ne])
|
|
body.extend(b'$FD1' + struct.pack('<II', 0, 0) + bytes(12) + struct.pack('<hhII', 0, -1, n, outer))
|
|
struct.pack_into('<II', body, 0x100, ne + 1, new_eo)
|
|
m2 = model_container(bytes(body), SKINS, TXID)
|
|
(H / 'drakemount.m2').write_bytes(m2)
|
|
print('drakemount.m2', len(m2), 'events', ne + 1)
|