summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/WrRamp.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/scape/WrRamp.java')
-rw-r--r--NET/worlds/scape/WrRamp.java246
1 files changed, 246 insertions, 0 deletions
diff --git a/NET/worlds/scape/WrRamp.java b/NET/worlds/scape/WrRamp.java
new file mode 100644
index 0000000..740c85f
--- /dev/null
+++ b/NET/worlds/scape/WrRamp.java
@@ -0,0 +1,246 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import java.io.IOException;
+/* */ import java.io.PrintStream;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class WrRamp
+/* */ extends Room
+/* */ {
+/* */ private static final float epsilon = 0.01F;
+/* */ public Portal portal1;
+/* */ public Portal portal2;
+/* */ private float dzByLength;
+/* */
+/* */ public WrRamp(World world, String name, float length, float width, float pWidth, float pHeight, float dz, float lintelZ, float floorTileX, float floorTileY, float ceilTileX, float ceilTileY, float leftTileX, float leftTileY, float rightTileX, float rightTileY, Material floor, Material left, Material right, Material doorpost, Material lintel, Material ceiling)
+/* */ {
+/* 59 */ super(world, name);
+/* */
+/* 61 */ if (pWidth > width) {
+/* 62 */ System.out.println("WrRamp: portal too wide; reducing.");
+/* 63 */ pWidth = width;
+/* */ }
+/* 65 */ if (length < 0.0F) {
+/* 66 */ System.out.println("WrRamp: length must be positive; inverting.");
+/* 67 */ length = -length;
+/* */ }
+/* 69 */ if (width < 0.0F) {
+/* 70 */ System.out.println("WrRamp: width must be positive; inverting.");
+/* 71 */ width = -width;
+/* */ }
+/* 73 */ if (pWidth < 0.0F) {
+/* 74 */ System.out.println(
+/* 75 */ "WrRamp: portal width must be positive; inverting.");
+/* 76 */ pWidth = -pWidth;
+/* */ }
+/* 78 */ if (pHeight < 0.0F) {
+/* 79 */ System.out.println(
+/* 80 */ "WrRamp: portal height must be positive; inverting.");
+/* 81 */ pHeight = -pHeight;
+/* */ }
+/* 83 */ if (lintelZ < 0.0F) {
+/* 84 */ System.out.println(
+/* 85 */ "WrRamp: lintel height must be positive; ignoring.");
+/* 86 */ lintelZ = 0.0F;
+/* */ }
+/* 88 */ if (floorTileX < 10.0F) {
+/* 89 */ System.out.println(
+/* 90 */ "WrRamp: floor tile width must be at least 10; fixing.");
+/* 91 */ floorTileX = 10.0F;
+/* */ }
+/* 93 */ if (floorTileY < 10.0F) {
+/* 94 */ System.out.println(
+/* 95 */ "WrRamp: floor tile length must be at least 10; fixing.");
+/* 96 */ floorTileY = 10.0F;
+/* */ }
+/* 98 */ if (ceilTileX < 10.0F) {
+/* 99 */ System.out.println(
+/* 100 */ "WrRamp: ceiling tile width must be at least 10; fixing.");
+/* 101 */ ceilTileX = 10.0F;
+/* */ }
+/* 103 */ if (ceilTileY < 10.0F) {
+/* 104 */ System.out.println(
+/* 105 */ "WrRamp: ceiling tile length must be at least 10; fixing.");
+/* 106 */ ceilTileY = 10.0F;
+/* */ }
+/* 108 */ if (leftTileX < 10.0F) {
+/* 109 */ System.out.println(
+/* 110 */ "WrRamp: lWall tile width must be at least 10; fixing.");
+/* 111 */ leftTileX = 10.0F;
+/* */ }
+/* 113 */ if (leftTileY < 10.0F) {
+/* 114 */ System.out.println(
+/* 115 */ "WrRamp: lWall tile length must be at least 10; fixing.");
+/* 116 */ leftTileY = 10.0F;
+/* */ }
+/* 118 */ if (rightTileX < 10.0F) {
+/* 119 */ System.out.println(
+/* 120 */ "WrRamp: rWall tile width must be at least 10; fixing.");
+/* 121 */ rightTileX = 10.0F;
+/* */ }
+/* 123 */ if (rightTileY < 10.0F) {
+/* 124 */ System.out.println(
+/* 125 */ "WrRamp: rWall tile length must be at least 10; fixing.");
+/* 126 */ rightTileY = 10.0F;
+/* */ }
+/* */
+/* */
+/* 130 */ RoomEnvironment env = getEnvironment();
+/* 131 */ float postX = (width - pWidth) / 2.0F;
+/* 132 */ this.dzByLength = (dz / length);
+/* 133 */ float nearTop = pHeight + lintelZ;
+/* 134 */ float farTop = dz + nearTop;
+/* */
+/* */
+/* 137 */ this.portal1 = new Portal(width - postX, 0.0F, 0.0F, postX, 0.0F, pHeight);
+/* 138 */ this.portal2 = new Portal(postX, length, dz,
+/* 139 */ width - postX, length, dz + pHeight);
+/* 140 */ env.add(this.portal1);
+/* 141 */ env.add(this.portal2);
+/* */
+/* */
+/* 144 */ float[] floorVerts = {
+/* 145 */ 0.0F, 0.0F, 0.0F, 0.0F, 0.0F,
+/* 146 */ width, 0.0F, 0.0F, width / floorTileX, 0.0F,
+/* 147 */ width, length, dz, width / floorTileX, length / floorTileY,
+/* 148 */ 0.0F, length, dz, 0.0F, length / floorTileY };
+/* 149 */ env.add(new Polygon(floorVerts, floor));
+/* */
+/* */
+/* 152 */ if (lintelZ > 0.0F) {
+/* 153 */ env.add(new Rect(width, 0.0F, pHeight, 0.0F, 0.0F, nearTop, lintel));
+/* 154 */ env.add(new Rect(0.0F, length, dz + pHeight, width, length, farTop, lintel));
+/* */ }
+/* 156 */ if (width > pWidth) {
+/* 157 */ env.add(new Rect(width, 0.0F, 0.0F, width - postX, 0.0F, pHeight, doorpost));
+/* 158 */ env.add(new Rect(postX, 0.0F, 0.0F, 0.0F, 0.0F, pHeight, doorpost));
+/* 159 */ env.add(new Rect(0.0F, length, dz, postX, length, dz + pHeight, doorpost));
+/* 160 */ env.add(new Rect(width - postX, length, dz,
+/* 161 */ width, length, dz + pHeight, doorpost));
+/* */ }
+/* */
+/* */
+/* 165 */ float[] ceilVerts = {
+/* 166 */ 0.0F, 0.0F, nearTop, 0.0F, 0.0F,
+/* 167 */ 0.0F, length, farTop, 0.0F, length / ceilTileY,
+/* 168 */ width, length, farTop, width / ceilTileX, length / ceilTileY,
+/* 169 */ width, 0.0F, nearTop, width / ceilTileX, 0.0F };
+/* 170 */ env.add(new Polygon(ceilVerts, ceiling));
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 189 */ float bottom = Math.min(dz, 0.0F);
+/* 190 */ float top = Math.max(nearTop, farTop);
+/* 191 */ env.add(new Rect(-0.01F, 0.0F, bottom, -0.01F, length, top, left));
+/* 192 */ env.add(new Rect(width + 0.01F, length, bottom, width + 0.01F, 0.0F, top,
+/* 193 */ right));
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public WrRamp() {}
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public float floorHeight(float x, float y, float z)
+/* */ {
+/* 210 */ return y * this.dzByLength;
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public Point3 surfaceNormal(float x, float y, float z)
+/* */ {
+/* 218 */ Point3 A = new Point3(1.0F, 0.0F, 0.0F);
+/* 219 */ Point3Temp B = Point3Temp.make(0.0F, 1.0F, this.dzByLength);
+/* 220 */ A.cross(B);
+/* 221 */ A.normalize();
+/* 222 */ return A;
+/* */ }
+/* */
+/* */
+/* */
+/* */ public void saveState(Saver s)
+/* */ throws IOException
+/* */ {
+/* 230 */ super.saveState(s);
+/* 231 */ s.saveFloat(this.dzByLength);
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r)
+/* */ throws IOException, TooNewException
+/* */ {
+/* 237 */ super.restoreState(r);
+/* 238 */ this.dzByLength = r.restoreFloat();
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\WrRamp.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file