Fix menu reveal: MoveToAnim is absolute; register unlabeled anim children
- MoveToAnim x/y/z are absolute target positions, not offsets: objects are authored in their hidden state and tweened to the visible position (e.g. the LANGUAGES title -500 -> 20). JPCSP's offset treatment is wrong. - Register unlabeled child entries (animation records) under the 'children' property with a synthetic zero-padded name, so BaseAnim.play can reach them. Previously anim containers had zero children and played nothing.
This commit is contained in:
@@ -20,24 +20,26 @@ public class MoveToAnim extends BaseAnim {
|
|||||||
@Override
|
@Override
|
||||||
protected void doPlay(VsmxBaseObject object) {
|
protected void doPlay(VsmxBaseObject object) {
|
||||||
applyTo(ref, target -> {
|
applyTo(ref, target -> {
|
||||||
|
// x/y/z are absolute target positions: objects are authored in their
|
||||||
|
// hidden state (e.g. off-screen) and tweened to the visible position.
|
||||||
float tx = x.getFloatValue();
|
float tx = x.getFloatValue();
|
||||||
float ty = y.getFloatValue();
|
float ty = y.getFloatValue();
|
||||||
float tz = z.getFloatValue();
|
float tz = z.getFloatValue();
|
||||||
long millis = (long) duration.getFloatValue();
|
long millis = (long) duration.getFloatValue();
|
||||||
if (millis <= 0) {
|
if (millis <= 0) {
|
||||||
target.animX = tx;
|
target.posX.setFloatValue(tx);
|
||||||
target.animY = ty;
|
target.posY.setFloatValue(ty);
|
||||||
target.animZ = tz;
|
target.posZ.setFloatValue(tz);
|
||||||
target.onDisplayUpdated();
|
target.onDisplayUpdated();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
float sx = target.animX;
|
float sx = target.posX.getFloatValue();
|
||||||
float sy = target.animY;
|
float sy = target.posY.getFloatValue();
|
||||||
float sz = target.animZ;
|
float sz = target.posZ.getFloatValue();
|
||||||
Animator.getInstance().add(new Tween(millis, accelMode.getIntValue(), p -> {
|
Animator.getInstance().add(new Tween(millis, accelMode.getIntValue(), p -> {
|
||||||
target.animX = sx + (tx - sx) * p;
|
target.posX.setFloatValue(sx + (tx - sx) * p);
|
||||||
target.animY = sy + (ty - sy) * p;
|
target.posY.setFloatValue(sy + (ty - sy) * p);
|
||||||
target.animZ = sz + (tz - sz) * p;
|
target.posZ.setFloatValue(sz + (tz - sz) * p);
|
||||||
target.onDisplayUpdated();
|
target.onDisplayUpdated();
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -70,7 +70,14 @@ public class Resource extends BaseNativeObject {
|
|||||||
if (!entry.subEntries.isEmpty()) {
|
if (!entry.subEntries.isEmpty()) {
|
||||||
VsmxObject children = new VsmxObject(interpreter, null);
|
VsmxObject children = new VsmxObject(interpreter, null);
|
||||||
object.setPropertyValue(childrenName, children);
|
object.setPropertyValue(childrenName, children);
|
||||||
for (RcoFile.Entry child : entry.subEntries) {
|
for (int i = 0; i < entry.subEntries.size(); i++) {
|
||||||
|
RcoFile.Entry child = entry.subEntries.get(i);
|
||||||
|
// Unlabeled children (e.g. animation records) still need to be
|
||||||
|
// registered under "children" so scripts/anim playback can reach
|
||||||
|
// them. Assign a synthetic zero-padded name, as JPCSP does.
|
||||||
|
if (child.label == null) {
|
||||||
|
child.label = String.format("%04d", i);
|
||||||
|
}
|
||||||
createObjectFromEntry(interpreter, display, controller, children, child);
|
createObjectFromEntry(interpreter, display, controller, children, child);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user