diff options
| author | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-12 22:33:32 -0800 |
| commit | c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9 (patch) | |
| tree | df9f48bf128a6c0186a8e91857d6ff30fe0e9f18 /NET/worlds/scape/MoveCameraAction.java | |
| download | worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.tar.xz worldsplayer-c7a9d4a6bd53ed7d61731770f2f10e8b9fd435f9.zip | |
Initial commit
Diffstat (limited to 'NET/worlds/scape/MoveCameraAction.java')
| -rw-r--r-- | NET/worlds/scape/MoveCameraAction.java | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/NET/worlds/scape/MoveCameraAction.java b/NET/worlds/scape/MoveCameraAction.java new file mode 100644 index 0000000..d772588 --- /dev/null +++ b/NET/worlds/scape/MoveCameraAction.java @@ -0,0 +1,85 @@ +package NET.worlds.scape; + +import NET.worlds.core.Std; +import java.util.Enumeration; + +public class MoveCameraAction extends MoveAction { + private static Object classCookie = new Object(); + + @Override + public Persister trigger(Event e, Persister seqID) { + Pilot pl = Pilot.getActive(); + if (!(pl instanceof HoloPilot)) { + return null; + } else { + HoloPilot holo = (HoloPilot)pl; + holo.releaseCamera(); + Object owner = holo.getCamera(); + if (owner != null && owner instanceof WObject) { + WObject o = (WObject)owner; + if (this.killed) { + this.killed = false; + this.activeID = null; + holo.reclaimCamera(); + return null; + } else { + if (seqID == null) { + if (this.activeID != null) { + return this.activeID; + } + + if (this.killOthers) { + Enumeration acts = o.getActions(); + + while (acts.hasMoreElements()) { + Action a = (Action)acts.nextElement(); + if (a != this && a instanceof MoveAction) { + MoveAction ma = (MoveAction)a; + if (ma.isRunning()) { + ma.kill(); + } + } + } + } + + this.startTime = Std.getRealTime(); + this.activeID = new SuperRoot(); + seqID = this.activeID; + } + + if (seqID != this.activeID) { + return null; + } else { + int currentTime = Std.getRealTime(); + int cycleNo = (currentTime - this.startTime) / this.cycleTime; + float frameLoc = 1.0F; + if (cycleNo >= this.cycles && !this.loopInfinite) { + System.out.println("Killing MoveCameraAction. loopInfinite = " + this.loopInfinite); + this.activeID = null; + } else { + frameLoc = (float)((currentTime - this.startTime) % this.cycleTime) / this.cycleTime; + } + + o.makeIdentity(); + o.spin(this.extentSpin, this.extentRotation * frameLoc); + o.spin(this.startSpin, this.startRotation); + Point3Temp p = Point3Temp.make( + (float)Math.pow(this.extentScale.x, frameLoc), + (float)Math.pow(this.extentScale.y, frameLoc), + (float)Math.pow(this.extentScale.z, frameLoc) + ); + o.scale(p.times(this.startScale)); + o.moveTo(Point3Temp.make(this.extentPoint).times(frameLoc).plus(this.startPoint)); + if (this.activeID == null) { + holo.reclaimCamera(); + } + + return this.activeID; + } + } + } else { + return null; + } + } + } +} |