diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/WrStaircase.java | |
| download | worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.tar.xz worlds.jar-e1e781bb2135ef78592226f1a3eaba4925702f1f.zip | |
Diffstat (limited to 'NET/worlds/scape/WrStaircase.java')
| -rw-r--r-- | NET/worlds/scape/WrStaircase.java | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/NET/worlds/scape/WrStaircase.java b/NET/worlds/scape/WrStaircase.java new file mode 100644 index 0000000..05612e6 --- /dev/null +++ b/NET/worlds/scape/WrStaircase.java @@ -0,0 +1,211 @@ +/* */ package NET.worlds.scape; +/* */ +/* */ import java.io.IOException; +/* */ import java.io.PrintStream; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class WrStaircase +/* */ extends Room +/* */ { +/* */ private static final float epsilon = 0.01F; +/* */ public Portal portal1; +/* */ public Portal portal2; +/* */ private float dzByLength; +/* */ +/* */ public WrStaircase(World world, String name, float length, float width, float pWidth, float pHeight, float dz, float lintelZ, int numSteps, Material riser, Material tread, Material left, Material right, Material doorpost, Material lintel, Material ceiling) +/* */ { +/* 64 */ super(world, name); +/* */ +/* 66 */ if (pWidth > width) { +/* 67 */ System.out.println("WrStaircase: portal too wide; reducing."); +/* 68 */ pWidth = width; +/* */ } +/* 70 */ if (length < 0.0F) { +/* 71 */ System.out.println( +/* 72 */ "WrStaircase: length must be positive; inverting."); +/* 73 */ length = -length; +/* */ } +/* 75 */ if (width < 0.0F) { +/* 76 */ System.out.println( +/* 77 */ "WrStaircase: width must be positive; inverting."); +/* 78 */ width = -width; +/* */ } +/* 80 */ if (pWidth < 0.0F) { +/* 81 */ System.out.println( +/* 82 */ "WrStaircase: portal width must be positive; inverting."); +/* 83 */ pWidth = -pWidth; +/* */ } +/* 85 */ if (pHeight < 0.0F) { +/* 86 */ System.out.println( +/* 87 */ "WrStaircase: portal height must be positive; inverting."); +/* 88 */ pHeight = -pHeight; +/* */ } +/* 90 */ if (lintelZ < 0.0F) { +/* 91 */ System.out.println( +/* 92 */ "WrStaircase: lintel height must be positive; ignoring."); +/* 93 */ lintelZ = 0.0F; +/* */ } +/* 95 */ if (numSteps < 2) { +/* 96 */ System.out.println( +/* 97 */ "WrStaircase: must have at least 2 steps."); +/* 98 */ numSteps = 2; +/* */ } +/* */ +/* */ +/* 102 */ RoomEnvironment env = getEnvironment(); +/* 103 */ float postX = (width - pWidth) / 2.0F; +/* 104 */ float bottom = Math.min(dz, 0.0F); +/* 105 */ float ceilingHeight = Math.max(dz, 0.0F) + pHeight + lintelZ; +/* 106 */ this.dzByLength = (dz / length); +/* */ +/* */ +/* 109 */ this.portal1 = new Portal(width - postX, 0.0F, 0.0F, postX, 0.0F, pHeight); +/* */ +/* 111 */ this.portal2 = new Portal(postX, length, dz, +/* 112 */ width - postX, length, dz + pHeight); +/* */ +/* 114 */ env.add(this.portal1); +/* 115 */ env.add(this.portal2); +/* */ +/* */ +/* 118 */ float stepWidth = length / numSteps; +/* 119 */ float stepHeight = dz / numSteps; +/* 120 */ for (int i = 1; i <= numSteps; i++) { +/* 121 */ Rect w = new Rect(0.0F, i * stepWidth, (i - 1) * stepHeight, +/* 122 */ width, i * stepWidth, i * stepHeight - 0.01F, riser); +/* 123 */ w.setTileSize(stepHeight, stepHeight); +/* */ +/* */ +/* 126 */ env.add(w); +/* */ } +/* */ +/* */ +/* 130 */ for (int i = 0; i < numSteps; i++) { +/* 131 */ Rect w = Rect.floor(0.0F, i * stepWidth, i * stepHeight, +/* 132 */ width, (i + 1) * stepWidth - 0.01F, tread); +/* 133 */ w.setTileSize(Math.abs(stepWidth), Math.abs(stepWidth)); +/* 134 */ env.add(w); +/* */ } +/* */ +/* */ +/* 138 */ if (ceilingHeight > pHeight) +/* 139 */ env.add( +/* 140 */ new Rect(width, 0.0F, pHeight, 0.0F, 0.0F, ceilingHeight - 0.01F, lintel)); +/* 141 */ if (ceilingHeight > dz + pHeight) +/* 142 */ env.add( +/* 143 */ new Rect(0.0F, length, dz + pHeight, +/* 144 */ width, length, ceilingHeight - 0.01F, lintel)); +/* 145 */ if (width > pWidth) { +/* 146 */ env.add(new Rect(width, 0.0F, 0.0F, width - postX, 0.0F, pHeight, doorpost)); +/* 147 */ env.add(new Rect(postX, 0.0F, 0.0F, 0.0F, 0.0F, pHeight, doorpost)); +/* 148 */ env.add(new Rect(0.0F, length, dz, postX, length, dz + pHeight, doorpost)); +/* 149 */ env.add(new Rect(width - postX, length, dz, width, length, dz + pHeight, +/* 150 */ doorpost)); +/* */ } +/* */ +/* */ +/* 154 */ env.add(Rect.ceiling(0.0F, 0.0F, ceilingHeight, width, length, ceiling)); +/* 155 */ env.add(new Rect(-0.01F, 0.0F, bottom, -0.01F, length, ceilingHeight, +/* 156 */ left)); +/* 157 */ env.add(new Rect(width + 0.01F, length, bottom, +/* 158 */ width + 0.01F, 0.0F, ceilingHeight, right)); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public WrStaircase() {} +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public float floorHeight(float x, float y, float z) +/* */ { +/* 175 */ return y * this.dzByLength; +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ public Point3 surfaceNormal(float x, float y, float z) +/* */ { +/* 183 */ Point3 A = new Point3(1.0F, 0.0F, 0.0F); +/* 184 */ Point3Temp B = Point3Temp.make(0.0F, 1.0F, this.dzByLength); +/* 185 */ A.cross(B); +/* 186 */ A.normalize(); +/* 187 */ return A; +/* */ } +/* */ +/* */ +/* */ +/* */ public void saveState(Saver s) +/* */ throws IOException +/* */ { +/* 195 */ super.saveState(s); +/* 196 */ s.saveFloat(this.dzByLength); +/* */ } +/* */ +/* */ public void restoreState(Restorer r) +/* */ throws IOException, TooNewException +/* */ { +/* 202 */ super.restoreState(r); +/* 203 */ this.dzByLength = r.restoreFloat(); +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\WrStaircase.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |