This commit is contained in:
sup39 2022-09-02 23:42:02 +09:00
parent 2ae48aafda
commit 6a425e2e2c

View file

@ -220,6 +220,7 @@ class WFCWidget(QWidget):
pos = d.read_struct(('gpMarioOriginal', 0x10), '>3f') pos = d.read_struct(('gpMarioOriginal', 0x10), '>3f')
if pos is None: return if pos is None: return
pos = array(pos) pos = array(pos)
pos[1] -= 0
x, y, z = pos x, y, z = pos
# get collision data (static collision) # get collision data (static collision)
colInfo = d.read_struct(('gpMap', 0x10, 0), '>ffI4x4xII') colInfo = d.read_struct(('gpMap', 0x10, 0), '>ffI4x4xII')
@ -283,7 +284,7 @@ class WFCWidget(QWidget):
# ax # ax
xzAngle = self.xzAngle xzAngle = self.xzAngle
for ax, (pn, axes) in zip(self.mcv.axs, [ for ax, (pn, axes) in zip(self.mcv.axs, [
((0, 1, 0), [0, 2]), ((0, 1, 0), [2, 0]), # TODO
(pnXZ, axesXZ), (pnXZ, axesXZ),
]): ]):
ax.patches.clear() ax.patches.clear()
@ -291,14 +292,17 @@ class WFCWidget(QWidget):
make_geo_plot(ax, hitboxs, pos, pn, axes) make_geo_plot(ax, hitboxs, pos, pn, axes)
if self.showMario: if self.showMario:
ax.add_patch(patches.Circle(pos[axes], 25, fc='red')) ax.add_patch(patches.Circle(pos[axes], 25, fc='red'))
if self.trackMario: for a, i in zip('xy', axes):
offs = [(-1000, 1000), (-1000, 1000), (-1000, 1000)] # TODO if self.trackMario:
for f, i in zip((ax.set_xlim, ax.set_ylim), axes): offs = [(-1000, 1000), (-1000, 1000), (-1000, 1000)] # TODO
p = pos[i] p = pos[i]
d0, d1 = offs[i] d0, d1 = offs[i]
if invertX & (i==0) | invertZ & (i==2): # invert v0, v1 = p+d0, p+d1
d0, d1 = d1, d0 else:
f(p+d0, p+d1) v0, v1 = getattr(ax, f'get_{a}lim')()
if i!=1 and (v0<v1) ^ ((invertX & (i==0)) | (invertZ & (i==2))): # invert
v0, v1 = v1, v0
getattr(ax, f'set_{a}lim')(v0, v1)
ax.grid(True) ax.grid(True)
# apply # apply
self.mcv.fig.tight_layout() self.mcv.fig.tight_layout()