Thread: Animated Game World Background

Page 1 of 5 123 ... LastLast
Results 1 to 10 of 42
  1. #1 Animated Game World Background 
    Registered Member

    Join Date
    Jun 2012
    Posts
    204
    Thanks given
    61
    Thanks received
    77
    Rep Power
    104
    Code:
    public class ScriptManager {
    	
    	public void cameraMapping(int x, int y, int plane, boolean loop, int[] cameraIndex) {
    		terrainRegionX = x;
    		terrainRegionY = y;
    		regionPlane = plane;
    		this.loop = loop;
    		this.cameraIndex = cameraIndex;
    	}
    	
    	public ScriptManager(Client client) {
    		int generateLocation = (int) (java.lang.Math.random() * (3 + 1));
    	    this.instance = client;
    		int cycleSpeed = 0;
    		switch(generateLocation) {
    			case 0://Varrock
    				cameraMapping(401, 424, 0, false, 
    					new int[] {
    						//cameraX, cameraY, cameraZ, curveX, curveY, speed
    						6711, 5920, -1901, 2032, 383, cycleSpeed,
    						6597, 7213, -665, 2034, 128, cycleSpeed,
    						6454, 8791, -715, 1983, 133, cycleSpeed,
    						6452, 9108, -1017, 1951, 208, cycleSpeed,
    						6131, 10220, -1420, 1794, 288, cycleSpeed,
    						6135, 11541, -1420, 1277, 288, cycleSpeed,
    						7432, 11543, -1420, 772, 288, cycleSpeed,
    						7440, 10224, -1420, 256, 288, cycleSpeed
    					}
    				);
    				break;
    			case 1://Falador
    				cameraMapping(375, 422, 0, false, 
    					new int[] {
    						//cameraX, cameraY, cameraZ, curveX, curveY, speed
    						7963, 6612, -425, 500, 128, cycleSpeed,
    						6431, 6612, -1073, 500, 128, cycleSpeed,
    						5792, 6612, -1145, 500, 128, cycleSpeed,
    						5792, 6612, -1145, 500, 128, cycleSpeed,
    						4500, 6612, -950, 500, 128, cycleSpeed,
    						2750, 6568, -1500, 556, 128, cycleSpeed,
    						2750, 6568, -1500, 2900, 150, warp(4)
    					}
    				);
    				break;
    			
    			case 2://Lunar
    				cameraMapping(265, 489, 0, false, 
    					new int[] {
    						//cameraX, cameraY, cameraZ, curveX, curveY, speed
    						7963, 6612, -425, 500, 128, cycleSpeed,
    						6431, 6612, -1073, 500, 128, cycleSpeed,
    						5792, 6612, -1145, 500, 128, cycleSpeed,
    						5792, 6612, -1145, 500, 128, cycleSpeed,
    						4500, 6612, -950, 500, 128, cycleSpeed,
    						2750, 6568, -1500, 556, 128, cycleSpeed,
    						2750, 6568, -1500, 2900, 150, warp(4)
    					}
    				);
    				break;
    				
    			case 3://Fist of Guthic
    				cameraMapping(209, 709, 0, false, 
    					new int[] {
    						//cameraX, cameraY, cameraZ, curveX, curveY, speed
    						7582, 9403, -759, 1033, 128, cycleSpeed,
    						7581, 7931, -580, 1034, 128, cycleSpeed,
    						6193, 6717, -675, 1033, 128, cycleSpeed,
    						6193, 5966, -727, 1033, 128, cycleSpeed,
    						5804, 6818, -983, 1130, 163, cycleSpeed,
    						7262, 6806, -1153, 1418, 183, cycleSpeed,
    						8317, 7593, -1388, 1683, 233, cycleSpeed,
    						9258, 9134, -1765, 348, 311, cycleSpeed,
    						7638, 9070, -1256, 475, 249, cycleSpeed,
    						6660, 9037, -615, 459, 128, cycleSpeed,
    						6089, 9581, -698, 635, 158, cycleSpeed,
    						5578, 9715, -579, 650, 128, cycleSpeed
    					}
    				);
    				break;
    		}
    		reset();
    	}
    
    	private static final int warp(int speed) {
    		return ~speed + 2;
    	}
    	
    	private static double curve(double d, double d1) {
    		double d2 = d - d1;
    		double d3 = 2048.0D - d1 + d;
    		double d4 = 2048.0D - d + d1;
    		double d5 = Math.abs(d2);
    		double d6 = Math.abs(d3);
    		double d7 = Math.abs(d4);
    		if (d5 < d6 && d5 < d7)
    			return d2;
    
    		if (d6 < d5 && d6 < d7)
    			return d3;
    
    		if (d7 < d5 && d7 < d6)
    			return d4;
    
    		return d2;
    	}
    
    	private static double p5(double d) {
    		d = Math.abs(d);
    		return d * d * d * d * d;
    	}
    
    	public void cycle() {
    		boolean justReset = false;
    		while (cycles < 1) {
    			int total = cameraIndex.length / 6;
    			if (pos < 0 || pos >= total) {
    				if (loop && !justReset) {
    					justReset = true;
    					pos = 0;
    					cycles = 0;
    					//instance.resetWorld(0);
    					//instance.setNorth();
    					if (instance.plane != regionPlane) {
    						instance.plane = regionPlane;
    					}
    					if (instance.terrainRegionX != terrainRegionX 
    						|| instance.terrainRegionY != terrainRegionY) {
    						instance.generateWorld(terrainRegionX, terrainRegionY);
    					}
    					instance.resetWorld(1);;
    				}
    				return;
    			}
    			int idx = (pos << 2) + (pos << 1);
    			pos++;
    			if (cameraIndex[5 + idx] == 0x80000000) {
    				//instance.resetWorld(0);;
    				instance.setNorth();
    				if (instance.plane != cameraIndex[idx + 2])
    					instance.plane = cameraIndex[idx + 2];
    				if (instance.terrainRegionX != cameraIndex[idx] 
    					|| instance.terrainRegionY != cameraIndex[idx + 1]) {
    					instance.generateWorld(cameraIndex[idx], cameraIndex[idx + 1]);
    				}
    				instance.resetWorld(1);;
    				break;
    			}
    			double xPos = (double) cameraIndex[idx] - xCameraPos;
    			double yPos = (double) cameraIndex[1 + idx] - yCameraPos;
    			double zPos = (double) cameraIndex[2 + idx] - zCameraPos;
    			double xCurve = curve((double) (cameraIndex[3 + idx] & 2047), xCameraCurve);
    			double yCurve = curve((double) (cameraIndex[4 + idx] & 2047), yCameraCurve);
    			cycles = cameraIndex[5 + idx];
    			if (cycles < 1) {
    				int mult = ~cycles + 2;
    				double cyclesD = Math.pow(p5(xPos) + p5(yPos) + p5(zPos) + p5(xCurve) + p5(yCurve), 1.0D / 5.0D);
    				cycles = round(cyclesD / 7.5D);
    				if (cycles < 1)
    					cycles = 1;
    				cycles *= mult;
    			}
    			xCameraPosRate = xPos / (double) cycles;
    			yCameraPosRate = yPos / (double) cycles;
    			zCameraPosRate = zPos / (double) cycles;
    			xCameraCurveRate = xCurve / (double) cycles;
    			yCameraCurveRate = yCurve / (double) cycles;
    		}
    		if (cycles > 0) {
    			xCameraPos += xCameraPosRate;
    			yCameraPos += yCameraPosRate;
    			zCameraPos += zCameraPosRate;
    			xCameraCurve = sgn(xCameraCurve + xCameraCurveRate, 2048.0D);
    			yCameraCurve = sgn(yCameraCurve + yCameraCurveRate, 2048.0D);
    			update();
    			cycles--;
    		}
    	}
    
    	private static double sgn(double d, double d1) {
    		d %= d1;
    		return d < 0.0D ? d + d1:d;
    	}
    
    	private static int round(double d) {
    		if (d < 0.0D)
    			d -= 0.5D;
    		else
    			d += 0.5D;
    		return (int) d;
    	}
    
    	public void update() {
    		instance.xCameraPos = round(xCameraPos);
    		instance.yCameraPos = round(yCameraPos);
    		instance.zCameraPos = round(zCameraPos);
    		instance.xCameraCurve = round(xCameraCurve) & 2047;
    		instance.yCameraCurve = round(yCameraCurve) & 2047;
    	}
    
    	public void reset() {
    		pos = 1;
    		cycles = 0;
    		if (cameraIndex.length < 6)
    			return;
    
    		xCameraPos = (double) cameraIndex[0];
    		yCameraPos = (double) cameraIndex[1];
    		zCameraPos = (double) cameraIndex[2];
    		xCameraCurve = (double) (cameraIndex[3] & 2047);
    		yCameraCurve = (double) (cameraIndex[4] & 2047);
    		update();
    	}
    
    	public void stop() { }
    
    	private boolean loop;
    	private double xCameraPos;
    	private double yCameraPos;
    	private double zCameraPos;
    	private double xCameraCurve;
    	private double yCameraCurve;
    	private int cycles;
    	private double xCameraPosRate;
    	private double yCameraPosRate;
    	private double zCameraPosRate;
    	private double xCameraCurveRate;
    	private double yCameraCurveRate;
    	private int pos;
    	private Client instance;
    	public int[] cameraIndex;
    	public int terrainRegionX;
    	public int terrainRegionY;
    	public int regionPlane;
    }
    Code:
    	public int terrainRegionX;
    	public int terrainRegionY;
    	public int[] titleScreenOffsets = null;
    	public int titleWidth = -1;
    	public int titleHeight = -1;
    	public ScriptManager scriptManager;
    	public void generateWorld(int x, int y) {
    		terrainRegionX = x;
    		terrainRegionY = y;
    		aBoolean1159 = false;
    		if(anInt1069 == x && anInt1070 == y && loadingStage == 2) {
    			return;
    		}
    		anInt1069 = x;
    		anInt1070 = y;
    		baseX = (anInt1069 - 6) * 8;
    		baseY = (anInt1070 - 6) * 8;
    		aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49) && anInt1070 / 8 == 48;
    		if(anInt1069 / 8 == 48 && anInt1070 / 8 == 148)
    			aBoolean1141 = true;
    		loadingStage = 1;
    		aLong824 = System.currentTimeMillis();
    		int k16 = 0;
    		for(int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
    			for(int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++)
    				k16++;
    		}
    		aByteArrayArray1183 = new byte[k16][];
    		aByteArrayArray1247 = new byte[k16][];
    		anIntArray1234 = new int[k16];
    		anIntArray1235 = new int[k16];
    		anIntArray1236 = new int[k16];
    		k16 = 0;
    		for(int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
    			for(int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
    				anIntArray1234[k16] = (l23 << 8) + j26;
    				if(aBoolean1141 && (j26 == 49 || j26 == 149 || j26 == 147 || l23 == 50 || l23 == 49 && j26 == 47)) {
    					anIntArray1235[k16] = -1;
    					anIntArray1236[k16] = -1;
    					k16++;
    				} else {
    					int k28 = anIntArray1235[k16] = onDemandFetcher.method562(0, j26, l23);
    					if(k28 != -1)
    						onDemandFetcher.method558(3, k28);
    					int j30 = anIntArray1236[k16] = onDemandFetcher.method562(1, j26, l23);
    					if(j30 != -1)
    						onDemandFetcher.method558(3, j30);
    					k16++;
    				}
    			}
    		}
    		/*if(pktType == 241) {
    			int l16 = 0;
    			int ai[] = new int[676];
    			for(int i24 = 0; i24 < 4; i24++) {
    				for(int k26 = 0; k26 < 13; k26++) {
    					for(int l28 = 0; l28 < 13; l28++) {
    						int k30 = anIntArrayArrayArray1129[i24][k26][l28];
    						if(k30 != -1) {
    							int k31 = k30 >> 14 & 0x3ff;
    							int i32 = k30 >> 3 & 0x7ff;
    							int k32 = (k31 / 8 << 8) + i32 / 8;
    							for(int j33 = 0; j33 < l16; j33++) {
    								if(ai[j33] != k32)
    									continue;
    								k32 = -1;
    								
    							}
    							if(k32 != -1)
    								ai[l16++] = k32;
    						}
    					}
    				}
    			}
    			aByteArrayArray1183 = new byte[l16][];
    			aByteArrayArray1247 = new byte[l16][];
    			anIntArray1234 = new int[l16];
    			anIntArray1235 = new int[l16];
    			anIntArray1236 = new int[l16];
    			for(int l26 = 0; l26 < l16; l26++) {
    				int i29 = anIntArray1234[l26] = ai[l26];
    				int l30 = i29 >> 8 & 0xff;
    				int l31 = i29 & 0xff;
    				int j32 = anIntArray1235[l26] = onDemandFetcher.method562(0, l31, l30);
    				if(j32 != -1)
    					onDemandFetcher.method558(3, j32);
    				int i33 = anIntArray1236[l26] = onDemandFetcher.method562(1, l31, l30);
    				if(i33 != -1)
    					onDemandFetcher.method558(3, i33);
    			}
    		}*/
    		int i17 = baseX - anInt1036;
    		int j21 = baseY - anInt1037;
    		anInt1036 = baseX;
    		anInt1037 = baseY;
    		for(int j24 = 0; j24 < 16384; j24++) {
    			NPC npc = npcArray[j24];
    			if(npc != null) {
    				for(int j29 = 0; j29 < 10; j29++) {
    					npc.smallX[j29] -= i17;
    					npc.smallY[j29] -= j21;
    				}
    				npc.x -= i17 * 128;
    				npc.y -= j21 * 128;
    			}
    		}
    		for(int i27 = 0; i27 < maxPlayers; i27++) {
    			Player player = playerArray[i27];
    			if(player != null) {
    				for(int i31 = 0; i31 < 10; i31++) {
    					player.smallX[i31] -= i17;
    					player.smallY[i31] -= j21;
    				}
    				player.x -= i17 * 128;
    				player.y -= j21 * 128;
    			}
    		}
    		aBoolean1080 = true;
    		byte byte1 = 0;
    		byte byte2 = 104;
    		byte byte3 = 1;
    		if(i17 < 0) {
    			byte1 = 103;
    			byte2 = -1;
    			byte3 = -1;
    		}
    		byte byte4 = 0;
    		byte byte5 = 104;
    		byte byte6 = 1;
    		if(j21 < 0) {
    			byte4 = 103;
    			byte5 = -1;
    			byte6 = -1;
    		}
    		for(int k33 = byte1; k33 != byte2; k33 += byte3) {
    			for(int l33 = byte4; l33 != byte5; l33 += byte6) {
    				int i34 = k33 + i17;
    				int j34 = l33 + j21;
    				for(int k34 = 0; k34 < 4; k34++)
    					if(i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104)
    						groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
    					else
    						groundArray[k34][k33][l33] = null;
    			}
    		}
    		for(NodeSub_2 class30_sub1_1 = (NodeSub_2)aClass19_1179.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (NodeSub_2)aClass19_1179.reverseGetNext()) {
    			class30_sub1_1.anInt1297 -= i17;
    			class30_sub1_1.anInt1298 -= j21;
    			if(class30_sub1_1.anInt1297 < 0 || class30_sub1_1.anInt1298 < 0 || class30_sub1_1.anInt1297 >= 104 || class30_sub1_1.anInt1298 >= 104)
    				class30_sub1_1.unlink();
    		}
    		if(destX != 0) {
    			destX -= i17;
    			destY -= j21;
    		}
    		aBoolean1160 = false;
    	}
    	
    	public void resetWorld(int stage) {
    		if(stage == 0) {
    			anInt1062 = 0;
    			anInt1278 = (int) (Math.random() * 100D) - 50;
    			anInt1131 = (int) (Math.random() * 110D) - 55;
    			anInt896 = (int) (Math.random() * 80D) - 40;
    			minimapInt2 = (int) (Math.random() * 120D) - 60;
    			minimapInt3 = (int) (Math.random() * 30D) - 20;
    			minimapInt1 = (int) (Math.random() * 20D) - 10 & 0x7ff;
    			anInt1021 = 0;
    			loadingStage = 1;
    		} else if(stage == 1) {
    			aBoolean1080 = false;
    		}
    	}
    	
    	private void loginScreenBG(boolean b) {
    		xCameraPos = 6100;
    		yCameraPos = 6867;
    		zCameraPos = -750;
    		xCameraCurve = 2040;
    		yCameraCurve = 383;
    		resetWorld(0);
    		if (b || scriptManager == null) {
    			scriptManager = new ScriptManager(this);
    		} else {
    			scriptManager.update();
    		}
    		plane = scriptManager.regionPlane;
    		generateWorld(scriptManager.terrainRegionX, scriptManager.terrainRegionY);
    		resetWorld(1);
    	}
    	
    	public void drawAnimatedWorldBackground(boolean display) {
    		if(display) {
    			int centerX = clientWidth / 2;
    			int centerY = clientHeight / 2;
    			if (scriptManager == null) {
    				loginScreenBG(true);
    			}
    			int canvasCenterX = Rasterizer.centerX;
    			int canvasCenterY = Rasterizer.centerY;
    			int canvasPixels[] = Rasterizer.lineOffsets;
    			if (titleScreenOffsets != null && (titleWidth != clientWidth || titleHeight != clientHeight)) {
    				titleScreenOffsets = null;
    			}
    			if (titleScreenOffsets == null) {
    				titleWidth = clientWidth;
    				titleHeight = clientHeight;
    				titleScreenOffsets = Rasterizer.getOffsets(titleWidth, titleHeight);
    			}
    			Rasterizer.centerX = centerX;
    			Rasterizer.centerY = centerY;
    			Rasterizer.lineOffsets = titleScreenOffsets;
    			if (loadingStage == 2 && Map.anInt131 != plane)
    				loadingStage = 1;
    
    			if (!loggedIn && loadingStage == 1) {
    				method54();
    			}
    			if (!loggedIn && loadingStage == 2 && plane != anInt985) {
    				anInt985 = plane;
    				renderedMapScene(plane);
    			}
    			if (loadingStage == 2) {
    				Rasterizer.triangles = 0;
    				try {
    					worldController.method313(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, method121(), yCameraCurve);
    					worldController.clearObj5Cache();
    				} catch (Exception ex) {
    					ex.printStackTrace();
    				}
    			}
    			if (scriptManager != null && loadingStage == 2 && plane == anInt985 && !loggedIn) {
    				scriptManager.cycle();
    			}
    			Rasterizer.centerX = canvasCenterX;
    			Rasterizer.centerY = canvasCenterY;
    			Rasterizer.lineOffsets = canvasPixels;
    		}
    	}
    Code:
    drawAnimatedWorldBackground(Config.displayWorld);
    Code:
    	int zoom = 0;
    	public void method146() {
    		anInt1265++;
    		int j = 0;
    		int l = xCameraPos;
    		int i1 = zCameraPos;
    		int j1 = yCameraPos;
    		int k1 = yCameraCurve;
    		int l1 = xCameraCurve;
    		if(loggedIn) {
    			method47(true);
    			method26(true);
    			method47(false);
    			method26(false);
    			method55();
    			method104();
    			if(!aBoolean1160) {
    				int i = anInt1184;
    				if(anInt984 / 256 > i)
    					i = anInt984 / 256;
    				if(aBooleanArray876[4] && anIntArray1203[4] + 128 > i)
    					i = anIntArray1203[4] + 128;
    				int k = minimapInt1 + anInt896 & 0x7ff;
    				int val = 600;
    				zoom = (clientState > 0 ? 2 : 4);
    				setCameraPos(val + i * zoom, i, anInt1014, method42(plane, myPlayer.y, myPlayer.x) - 50, k, anInt1015);
    				//myPlayer.turnDirection = 1092 - k & 0x7ff;
    			}
    			if(!aBoolean1160)
    				j = method120();
    			else
    				j = method121();
    			for(int i2 = 0; i2 < 5; i2++)
    				if(aBooleanArray876[i2]) {
    					int j2 = (int)((Math.random() * (double)(anIntArray873[i2] * 2 + 1) - (double)anIntArray873[i2]) + Math.sin((double)anIntArray1030[i2] * ((double)anIntArray928[i2] / 100D)) * (double)anIntArray1203[i2]);
    					if(i2 == 0)
    						xCameraPos += j2;
    					if(i2 == 1)
    						zCameraPos += j2;
    					if(i2 == 2)
    						yCameraPos += j2;
    					if(i2 == 3)
    						xCameraCurve = xCameraCurve + j2 & 0x7ff;
    					if(i2 == 4) {
    						yCameraCurve += j2;
    						if(yCameraCurve < 128)
    							yCameraCurve = 128;
    						if(yCameraCurve > 383)
    							yCameraCurve = 383;
    					}
    				}
    		}
    		int textures= Rasterizer.textureCount;
    		Model.aBoolean1684 = true;
    		Model.anInt1687 = 0;
    		Model.anInt1685 = super.mouseX - 4;
    		Model.anInt1686 = super.mouseY - 4;
    		DrawingArea.setAllPixelsToZero();	
    		if(loggedIn) {
    			worldController.method313(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, j, yCameraCurve);
    			worldController.clearObj5Cache();
    		}
    		updateEntities();
    		drawHeadIcon();
    		animateTexturePalette(textures);
    		if(!fixedState() && loggedIn) {
    			drawTabArea();
    			drawChatArea();
    			drawMinimap();
    		}
    		if(loggedIn)
    			draw3dScreen();
    		drawConsole();
    		drawConsoleArea();
    		if(loggedIn) {
    			inGameScreen.drawGraphics(4, super.graphics, 4);
    			xCameraPos = l;
    			zCameraPos = i1;
    			yCameraPos = j1;
    			yCameraCurve = k1;
    			xCameraCurve = l1;
    		}
    	}
    Code:
    	private final void method22() {
    		try {
                anInt985 = -1;
                aClass19_1056.removeAll();
                aClass19_1013.removeAll();
                Texture.method366();
                unlinkMRUNodes();
                worldController.initToNull();
                System.gc();
                for(int i = 0; i < 4; i++)
                    aClass11Array1230[i].method210();
                for(int l = 0; l < 4; l++) {
                    for(int k1 = 0; k1 < 104; k1++) {
                        for(int j2 = 0; j2 < 104; j2++)
                            byteGroundArray[l][k1][j2] = 0;
                    }
                }
                Map objectManager = new Map(byteGroundArray, intGroundArray);
                int k2 = aByteArrayArray1183.length;
    			if(loggedIn)
    				data.createFrame(0);
                if(!aBoolean1159) {
    				try {
    					for(int i3 = 0; i3 < k2; i3++) {
    						int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
    						int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
    						byte abyte0[] = aByteArrayArray1183[i3];
    						if(Config.debugPrint)
    							System.out.println("Floor maps: "+anIntArray1235[i3]);
    						if(abyte0 != null) {
    							objectManager.method180(abyte0, k5, i4, (anInt1069 - 6) * 8, (anInt1070 - 6) * 8, aClass11Array1230);
    						}
    					}
    					for(int j4 = 0; j4 < k2; j4++) {
    						int l5 = (anIntArray1234[j4] >> 8) * 62 - baseX;
    						int k7 = (anIntArray1234[j4] & 0xff) * 62 - baseY;
    						byte abyte2[] = aByteArrayArray1183[j4];
    						if(abyte2 == null && anInt1070 < 800)
    							objectManager.method174(k7, 64, 64, l5);
    					}
    					anInt1097++;
    					if(anInt1097 > 160) {
    						anInt1097 = 0;
    						data.createFrame(238);
    						data.writeByte(96);
    					}
    					if(loggedIn)
    						data.createFrame(0);
    					for(int i6 = 0; i6 < k2; i6++) {
    						byte abyte1[] = aByteArrayArray1247[i6];
    						if(Config.debugPrint)
    							System.out.println("Object maps: "+anIntArray1236[i6]);
    						if(abyte1 != null) {
    							int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
    							int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
    							objectManager.method190(l8, aClass11Array1230, k9, worldController, abyte1);
    						}
    					}
    				} catch(Exception e) {
    					e.printStackTrace();
    				}
    			}
                if(aBoolean1159) {
                    for(int j3 = 0; j3 < 4; j3++) {
                        for(int k4 = 0; k4 < 13; k4++) {
                            for(int j6 = 0; j6 < 13; j6++) {
                                int l7 = anIntArrayArrayArray1129[j3][k4][j6];
                                if(l7 != -1) {
                                    int i9 = l7 >> 24 & 3;
                                    int l9 = l7 >> 1 & 3;
                                    int j10 = l7 >> 14 & 0x3ff;
                                    int l10 = l7 >> 3 & 0x7ff;
                                    int j11 = (j10 / 8 << 8) + l10 / 8;
                                    for(int l11 = 0; l11 < anIntArray1234.length; l11++) {
                                        if(anIntArray1234[l11] != j11 || aByteArrayArray1183[l11] == null)
                                            continue;
                                        objectManager.method179(i9, l9, aClass11Array1230, k4 * 8, (j10 & 7) * 8, aByteArrayArray1183[l11], (l10 & 7) * 8, j3, j6 * 8);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    for(int l4 = 0; l4 < 13; l4++) {
                        for(int k6 = 0; k6 < 13; k6++) {
                            int i8 = anIntArrayArrayArray1129[0][l4][k6];
                            if(i8 == -1)
                                objectManager.method174(k6 * 8, 8, 8, l4 * 8);
                        }
                    }
    				if(loggedIn)
    					data.createFrame(0);
                    for(int l6 = 0; l6 < 4; l6++) {
                        for(int j8 = 0; j8 < 13; j8++) {
                            for(int j9 = 0; j9 < 13; j9++) {
                                int i10 = anIntArrayArrayArray1129[l6][j8][j9];
                                if(i10 != -1) {
                                    int k10 = i10 >> 24 & 3;
                                    int i11 = i10 >> 1 & 3;
                                    int k11 = i10 >> 14 & 0x3ff;
                                    int i12 = i10 >> 3 & 0x7ff;
                                    int j12 = (k11 / 8 << 8) + i12 / 8;
                                    for(int k12 = 0; k12 < anIntArray1234.length; k12++) {
                                        if(anIntArray1234[k12] != j12 || aByteArrayArray1247[k12] == null)
                                            continue;
    									objectManager.method183(aClass11Array1230, worldController, k10, j8 * 8, (i12 & 7) * 8, l6, aByteArrayArray1247[k12], (k11 & 7) * 8, i11, j9 * 8);
    								}
                                }
                            }
                        }
                    }
                }
    			if(loggedIn)
    				data.createFrame(0);
                objectManager.addTile(aClass11Array1230, worldController);
                inGameScreen.initDrawingArea();
                if(loggedIn)
    				data.createFrame(0);
                int k3 = Map.setZ;
                if(k3 > plane)
                    k3 = plane;
                if(k3 < plane - 1)
                    k3 = plane - 1;
                if(lowMem)
                    worldController.method275(Map.setZ);
                else
                    worldController.method275(0);
                for(int i5 = 0; i5 < 104; i5++) {
                    for(int i7 = 0; i7 < 104; i7++)
                        spawnGroundItem(i5, i7);
                }
                anInt1051++;
                if(anInt1051 > 98) {
                    anInt1051 = 0;
    				if(loggedIn)
    					data.createFrame(150);
                }
                method63();
    		} catch (Exception exception) {
    		}
    		ObjectDefinition.modelCache.unlinkAll();
            if(super.gameFrame != null && loggedIn) {
                data.createFrame(210);
                data.writeDWord(0x3f008edd);
            }
            System.gc();
            Texture.method367();
            onDemandFetcher.method566();
            int k = (anInt1069 - 6) / 8 - 1;
            int j1 = (anInt1069 + 6) / 8 + 1;
            int i2 = (anInt1070 - 6) / 8 - 1;
            int l2 = (anInt1070 + 6) / 8 + 1;
            if(aBoolean1141) {
                k = 49;
                j1 = 50;
                i2 = 49;
                l2 = 50;
            }
            for(int l3 = k; l3 <= j1; l3++) {
                for(int j5 = i2; j5 <= l2; j5++)
                    if(l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
    					int j7 = onDemandFetcher.method562(0, j5, l3);
    					if(j7 != -1)
    						onDemandFetcher.method560(j7, 3);
    					int k8 = onDemandFetcher.method562(1, j5, l3);
    					if(k8 != -1)
    						onDemandFetcher.method560(k8, 3);
    				}
    		}
    	}
    Code:
    	private void renderedMapScene(int i) {//method24
    		int ai[] = minimapImage.myPixels;
    		int j = ai.length;
    		for(int k = 0; k < j; k++)
    			ai[k] = 0;
    		for(int l = 1; l < 103; l++) {
    			int i1 = 24628 + (103 - l) * 512 * 4;
    			for(int k1 = 1; k1 < 103; k1++) {
    				if((byteGroundArray[i][k1][l] & 0x18) == 0)
    					worldController.method309(ai, i1, i, k1, l);
    				if(i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0)
    					worldController.method309(ai, i1, i + 1, k1, l);
    				i1 += 4;
    			}
    		}
    		
    		int j1;
    		int l1;
    		if(Config.randomize) {
    			j1 = ((238 + (int)(Math.random() * 20D)) - 10 << 16) + ((238 + (int)(Math.random() * 20D)) - 10 << 8) + ((238 + (int)(Math.random() * 20D)) - 10);
    			l1 = (238 + (int)(Math.random() * 20D)) - 10 << 16;
    		} else {
    			j1 = 0xffffff;
    			l1 = 0xee0000;
    		}
    		if(loggedIn)
    			minimapImage.method343();
    		for(int i2 = 1; i2 < 103; i2++) {
    			for(int j2 = 1; j2 < 103; j2++) {
    				if((byteGroundArray[i][j2][i2] & 0x18) == 0)
    					drawMapScenes(i2, j1, j2, l1, i);
    				if(i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0)
    					drawMapScenes(i2, j1, j2, l1, i + 1);
    			}
    		}
    		if(loggedIn)
    			inGameScreen.initDrawingArea();
    		anInt1071 = 0;
    		for(int k2 = 0; k2 < 104; k2++) {
    			for(int l2 = 0; l2 < 104; l2++) {
    				int objectId = worldController.method303(plane, k2, l2);
    				if(objectId != 0) {
    					objectId = objectId >> 14 & 0x7fff;
    					int objectFunctionId = ObjectDefinition.forID(objectId).mapFunctionId;
    					if(objectFunctionId >= 0) {
    						int k3 = k2;
    						int l3 = l2;
    						if(objectFunctionId != 22 && objectFunctionId != 29 && objectFunctionId != 34 && objectFunctionId != 36 && objectFunctionId != 46 && objectFunctionId != 47 && objectFunctionId != 48) {
    							//Mapfuntion offset
    							/*byte byte0 = 104;
    							byte byte1 = 104;
    							int ai1[][] = aClass11Array1230[plane].anIntArrayArray294;
    							for(int i4 = 0; i4 < 10; i4++) {
    								int j4 = (int)(Math.random() * 4D);
    								if(j4 == 0 && k3 > 0 && k3 > k2 - 3 && (ai1[k3 - 1][l3] & 0x1280108) == 0)
    									k3--;
    								if(j4 == 1 && k3 < byte0 - 1 && k3 < k2 + 3 && (ai1[k3 + 1][l3] & 0x1280180) == 0)
    									k3++;
    								if(j4 == 2 && l3 > 0 && l3 > l2 - 3 && (ai1[k3][l3 - 1] & 0x1280102) == 0)
    									l3--;
    								if(j4 == 3 && l3 < byte1 - 1 && l3 < l2 + 3 && (ai1[k3][l3 + 1] & 0x1280120) == 0)
    									l3++;
    							}*/
    						}
    						aSpriteArray1140[anInt1071] = mapFunctions[objectFunctionId];
    						anIntArray1072[anInt1071] = k3;
    						anIntArray1073[anInt1071] = l3;
    						anInt1071++;
    					}
    				}
    			}
    		}
    	}
    In the login(String, String, boolean) method, below
    Code:
    if(k == 2) {
    add
    Code:
    				scriptManager = null;
    				titleScreenOffsets = null;
    In method54,
    Code:
    			method22();
    			if(loggedIn)
    				data.createFrame(121);
    Code:
    newRegularFont.drawBasicString("Region: " + anInt1069 + ", " + anInt1070, x, y, 0xffff00, shadow);
    Quote Originally Posted by Renamed
    Rasterizer = Texture
    centerX = textureInt1
    centerY = textureInt2
    lineOffsets = anIntArray1472
    Node_Sub2 = Class30_Sub1
    Credits
    Killer 99
    Keldagrim
    Reply With Quote  
     


  2. #2  
    Donator

    Tringan's Avatar
    Join Date
    Feb 2011
    Age
    24
    Posts
    2,104
    Thanks given
    381
    Thanks received
    334
    Rep Power
    297
    very nice ;P thanks
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Dan
    +dan's Avatar
    Join Date
    Nov 2011
    Age
    16
    Posts
    518
    Thanks given
    34
    Thanks received
    32
    Rep Power
    77
    nice one
    Reply With Quote  
     

  5. Thankful user:


  6. #4  
    The One And Only

    KaiserCo's Avatar
    Join Date
    Dec 2010
    Posts
    2,420
    Thanks given
    509
    Thanks received
    445
    Rep Power
    209
    Spoiler for Just in case:
    Quote Originally Posted by OnCue View Post
    Code:
    public class ScriptManager {
    	
    	public void cameraMapping(int x, int y, int plane, boolean loop, int[] cameraIndex) {
    		terrainRegionX = x;
    		terrainRegionY = y;
    		regionPlane = plane;
    		this.loop = loop;
    		this.cameraIndex = cameraIndex;
    	}
    	
    	public ScriptManager(Client client) {
    		int generateLocation = (int) (java.lang.Math.random() * (3 + 1));
    	    this.instance = client;
    		int cycleSpeed = 0;
    		switch(generateLocation) {
    			case 0://Varrock
    				cameraMapping(401, 424, 0, false, 
    					new int[] {
    						//cameraX, cameraY, cameraZ, curveX, curveY, speed
    						6711, 5920, -1901, 2032, 383, cycleSpeed,
    						6597, 7213, -665, 2034, 128, cycleSpeed,
    						6454, 8791, -715, 1983, 133, cycleSpeed,
    						6452, 9108, -1017, 1951, 208, cycleSpeed,
    						6131, 10220, -1420, 1794, 288, cycleSpeed,
    						6135, 11541, -1420, 1277, 288, cycleSpeed,
    						7432, 11543, -1420, 772, 288, cycleSpeed,
    						7440, 10224, -1420, 256, 288, cycleSpeed
    					}
    				);
    				break;
    			case 1://Falador
    				cameraMapping(375, 422, 0, false, 
    					new int[] {
    						//cameraX, cameraY, cameraZ, curveX, curveY, speed
    						7963, 6612, -425, 500, 128, cycleSpeed,
    						6431, 6612, -1073, 500, 128, cycleSpeed,
    						5792, 6612, -1145, 500, 128, cycleSpeed,
    						5792, 6612, -1145, 500, 128, cycleSpeed,
    						4500, 6612, -950, 500, 128, cycleSpeed,
    						2750, 6568, -1500, 556, 128, cycleSpeed,
    						2750, 6568, -1500, 2900, 150, warp(4)
    					}
    				);
    				break;
    			
    			case 2://Lunar
    				cameraMapping(265, 489, 0, false, 
    					new int[] {
    						//cameraX, cameraY, cameraZ, curveX, curveY, speed
    						7963, 6612, -425, 500, 128, cycleSpeed,
    						6431, 6612, -1073, 500, 128, cycleSpeed,
    						5792, 6612, -1145, 500, 128, cycleSpeed,
    						5792, 6612, -1145, 500, 128, cycleSpeed,
    						4500, 6612, -950, 500, 128, cycleSpeed,
    						2750, 6568, -1500, 556, 128, cycleSpeed,
    						2750, 6568, -1500, 2900, 150, warp(4)
    					}
    				);
    				break;
    				
    			case 3://Fist of Guthic
    				cameraMapping(209, 709, 0, false, 
    					new int[] {
    						//cameraX, cameraY, cameraZ, curveX, curveY, speed
    						7582, 9403, -759, 1033, 128, cycleSpeed,
    						7581, 7931, -580, 1034, 128, cycleSpeed,
    						6193, 6717, -675, 1033, 128, cycleSpeed,
    						6193, 5966, -727, 1033, 128, cycleSpeed,
    						5804, 6818, -983, 1130, 163, cycleSpeed,
    						7262, 6806, -1153, 1418, 183, cycleSpeed,
    						8317, 7593, -1388, 1683, 233, cycleSpeed,
    						9258, 9134, -1765, 348, 311, cycleSpeed,
    						7638, 9070, -1256, 475, 249, cycleSpeed,
    						6660, 9037, -615, 459, 128, cycleSpeed,
    						6089, 9581, -698, 635, 158, cycleSpeed,
    						5578, 9715, -579, 650, 128, cycleSpeed
    					}
    				);
    				break;
    		}
    		reset();
    	}
    
    	private static final int warp(int speed) {
    		return ~speed + 2;
    	}
    	
    	private static double curve(double d, double d1) {
    		double d2 = d - d1;
    		double d3 = 2048.0D - d1 + d;
    		double d4 = 2048.0D - d + d1;
    		double d5 = Math.abs(d2);
    		double d6 = Math.abs(d3);
    		double d7 = Math.abs(d4);
    		if (d5 < d6 && d5 < d7)
    			return d2;
    
    		if (d6 < d5 && d6 < d7)
    			return d3;
    
    		if (d7 < d5 && d7 < d6)
    			return d4;
    
    		return d2;
    	}
    
    	private static double p5(double d) {
    		d = Math.abs(d);
    		return d * d * d * d * d;
    	}
    
    	public void cycle() {
    		boolean justReset = false;
    		while (cycles < 1) {
    			int total = cameraIndex.length / 6;
    			if (pos < 0 || pos >= total) {
    				if (loop && !justReset) {
    					justReset = true;
    					pos = 0;
    					cycles = 0;
    					//instance.resetWorld(0);
    					//instance.setNorth();
    					if (instance.plane != regionPlane) {
    						instance.plane = regionPlane;
    					}
    					if (instance.terrainRegionX != terrainRegionX 
    						|| instance.terrainRegionY != terrainRegionY) {
    						instance.generateWorld(terrainRegionX, terrainRegionY);
    					}
    					instance.resetWorld(1);;
    				}
    				return;
    			}
    			int idx = (pos << 2) + (pos << 1);
    			pos++;
    			if (cameraIndex[5 + idx] == 0x80000000) {
    				//instance.resetWorld(0);;
    				instance.setNorth();
    				if (instance.plane != cameraIndex[idx + 2])
    					instance.plane = cameraIndex[idx + 2];
    				if (instance.terrainRegionX != cameraIndex[idx] 
    					|| instance.terrainRegionY != cameraIndex[idx + 1]) {
    					instance.generateWorld(cameraIndex[idx], cameraIndex[idx + 1]);
    				}
    				instance.resetWorld(1);;
    				break;
    			}
    			double xPos = (double) cameraIndex[idx] - xCameraPos;
    			double yPos = (double) cameraIndex[1 + idx] - yCameraPos;
    			double zPos = (double) cameraIndex[2 + idx] - zCameraPos;
    			double xCurve = curve((double) (cameraIndex[3 + idx] & 2047), xCameraCurve);
    			double yCurve = curve((double) (cameraIndex[4 + idx] & 2047), yCameraCurve);
    			cycles = cameraIndex[5 + idx];
    			if (cycles < 1) {
    				int mult = ~cycles + 2;
    				double cyclesD = Math.pow(p5(xPos) + p5(yPos) + p5(zPos) + p5(xCurve) + p5(yCurve), 1.0D / 5.0D);
    				cycles = round(cyclesD / 7.5D);
    				if (cycles < 1)
    					cycles = 1;
    				cycles *= mult;
    			}
    			xCameraPosRate = xPos / (double) cycles;
    			yCameraPosRate = yPos / (double) cycles;
    			zCameraPosRate = zPos / (double) cycles;
    			xCameraCurveRate = xCurve / (double) cycles;
    			yCameraCurveRate = yCurve / (double) cycles;
    		}
    		if (cycles > 0) {
    			xCameraPos += xCameraPosRate;
    			yCameraPos += yCameraPosRate;
    			zCameraPos += zCameraPosRate;
    			xCameraCurve = sgn(xCameraCurve + xCameraCurveRate, 2048.0D);
    			yCameraCurve = sgn(yCameraCurve + yCameraCurveRate, 2048.0D);
    			update();
    			cycles--;
    		}
    	}
    
    	private static double sgn(double d, double d1) {
    		d %= d1;
    		return d < 0.0D ? d + d1:d;
    	}
    
    	private static int round(double d) {
    		if (d < 0.0D)
    			d -= 0.5D;
    		else
    			d += 0.5D;
    		return (int) d;
    	}
    
    	public void update() {
    		instance.xCameraPos = round(xCameraPos);
    		instance.yCameraPos = round(yCameraPos);
    		instance.zCameraPos = round(zCameraPos);
    		instance.xCameraCurve = round(xCameraCurve) & 2047;
    		instance.yCameraCurve = round(yCameraCurve) & 2047;
    	}
    
    	public void reset() {
    		pos = 1;
    		cycles = 0;
    		if (cameraIndex.length < 6)
    			return;
    
    		xCameraPos = (double) cameraIndex[0];
    		yCameraPos = (double) cameraIndex[1];
    		zCameraPos = (double) cameraIndex[2];
    		xCameraCurve = (double) (cameraIndex[3] & 2047);
    		yCameraCurve = (double) (cameraIndex[4] & 2047);
    		update();
    	}
    
    	public void stop() { }
    
    	private boolean loop;
    	private double xCameraPos;
    	private double yCameraPos;
    	private double zCameraPos;
    	private double xCameraCurve;
    	private double yCameraCurve;
    	private int cycles;
    	private double xCameraPosRate;
    	private double yCameraPosRate;
    	private double zCameraPosRate;
    	private double xCameraCurveRate;
    	private double yCameraCurveRate;
    	private int pos;
    	private Client instance;
    	public int[] cameraIndex;
    	public int terrainRegionX;
    	public int terrainRegionY;
    	public int regionPlane;
    }
    Code:
    	public int terrainRegionX;
    	public int terrainRegionY;
    	public int[] titleScreenOffsets = null;
    	public int titleWidth = -1;
    	public int titleHeight = -1;
    	public ScriptManager scriptManager;
    	public void generateWorld(int x, int y) {
    		terrainRegionX = x;
    		terrainRegionY = y;
    		aBoolean1159 = false;
    		if(anInt1069 == x && anInt1070 == y && loadingStage == 2) {
    			return;
    		}
    		anInt1069 = x;
    		anInt1070 = y;
    		baseX = (anInt1069 - 6) * 8;
    		baseY = (anInt1070 - 6) * 8;
    		aBoolean1141 = (anInt1069 / 8 == 48 || anInt1069 / 8 == 49) && anInt1070 / 8 == 48;
    		if(anInt1069 / 8 == 48 && anInt1070 / 8 == 148)
    			aBoolean1141 = true;
    		loadingStage = 1;
    		aLong824 = System.currentTimeMillis();
    		int k16 = 0;
    		for(int i21 = (anInt1069 - 6) / 8; i21 <= (anInt1069 + 6) / 8; i21++) {
    			for(int k23 = (anInt1070 - 6) / 8; k23 <= (anInt1070 + 6) / 8; k23++)
    				k16++;
    		}
    		aByteArrayArray1183 = new byte[k16][];
    		aByteArrayArray1247 = new byte[k16][];
    		anIntArray1234 = new int[k16];
    		anIntArray1235 = new int[k16];
    		anIntArray1236 = new int[k16];
    		k16 = 0;
    		for(int l23 = (anInt1069 - 6) / 8; l23 <= (anInt1069 + 6) / 8; l23++) {
    			for(int j26 = (anInt1070 - 6) / 8; j26 <= (anInt1070 + 6) / 8; j26++) {
    				anIntArray1234[k16] = (l23 << 8) + j26;
    				if(aBoolean1141 && (j26 == 49 || j26 == 149 || j26 == 147 || l23 == 50 || l23 == 49 && j26 == 47)) {
    					anIntArray1235[k16] = -1;
    					anIntArray1236[k16] = -1;
    					k16++;
    				} else {
    					int k28 = anIntArray1235[k16] = onDemandFetcher.method562(0, j26, l23);
    					if(k28 != -1)
    						onDemandFetcher.method558(3, k28);
    					int j30 = anIntArray1236[k16] = onDemandFetcher.method562(1, j26, l23);
    					if(j30 != -1)
    						onDemandFetcher.method558(3, j30);
    					k16++;
    				}
    			}
    		}
    		/*if(pktType == 241) {
    			int l16 = 0;
    			int ai[] = new int[676];
    			for(int i24 = 0; i24 < 4; i24++) {
    				for(int k26 = 0; k26 < 13; k26++) {
    					for(int l28 = 0; l28 < 13; l28++) {
    						int k30 = anIntArrayArrayArray1129[i24][k26][l28];
    						if(k30 != -1) {
    							int k31 = k30 >> 14 & 0x3ff;
    							int i32 = k30 >> 3 & 0x7ff;
    							int k32 = (k31 / 8 << 8) + i32 / 8;
    							for(int j33 = 0; j33 < l16; j33++) {
    								if(ai[j33] != k32)
    									continue;
    								k32 = -1;
    								
    							}
    							if(k32 != -1)
    								ai[l16++] = k32;
    						}
    					}
    				}
    			}
    			aByteArrayArray1183 = new byte[l16][];
    			aByteArrayArray1247 = new byte[l16][];
    			anIntArray1234 = new int[l16];
    			anIntArray1235 = new int[l16];
    			anIntArray1236 = new int[l16];
    			for(int l26 = 0; l26 < l16; l26++) {
    				int i29 = anIntArray1234[l26] = ai[l26];
    				int l30 = i29 >> 8 & 0xff;
    				int l31 = i29 & 0xff;
    				int j32 = anIntArray1235[l26] = onDemandFetcher.method562(0, l31, l30);
    				if(j32 != -1)
    					onDemandFetcher.method558(3, j32);
    				int i33 = anIntArray1236[l26] = onDemandFetcher.method562(1, l31, l30);
    				if(i33 != -1)
    					onDemandFetcher.method558(3, i33);
    			}
    		}*/
    		int i17 = baseX - anInt1036;
    		int j21 = baseY - anInt1037;
    		anInt1036 = baseX;
    		anInt1037 = baseY;
    		for(int j24 = 0; j24 < 16384; j24++) {
    			NPC npc = npcArray[j24];
    			if(npc != null) {
    				for(int j29 = 0; j29 < 10; j29++) {
    					npc.smallX[j29] -= i17;
    					npc.smallY[j29] -= j21;
    				}
    				npc.x -= i17 * 128;
    				npc.y -= j21 * 128;
    			}
    		}
    		for(int i27 = 0; i27 < maxPlayers; i27++) {
    			Player player = playerArray[i27];
    			if(player != null) {
    				for(int i31 = 0; i31 < 10; i31++) {
    					player.smallX[i31] -= i17;
    					player.smallY[i31] -= j21;
    				}
    				player.x -= i17 * 128;
    				player.y -= j21 * 128;
    			}
    		}
    		aBoolean1080 = true;
    		byte byte1 = 0;
    		byte byte2 = 104;
    		byte byte3 = 1;
    		if(i17 < 0) {
    			byte1 = 103;
    			byte2 = -1;
    			byte3 = -1;
    		}
    		byte byte4 = 0;
    		byte byte5 = 104;
    		byte byte6 = 1;
    		if(j21 < 0) {
    			byte4 = 103;
    			byte5 = -1;
    			byte6 = -1;
    		}
    		for(int k33 = byte1; k33 != byte2; k33 += byte3) {
    			for(int l33 = byte4; l33 != byte5; l33 += byte6) {
    				int i34 = k33 + i17;
    				int j34 = l33 + j21;
    				for(int k34 = 0; k34 < 4; k34++)
    					if(i34 >= 0 && j34 >= 0 && i34 < 104 && j34 < 104)
    						groundArray[k34][k33][l33] = groundArray[k34][i34][j34];
    					else
    						groundArray[k34][k33][l33] = null;
    			}
    		}
    		for(NodeSub_2 class30_sub1_1 = (NodeSub_2)aClass19_1179.reverseGetFirst(); class30_sub1_1 != null; class30_sub1_1 = (NodeSub_2)aClass19_1179.reverseGetNext()) {
    			class30_sub1_1.anInt1297 -= i17;
    			class30_sub1_1.anInt1298 -= j21;
    			if(class30_sub1_1.anInt1297 < 0 || class30_sub1_1.anInt1298 < 0 || class30_sub1_1.anInt1297 >= 104 || class30_sub1_1.anInt1298 >= 104)
    				class30_sub1_1.unlink();
    		}
    		if(destX != 0) {
    			destX -= i17;
    			destY -= j21;
    		}
    		aBoolean1160 = false;
    	}
    	
    	public void resetWorld(int stage) {
    		if(stage == 0) {
    			anInt1062 = 0;
    			anInt1278 = (int) (Math.random() * 100D) - 50;
    			anInt1131 = (int) (Math.random() * 110D) - 55;
    			anInt896 = (int) (Math.random() * 80D) - 40;
    			minimapInt2 = (int) (Math.random() * 120D) - 60;
    			minimapInt3 = (int) (Math.random() * 30D) - 20;
    			minimapInt1 = (int) (Math.random() * 20D) - 10 & 0x7ff;
    			anInt1021 = 0;
    			loadingStage = 1;
    		} else if(stage == 1) {
    			aBoolean1080 = false;
    		}
    	}
    	
    	private void loginScreenBG(boolean b) {
    		xCameraPos = 6100;
    		yCameraPos = 6867;
    		zCameraPos = -750;
    		xCameraCurve = 2040;
    		yCameraCurve = 383;
    		resetWorld(0);
    		if (b || scriptManager == null) {
    			scriptManager = new ScriptManager(this);
    		} else {
    			scriptManager.update();
    		}
    		plane = scriptManager.regionPlane;
    		generateWorld(scriptManager.terrainRegionX, scriptManager.terrainRegionY);
    		resetWorld(1);
    	}
    	
    	public void drawAnimatedWorldBackground(boolean display) {
    		if(display) {
    			int centerX = clientWidth / 2;
    			int centerY = clientHeight / 2;
    			if (scriptManager == null) {
    				loginScreenBG(true);
    			}
    			int canvasCenterX = Rasterizer.centerX;
    			int canvasCenterY = Rasterizer.centerY;
    			int canvasPixels[] = Rasterizer.lineOffsets;
    			if (titleScreenOffsets != null && (titleWidth != clientWidth || titleHeight != clientHeight)) {
    				titleScreenOffsets = null;
    			}
    			if (titleScreenOffsets == null) {
    				titleWidth = clientWidth;
    				titleHeight = clientHeight;
    				titleScreenOffsets = Rasterizer.getOffsets(titleWidth, titleHeight);
    			}
    			Rasterizer.centerX = centerX;
    			Rasterizer.centerY = centerY;
    			Rasterizer.lineOffsets = titleScreenOffsets;
    			if (loadingStage == 2 && Map.anInt131 != plane)
    				loadingStage = 1;
    
    			if (!loggedIn && loadingStage == 1) {
    				method54();
    			}
    			if (!loggedIn && loadingStage == 2 && plane != anInt985) {
    				anInt985 = plane;
    				renderedMapScene(plane);
    			}
    			if (loadingStage == 2) {
    				Rasterizer.triangles = 0;
    				try {
    					worldController.method313(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, method121(), yCameraCurve);
    					worldController.clearObj5Cache();
    				} catch (Exception ex) {
    					ex.printStackTrace();
    				}
    			}
    			if (scriptManager != null && loadingStage == 2 && plane == anInt985 && !loggedIn) {
    				scriptManager.cycle();
    			}
    			Rasterizer.centerX = canvasCenterX;
    			Rasterizer.centerY = canvasCenterY;
    			Rasterizer.lineOffsets = canvasPixels;
    		}
    	}
    Code:
    drawAnimatedWorldBackground(Config.displayWorld);
    Code:
    	int zoom = 0;
    	public void method146() {
    		anInt1265++;
    		int j = 0;
    		int l = xCameraPos;
    		int i1 = zCameraPos;
    		int j1 = yCameraPos;
    		int k1 = yCameraCurve;
    		int l1 = xCameraCurve;
    		if(loggedIn) {
    			method47(true);
    			method26(true);
    			method47(false);
    			method26(false);
    			method55();
    			method104();
    			if(!aBoolean1160) {
    				int i = anInt1184;
    				if(anInt984 / 256 > i)
    					i = anInt984 / 256;
    				if(aBooleanArray876[4] && anIntArray1203[4] + 128 > i)
    					i = anIntArray1203[4] + 128;
    				int k = minimapInt1 + anInt896 & 0x7ff;
    				int val = 600;
    				zoom = (clientState > 0 ? 2 : 4);
    				setCameraPos(val + i * zoom, i, anInt1014, method42(plane, myPlayer.y, myPlayer.x) - 50, k, anInt1015);
    				//myPlayer.turnDirection = 1092 - k & 0x7ff;
    			}
    			if(!aBoolean1160)
    				j = method120();
    			else
    				j = method121();
    			for(int i2 = 0; i2 < 5; i2++)
    				if(aBooleanArray876[i2]) {
    					int j2 = (int)((Math.random() * (double)(anIntArray873[i2] * 2 + 1) - (double)anIntArray873[i2]) + Math.sin((double)anIntArray1030[i2] * ((double)anIntArray928[i2] / 100D)) * (double)anIntArray1203[i2]);
    					if(i2 == 0)
    						xCameraPos += j2;
    					if(i2 == 1)
    						zCameraPos += j2;
    					if(i2 == 2)
    						yCameraPos += j2;
    					if(i2 == 3)
    						xCameraCurve = xCameraCurve + j2 & 0x7ff;
    					if(i2 == 4) {
    						yCameraCurve += j2;
    						if(yCameraCurve < 128)
    							yCameraCurve = 128;
    						if(yCameraCurve > 383)
    							yCameraCurve = 383;
    					}
    				}
    		}
    		int textures= Rasterizer.textureCount;
    		Model.aBoolean1684 = true;
    		Model.anInt1687 = 0;
    		Model.anInt1685 = super.mouseX - 4;
    		Model.anInt1686 = super.mouseY - 4;
    		DrawingArea.setAllPixelsToZero();	
    		if(loggedIn) {
    			worldController.method313(xCameraPos, yCameraPos, xCameraCurve, zCameraPos, j, yCameraCurve);
    			worldController.clearObj5Cache();
    		}
    		updateEntities();
    		drawHeadIcon();
    		animateTexturePalette(textures);
    		if(!fixedState() && loggedIn) {
    			drawTabArea();
    			drawChatArea();
    			drawMinimap();
    		}
    		if(loggedIn)
    			draw3dScreen();
    		drawConsole();
    		drawConsoleArea();
    		if(loggedIn) {
    			inGameScreen.drawGraphics(4, super.graphics, 4);
    			xCameraPos = l;
    			zCameraPos = i1;
    			yCameraPos = j1;
    			yCameraCurve = k1;
    			xCameraCurve = l1;
    		}
    	}
    Code:
    	private final void method22() {
    		try {
                anInt985 = -1;
                aClass19_1056.removeAll();
                aClass19_1013.removeAll();
                Texture.method366();
                unlinkMRUNodes();
                worldController.initToNull();
                System.gc();
                for(int i = 0; i < 4; i++)
                    aClass11Array1230[i].method210();
                for(int l = 0; l < 4; l++) {
                    for(int k1 = 0; k1 < 104; k1++) {
                        for(int j2 = 0; j2 < 104; j2++)
                            byteGroundArray[l][k1][j2] = 0;
                    }
                }
                Map objectManager = new Map(byteGroundArray, intGroundArray);
                int k2 = aByteArrayArray1183.length;
    			if(loggedIn)
    				data.createFrame(0);
                if(!aBoolean1159) {
    				try {
    					for(int i3 = 0; i3 < k2; i3++) {
    						int i4 = (anIntArray1234[i3] >> 8) * 64 - baseX;
    						int k5 = (anIntArray1234[i3] & 0xff) * 64 - baseY;
    						byte abyte0[] = aByteArrayArray1183[i3];
    						if(Config.debugPrint)
    							System.out.println("Floor maps: "+anIntArray1235[i3]);
    						if(abyte0 != null) {
    							objectManager.method180(abyte0, k5, i4, (anInt1069 - 6) * 8, (anInt1070 - 6) * 8, aClass11Array1230);
    						}
    					}
    					for(int j4 = 0; j4 < k2; j4++) {
    						int l5 = (anIntArray1234[j4] >> 8) * 62 - baseX;
    						int k7 = (anIntArray1234[j4] & 0xff) * 62 - baseY;
    						byte abyte2[] = aByteArrayArray1183[j4];
    						if(abyte2 == null && anInt1070 < 800)
    							objectManager.method174(k7, 64, 64, l5);
    					}
    					anInt1097++;
    					if(anInt1097 > 160) {
    						anInt1097 = 0;
    						data.createFrame(238);
    						data.writeByte(96);
    					}
    					if(loggedIn)
    						data.createFrame(0);
    					for(int i6 = 0; i6 < k2; i6++) {
    						byte abyte1[] = aByteArrayArray1247[i6];
    						if(Config.debugPrint)
    							System.out.println("Object maps: "+anIntArray1236[i6]);
    						if(abyte1 != null) {
    							int l8 = (anIntArray1234[i6] >> 8) * 64 - baseX;
    							int k9 = (anIntArray1234[i6] & 0xff) * 64 - baseY;
    							objectManager.method190(l8, aClass11Array1230, k9, worldController, abyte1);
    						}
    					}
    				} catch(Exception e) {
    					e.printStackTrace();
    				}
    			}
                if(aBoolean1159) {
                    for(int j3 = 0; j3 < 4; j3++) {
                        for(int k4 = 0; k4 < 13; k4++) {
                            for(int j6 = 0; j6 < 13; j6++) {
                                int l7 = anIntArrayArrayArray1129[j3][k4][j6];
                                if(l7 != -1) {
                                    int i9 = l7 >> 24 & 3;
                                    int l9 = l7 >> 1 & 3;
                                    int j10 = l7 >> 14 & 0x3ff;
                                    int l10 = l7 >> 3 & 0x7ff;
                                    int j11 = (j10 / 8 << 8) + l10 / 8;
                                    for(int l11 = 0; l11 < anIntArray1234.length; l11++) {
                                        if(anIntArray1234[l11] != j11 || aByteArrayArray1183[l11] == null)
                                            continue;
                                        objectManager.method179(i9, l9, aClass11Array1230, k4 * 8, (j10 & 7) * 8, aByteArrayArray1183[l11], (l10 & 7) * 8, j3, j6 * 8);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    for(int l4 = 0; l4 < 13; l4++) {
                        for(int k6 = 0; k6 < 13; k6++) {
                            int i8 = anIntArrayArrayArray1129[0][l4][k6];
                            if(i8 == -1)
                                objectManager.method174(k6 * 8, 8, 8, l4 * 8);
                        }
                    }
    				if(loggedIn)
    					data.createFrame(0);
                    for(int l6 = 0; l6 < 4; l6++) {
                        for(int j8 = 0; j8 < 13; j8++) {
                            for(int j9 = 0; j9 < 13; j9++) {
                                int i10 = anIntArrayArrayArray1129[l6][j8][j9];
                                if(i10 != -1) {
                                    int k10 = i10 >> 24 & 3;
                                    int i11 = i10 >> 1 & 3;
                                    int k11 = i10 >> 14 & 0x3ff;
                                    int i12 = i10 >> 3 & 0x7ff;
                                    int j12 = (k11 / 8 << 8) + i12 / 8;
                                    for(int k12 = 0; k12 < anIntArray1234.length; k12++) {
                                        if(anIntArray1234[k12] != j12 || aByteArrayArray1247[k12] == null)
                                            continue;
    									objectManager.method183(aClass11Array1230, worldController, k10, j8 * 8, (i12 & 7) * 8, l6, aByteArrayArray1247[k12], (k11 & 7) * 8, i11, j9 * 8);
    								}
                                }
                            }
                        }
                    }
                }
    			if(loggedIn)
    				data.createFrame(0);
                objectManager.addTile(aClass11Array1230, worldController);
                inGameScreen.initDrawingArea();
                if(loggedIn)
    				data.createFrame(0);
                int k3 = Map.setZ;
                if(k3 > plane)
                    k3 = plane;
                if(k3 < plane - 1)
                    k3 = plane - 1;
                if(lowMem)
                    worldController.method275(Map.setZ);
                else
                    worldController.method275(0);
                for(int i5 = 0; i5 < 104; i5++) {
                    for(int i7 = 0; i7 < 104; i7++)
                        spawnGroundItem(i5, i7);
                }
                anInt1051++;
                if(anInt1051 > 98) {
                    anInt1051 = 0;
    				if(loggedIn)
    					data.createFrame(150);
                }
                method63();
    		} catch (Exception exception) {
    		}
    		ObjectDefinition.modelCache.unlinkAll();
            if(super.gameFrame != null && loggedIn) {
                data.createFrame(210);
                data.writeDWord(0x3f008edd);
            }
            System.gc();
            Texture.method367();
            onDemandFetcher.method566();
            int k = (anInt1069 - 6) / 8 - 1;
            int j1 = (anInt1069 + 6) / 8 + 1;
            int i2 = (anInt1070 - 6) / 8 - 1;
            int l2 = (anInt1070 + 6) / 8 + 1;
            if(aBoolean1141) {
                k = 49;
                j1 = 50;
                i2 = 49;
                l2 = 50;
            }
            for(int l3 = k; l3 <= j1; l3++) {
                for(int j5 = i2; j5 <= l2; j5++)
                    if(l3 == k || l3 == j1 || j5 == i2 || j5 == l2) {
    					int j7 = onDemandFetcher.method562(0, j5, l3);
    					if(j7 != -1)
    						onDemandFetcher.method560(j7, 3);
    					int k8 = onDemandFetcher.method562(1, j5, l3);
    					if(k8 != -1)
    						onDemandFetcher.method560(k8, 3);
    				}
    		}
    	}
    Code:
    	private void renderedMapScene(int i) {//method24
    		int ai[] = minimapImage.myPixels;
    		int j = ai.length;
    		for(int k = 0; k < j; k++)
    			ai[k] = 0;
    		for(int l = 1; l < 103; l++) {
    			int i1 = 24628 + (103 - l) * 512 * 4;
    			for(int k1 = 1; k1 < 103; k1++) {
    				if((byteGroundArray[i][k1][l] & 0x18) == 0)
    					worldController.method309(ai, i1, i, k1, l);
    				if(i < 3 && (byteGroundArray[i + 1][k1][l] & 8) != 0)
    					worldController.method309(ai, i1, i + 1, k1, l);
    				i1 += 4;
    			}
    		}
    		
    		int j1;
    		int l1;
    		if(Config.randomize) {
    			j1 = ((238 + (int)(Math.random() * 20D)) - 10 << 16) + ((238 + (int)(Math.random() * 20D)) - 10 << 8) + ((238 + (int)(Math.random() * 20D)) - 10);
    			l1 = (238 + (int)(Math.random() * 20D)) - 10 << 16;
    		} else {
    			j1 = 0xffffff;
    			l1 = 0xee0000;
    		}
    		if(loggedIn)
    			minimapImage.method343();
    		for(int i2 = 1; i2 < 103; i2++) {
    			for(int j2 = 1; j2 < 103; j2++) {
    				if((byteGroundArray[i][j2][i2] & 0x18) == 0)
    					drawMapScenes(i2, j1, j2, l1, i);
    				if(i < 3 && (byteGroundArray[i + 1][j2][i2] & 8) != 0)
    					drawMapScenes(i2, j1, j2, l1, i + 1);
    			}
    		}
    		if(loggedIn)
    			inGameScreen.initDrawingArea();
    		anInt1071 = 0;
    		for(int k2 = 0; k2 < 104; k2++) {
    			for(int l2 = 0; l2 < 104; l2++) {
    				int objectId = worldController.method303(plane, k2, l2);
    				if(objectId != 0) {
    					objectId = objectId >> 14 & 0x7fff;
    					int objectFunctionId = ObjectDefinition.forID(objectId).mapFunctionId;
    					if(objectFunctionId >= 0) {
    						int k3 = k2;
    						int l3 = l2;
    						if(objectFunctionId != 22 && objectFunctionId != 29 && objectFunctionId != 34 && objectFunctionId != 36 && objectFunctionId != 46 && objectFunctionId != 47 && objectFunctionId != 48) {
    							//Mapfuntion offset
    							/*byte byte0 = 104;
    							byte byte1 = 104;
    							int ai1[][] = aClass11Array1230[plane].anIntArrayArray294;
    							for(int i4 = 0; i4 < 10; i4++) {
    								int j4 = (int)(Math.random() * 4D);
    								if(j4 == 0 && k3 > 0 && k3 > k2 - 3 && (ai1[k3 - 1][l3] & 0x1280108) == 0)
    									k3--;
    								if(j4 == 1 && k3 < byte0 - 1 && k3 < k2 + 3 && (ai1[k3 + 1][l3] & 0x1280180) == 0)
    									k3++;
    								if(j4 == 2 && l3 > 0 && l3 > l2 - 3 && (ai1[k3][l3 - 1] & 0x1280102) == 0)
    									l3--;
    								if(j4 == 3 && l3 < byte1 - 1 && l3 < l2 + 3 && (ai1[k3][l3 + 1] & 0x1280120) == 0)
    									l3++;
    							}*/
    						}
    						aSpriteArray1140[anInt1071] = mapFunctions[objectFunctionId];
    						anIntArray1072[anInt1071] = k3;
    						anIntArray1073[anInt1071] = l3;
    						anInt1071++;
    					}
    				}
    			}
    		}
    	}
    In the login(String, String, boolean) method, below
    Code:
    if(k == 2) {
    add
    Code:
    				scriptManager = null;
    				titleScreenOffsets = null;
    In method54,
    Code:
    			method22();
    			if(loggedIn)
    				data.createFrame(121);
    Code:
    newRegularFont.drawBasicString("Region: " + anInt1069 + ", " + anInt1070, x, y, 0xffff00, shadow);

    Credits
    ScriptManager creator
    Keldagrim


    Nice one man, will use.
    Reply With Quote  
     

  7. Thankful user:


  8. #5  
    Retired. Stop PMing me.

    Galkon's Avatar
    Join Date
    Nov 2007
    Age
    14
    Posts
    7,528
    Thanks given
    1,783
    Thanks received
    2,822
    Discord
    View profile
    Rep Power
    5000
    Credits to Killer 99 for all that really
    [Only registered and activated users can see links. ]
    Reply With Quote  
     


  9. #6  
    ಠ_ಠ

    Joshua's Avatar
    Join Date
    May 2010
    Posts
    1,907
    Thanks given
    397
    Thanks received
    708
    Rep Power
    803
    Is the cpu usage any better than the keldagrim client, or is this completely ripped out? Because it chewed through cpu.




    [Only registered and activated users can see links. ]

    Spoiler for Eye Bleach & Recent Releases:



    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ]


    Reply With Quote  
     

  10. #7  
    Registered Member

    Join Date
    Jun 2012
    Posts
    204
    Thanks given
    61
    Thanks received
    77
    Rep Power
    104
    Quote Originally Posted by Joshua View Post
    Is the cpu usage any better than the keldagrim client, or is this completely ripped out? Because it chewed through cpu.
    Add it and see for yourself, if it does then you can just disable it.
    I don't notice any issues when it's running, keeps a stable fps and runs pretty smooth.
    Reply With Quote  
     

  11. Thankful user:


  12. #8  
    Registered Member Iceyblue112's Avatar
    Join Date
    Mar 2012
    Posts
    302
    Thanks given
    23
    Thanks received
    19
    Rep Power
    28
    Wow, this is great!
    I am ICEYBLUE112
    Reply With Quote  
     

  13. Thankful user:


  14. #9  
    Registered Member

    Join Date
    Dec 2007
    Age
    28
    Posts
    1,954
    Thanks given
    114
    Thanks received
    608
    Rep Power
    1094
    Nice.
    Reply With Quote  
     

  15. Thankful user:


  16. #10  
    Google it ffs

    Reich's Avatar
    Join Date
    Mar 2011
    Age
    27
    Posts
    832
    Thanks given
    120
    Thanks received
    174
    Rep Power
    105
    Is this just the animated background from Galkons client?
    Programmers are machines that convert caffeine into code
    Reply With Quote  
     

Page 1 of 5 123 ... LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 19
    Last Post: 12-19-2012, 08:42 PM
  2. Replies: 0
    Last Post: 08-01-2012, 11:25 AM
  3. (req) game of thrones style background
    By Lord Stark in forum Graphics
    Replies: 0
    Last Post: 10-05-2011, 03:10 AM
  4. World War Game
    By hedgefund in forum Humor
    Replies: 10
    Last Post: 05-08-2010, 11:17 AM
  5. Animated Background :D
    By Clienthax in forum Show-off
    Replies: 35
    Last Post: 03-17-2009, 07:32 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •