Downloads containing dscity.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: City by Dollar Studios szmol96 Custom / Concept N/A Download file

File preview

/**City by Dollar Studios**/
/**Script by szmol96**/

/**System related******************************************/
bool sysKeyHeld;
bool pcKeyHeld;
const int UP = 0x26;
const int DOWN = 0x28;
int doorTimer = 0;
bool inZone = false;

int subXPos = 0;
const int subYPos = 322 * 32;
int subSpeed = 8;
bool subTimerSet = false;
int subStopTimer = 0;
bool subCanGo = true;
bool subTravel = false;


array<int> subTiles = {2890, 2891, 2892, 2893, 2894, 2895, 2896, 2897,
						2900, 2901, 2902, 2903, 2904, 2905, 2906, 2907,
						2910, 2911, 2912, 2913, 2914, 2915, 2916, 2917,
						2920, 2921, 2922, 2923, 2924, 2925, 2926, 2927};
						
array<int> subTiles2 = {2890, 2891, 2892, 2893, 2894, 2878, 2879, 2849,
						2900, 2901, 2902, 2903, 2904, 2888, 2889, 2859,
						2910, 2911, 2912, 2913, 2914, 2898, 2899, 2869,
						2920, 2921, 2922, 2923, 2924, 2925, 2926, 2927};

array<int> subTilesX = {256, 224, 192, 160, 128, 96, 64, 32,
						256, 224, 192, 160, 128, 96, 64, 32,
						256, 224, 192, 160, 128, 96, 64, 32,
						256, 224, 192, 160, 128, 96, 64, 32,};

array<int> subTilesY = {128, 128, 128, 128, 128, 128, 128, 128,
						96, 96, 96, 96, 96, 96, 96, 96,
						64, 64, 64, 64, 64, 64, 64, 64,
						32, 32, 32, 32, 32, 32, 32, 32};
						
/**********************************************************/

/**PC related**********************************************/
const int F8 = 0x77;
const int NUM0 = 0x60;
const int NUM1 = 0x61;
const int NUM2 = 0x62;
const int NUM3 = 0x63;
const int NUM4 = 0x64;
const int NUM5 = 0x65;
const int NUM6 = 0x66;
const int NUM7 = 0x67;
const int NUM8 = 0x68;
const int NUM9 = 0x69;

int bootTimer = 0;
int pSelected = 1;
bool cameraOn = false;
int cx = 0;
int cy = 8064;
bool wc = false;
bool ma = false;
bool sp = false;
bool sh = false;
bool nc = false;
bool fb = false;

array<bool> PCOn(2, false);
array<bool> PCLoggedIn(2, false);
array<int> PCState(2, 0); //0 = booting, 1 = main, 2 = musicplayer, 3 = controlpanel, 4 = adminpanel, 5 = observercamera, 6 = mute, 7 = unmute, 8 = kick, 9 = ban, 10 = unban, 11 = kill


bool playerInZone(int xBiggerThan, int xSmallerThan, int yBiggerThan, int ySmallerThan, int playerID) {
		return (jjPlayers[playerID].xPos > xBiggerThan && jjPlayers[playerID].xPos < xSmallerThan && jjPlayers[playerID].yPos > yBiggerThan && jjPlayers[playerID].yPos < ySmallerThan );
}

void PCBoot(jjCANVAS@ canvas, int i) {
	cameraOn = false;
	if (bootTimer < 350) canvas.drawString(p.cameraX + 48, p.cameraY + 70, "Booting...", STRING::MEDIUM, STRING::NORMAL);
	if (bootTimer < 280) canvas.drawString(p.cameraX + 48, p.cameraY + 92, "Checking Hard Drive...", STRING::MEDIUM, STRING::NORMAL);
	if (bootTimer < 230) canvas.drawString(p.cameraX + 48, p.cameraY + 114, "OK", STRING::MEDIUM, STRING::NORMAL);
	if (bootTimer < 160) canvas.drawString(p.cameraX + 48, p.cameraY + 136, "Starting system...", STRING::MEDIUM, STRING::NORMAL);
	if (bootTimer == 0) {
		canvas.drawString(p.cameraX + 48, p.cameraY + 158, "Welcome to JOS Beta.", STRING::MEDIUM, STRING::NORMAL);
		canvas.drawString(p.cameraX + 48, p.cameraY + 180, "Press 0", STRING::MEDIUM, STRING::NORMAL);
	}
	if (jjKey[NUM0] && !pcKeyHeld && bootTimer == 0) PCState[i] = 1;
}

void PCMainMenu(jjCANVAS@ canvas, int i, jjPLAYER@ p) {
	canvas.drawString (p.cameraX + 96, p.cameraY + 70, "Main menu", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString (p.cameraX + 48, p.cameraY + 92, "1: Music player", STRING::MEDIUM, STRING::NORMAL);
	if (jjIsAdmin || jjIsServer) {
		canvas.drawString(p.cameraX + 48, p.cameraY + 114, "2: Control panel", STRING::MEDIUM, STRING::NORMAL);
		canvas.drawString(p.cameraX + 48, p.cameraY + 136, "3: Admin panel", STRING::MEDIUM, STRING::NORMAL);
		canvas.drawString(p.cameraX + 48, p.cameraY + 158, "4: Observer camera", STRING::MEDIUM, STRING::NORMAL);
		canvas.drawString(p.cameraX + 320, p.cameraY + 420, "Logged in as " + p.name, STRING::SMALL, STRING::NORMAL);
		canvas.drawString(p.cameraX + 320, p.cameraY + 438, "You have admin rights.", STRING::SMALL, STRING::NORMAL);
		if (jjKey[NUM3] && !pcKeyHeld) PCState[i] = 4;
		if (jjKey[NUM4] && !pcKeyHeld) PCState[i] = 5;
	} else {
		canvas.drawString(p.cameraX + 48, p.cameraY + 114, "2: Control panel", STRING::MEDIUM, STRING::NORMAL);
		canvas.drawString(p.cameraX + 48, p.cameraY + 136, "3: Observer camera", STRING::MEDIUM, STRING::NORMAL);
		canvas.drawString(p.cameraX + 320, p.cameraY + 438, "Logged in as " + p.name, STRING::SMALL, STRING::NORMAL);
		if (jjKey[NUM3] && !pcKeyHeld) PCState[i] = 5;
	}
	if (jjKey[NUM1] && !pcKeyHeld) PCState[i] = 2;
	if (jjKey[NUM2] && !pcKeyHeld) PCState[i] = 3;
}

void PCMusicPlayer(jjCANVAS@ canvas, int i) {
	canvas.drawString(p.cameraX + 96, p.cameraY + 70, "Music player", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 92, "1: Alexander Brandon - Diamondus Remix", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 114, "2: Alexander Brandon - Labratory Level", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 136, "3: Alexander Brandon - Beach Bunny!", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 158, "4: Alexander B. - Tubelectric Remix", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 180, "5: Alexander Brandon - Jazz be Damned", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 202, "6: Alexander B. - Dark Groove (part 1)", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 224, "0: Back", STRING::MEDIUM, STRING::NORMAL);
	if (jjKey[NUM0] && !pcKeyHeld) PCState[i] = 1;
	if (jjKey[NUM1] && !pcKeyHeld) jjMusicLoad("Diamond.j2b", true);
	if (jjKey[NUM2] && !pcKeyHeld) jjMusicLoad("Labrat.j2b", true);
	if (jjKey[NUM3] && !pcKeyHeld) jjMusicLoad("Beach.j2b", true);
	if (jjKey[NUM4] && !pcKeyHeld) jjMusicLoad("Tubelec.j2b", true);
	if (jjKey[NUM5] && !pcKeyHeld) jjMusicLoad("Dang.j2b", true);
	if (jjKey[NUM6] && !pcKeyHeld) jjMusicLoad("Hell.j2b", true);
}

void PCControlPanel(jjCANVAS@ canvas, int i) {
	canvas.drawString(p.cameraX + 96, p.cameraY + 70, "Control panel", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 92, "1: Switch Wall Climbing", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 114, "2: Switch mouse aiming", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 136, "3: Mute a player", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 158, "4: Unmute a player", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 180, "0: Back", STRING::MEDIUM, STRING::NORMAL);
	if (jjKey[NUM0] && !pcKeyHeld) PCState[i] = 1;
	if (jjKey[NUM1] && !pcKeyHeld) {
		if (!wc) {
			jjChat("/wc on");
			wc = true;
		} else {
			jjChat("/wc off");
			wc = false;
		}
	}
	if (jjKey[NUM2] && !pcKeyHeld) {
		if (!ma) {
			jjChat("/mouseaim on");
			ma = true;
		} else {
			jjChat("/mouseaim off");
			ma = false;
		}
	}
	if (jjKey[NUM3] && !pcKeyHeld) PCState[i] = 6;
	if (jjKey[NUM4] && !pcKeyHeld) PCState[i] = 7;
}

void PCAdminPanel(jjCANVAS@ canvas, int i) {
	canvas.drawString(p.cameraX + 96, p.cameraY + 70, "Admin panel", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 92, "1: Kick a player", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 114, "2: Ban a player", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 136, "3: Unban a player", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 158, "4: Kill a player", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 180, "5: Switch spectating", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 202, "6: Switch shutup", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 224, "7: Switch no carrots", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 246, "8: Switch fireball", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 268, "0: Back", STRING::MEDIUM, STRING::NORMAL);
	if (jjKey[NUM1] && !pcKeyHeld) PCState[i] = 8;
	if (jjKey[NUM2] && !pcKeyHeld) PCState[i] = 9;
	if (jjKey[NUM3] && !pcKeyHeld) PCState[i] = 10;
	if (jjKey[NUM4] && !pcKeyHeld) PCState[i] = 11;
	if (jjKey[NUM5] && !pcKeyHeld) {
		if (!sp) {
			jjChat("/spectating on");
			sp = true;
		} else {
			jjChat("/spectating off");
			sp = false;
		}
	}
	if (jjKey[NUM6] && !pcKeyHeld) {
		if (!sh) {
			jjChat("/shutup on");
			sh = true;
		} else {
			jjChat("/shutup off");
			sh = false;
		}
	}
	if (jjKey[NUM7] && !pcKeyHeld) {
		if (!nc) {
			jjChat("/nocarrots on");
			nc = true;
		} else {
			jjChat("/nocarrots off");
			nc = false;
		}
	}
	if (jjKey[NUM8] && !pcKeyHeld) {
		if (!fb) {
			jjChat("/fireball on");
			fb = true;
		} else {
			jjChat("/fireball off");
			fb = false;
		}
	}
	if (jjKey[NUM0] && !pcKeyHeld) PCState[i] = 1;
}

void PCObserverCamera(jjCANVAS@ canvas, int i, jjPLAYER@ p) {
	cameraOn = true;
	canvas.drawString(p.cameraX + 96, p.cameraY + 70, "2, 4, 6, 8: Move camera, 0: Back", STRING::SMALL, STRING::NORMAL);
	if (jjKey[NUM2]) cy = cy + 10;
	if (jjKey[NUM4]) cx = cx - 10;
	if (jjKey[NUM6]) cx = cx + 10;
	if (jjKey[NUM8]) cy = cy - 10;
	p.cameraFreeze(cx, cy, false, false);
	if (jjKey[NUM0] && !pcKeyHeld) {
		PCState[i] = 1;
		cameraOn = false;
	}
}

void mutePlayer(jjCANVAS@ canvas, int i) {
	canvas.drawString(p.cameraX + 96, p.cameraY + 70, "Mute a player", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 92, "1, 2: Change player number", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 114, "3: Mute", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 136, "0: Back", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 158, "Player: " + pSelected, STRING::MEDIUM, STRING::NORMAL);
	
	if (jjKey[NUM1] && !pcKeyHeld) pSelected--;
	if (jjKey[NUM2] && !pcKeyHeld) pSelected++;
	if (jjKey[NUM3] && !pcKeyHeld) jjChat("/mute" + pSelected);
	if (jjKey[NUM0] && !pcKeyHeld) PCState[i] = 3;
}

void unmutePlayer(jjCANVAS@ canvas, int i) {
	canvas.drawString(p.cameraX + 96, p.cameraY + 70, "Unmute a player", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 92, "1, 2: Change player number", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 114, "3: Unmute", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 136, "0: Back", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 158, "Player: " + pSelected, STRING::MEDIUM, STRING::NORMAL);
	
	if (jjKey[NUM1] && !pcKeyHeld) pSelected--;
	if (jjKey[NUM2] && !pcKeyHeld) pSelected++;
	if (jjKey[NUM3] && !pcKeyHeld) jjChat("/unmute" + pSelected);
	if (jjKey[NUM0] && !pcKeyHeld) PCState[i] = 3;
}

void kickPlayer(jjCANVAS@ canvas, int i) {
	canvas.drawString(p.cameraX + 96, p.cameraY + 70, "Kick a player", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 92, "1, 2: Change player number", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 114, "3: Kick", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 136, "0: Back", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 158, "Player: " + pSelected, STRING::MEDIUM, STRING::NORMAL);
	
	if (jjKey[NUM1] && !pcKeyHeld) pSelected--;
	if (jjKey[NUM2] && !pcKeyHeld) pSelected++;
	if (jjKey[NUM3] && !pcKeyHeld) jjChat("/kick" + pSelected);
	if (jjKey[NUM0] && !pcKeyHeld) PCState[i] = 4;
}

void banPlayer(jjCANVAS@ canvas, int i) {
	canvas.drawString(p.cameraX + 96, p.cameraY + 70, "Ban a player", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 92, "1, 2: Change player number", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 114, "3: Ban", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 136, "0: Back", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 158, "Player: " + pSelected, STRING::MEDIUM, STRING::NORMAL);
	
	if (jjKey[NUM1] && !pcKeyHeld) pSelected--;
	if (jjKey[NUM2] && !pcKeyHeld) pSelected++;
	if (jjKey[NUM3] && !pcKeyHeld) jjChat("/ban" + pSelected);
	if (jjKey[NUM0] && !pcKeyHeld) PCState[i] = 4;
}

void unbanPlayer(jjCANVAS@ canvas, int i) {
	canvas.drawString(p.cameraX + 96, p.cameraY + 70, "Unban a player", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 92, "1, 2: Change player number", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 114, "3: Unban", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 136, "0: Back", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 158, "Player: " + pSelected, STRING::MEDIUM, STRING::NORMAL);
	
	if (jjKey[NUM1] && !pcKeyHeld) pSelected--;
	if (jjKey[NUM2] && !pcKeyHeld) pSelected++;
	if (jjKey[NUM3] && !pcKeyHeld) jjChat("/unban" + pSelected);
	if (jjKey[NUM0] && !pcKeyHeld) PCState[i] = 4;
}

void killPlayer(jjCANVAS@ canvas, int i) {
	canvas.drawString(p.cameraX + 96, p.cameraY + 70, "Kill a player", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 92, "1, 2: Change player number", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 114, "3: Kill", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 136, "0: Back", STRING::MEDIUM, STRING::NORMAL);
	canvas.drawString(p.cameraX + 48, p.cameraY + 158, "Player: " + pSelected, STRING::MEDIUM, STRING::NORMAL);
	
	if (jjKey[NUM1] && !pcKeyHeld) pSelected--;
	if (jjKey[NUM2] && !pcKeyHeld) pSelected++;
	if (jjKey[NUM3] && !pcKeyHeld) jjChat("/k" + pSelected);
	if (jjKey[NUM0] && !pcKeyHeld) PCState[i] = 4;
}

/**********************************************************/

void sub() {
	jjPLAYER@ p = jjLocalPlayers[0];
	for(int i = 0; i < 32; i++) {
		jjDrawTile(subXPos - subTilesX[i], subYPos - subTilesY[i], subTiles[i], TILE::ALLQUADRANTS, 5, 5, p.playerID);
		jjDrawTile(subXPos - 256 - subTilesX[i], subYPos - subTilesY[i], subTiles2[i], TILE::ALLQUADRANTS, 5, 5, p.playerID);
	}
	
	if (subXPos > 32000) subXPos = 1024;
	if (subStopTimer > 0) subStopTimer--;
	
	if ((subXPos > 157 * 32 && subXPos < 159 * 32) || (subXPos > 480 * 32 && subXPos < 482 * 32) || (subXPos > 838 * 32 && subXPos < 840 * 32)) subCanGo = false;

	if (subCanGo == false && subSpeed > 0 && jjGameTicks % 45 == 0) subSpeed--;
	
	if (subSpeed == 0) {
		if (subCanGo == false && subTimerSet == false) {
			subStopTimer = 5 * 70;
			subTimerSet = true;
		}
		if (subStopTimer == 0 && subCanGo == false) {
			subCanGo = true;
			subTimerSet = false;
		}
		if (p.xPos < subXPos - 96 && p.xPos > subXPos - 512 && p.yPos < subYPos && p.yPos > subYPos	- 128 && subTravel == false) {
			jjDrawTile(p.xPos - 16, p.yPos - (75 + jjCos(jjGameTicks*16)*(1*4)),2813, TILE::ALLQUADRANTS, 2, 2, p.playerID);
			if (jjKey[UP] && p.xSpeed == 0) subTravel = true;
		}
		if (subTravel == true) {
			jjDrawTile(subXPos - 256, subYPos - 96 - (75 + jjCos(jjGameTicks*16)*(1*4)),2823, TILE::ALLQUADRANTS, 2, 2, p.playerID);
			if (jjKey[DOWN]) {
				subTravel = false;
				p.xPos = subXPos - 128;
				p.yPos = subYPos - 48;
			}
		}
	}

	if (subCanGo == true && subSpeed < 8 && jjGameTicks % 38 == 0) subSpeed++;

	subXPos += subSpeed;
	
	if (subTravel == true) {
		p.cameraFreeze(subXPos - 512, subYPos - 288, false, true);
		p.xPos = 0;
		p.yPos = 0;
	} else {
		p.cameraUnfreeze();
	}
}

void onLevelBegin() {
	jjAlert("The script works");
	jjTileType[926] = 5;
	jjTileType[927] = 5;
}

void onPlayer(jjPLAYER@ p) {
	jjOBJ@ silvercoin;

	int actionID;
	
	if (doorTimer > 0) doorTimer--;
	if (bootTimer > 0) bootTimer--;
	
	if (pSelected < 1) pSelected = 1;
	if (pSelected > 32) pSelected = 32;
	
	if (jjEventGet(p.xPos/32, p.yPos/32) == AREA::PATH && jjKey[UP] && !sysKeyHeld && p.xSpeed == 0 && doorTimer == 0) {
		actionID = jjParameterGet(p.xPos/32, p.yPos/32, 0, 6);
		
		switch (actionID) {
			case 1:
				p.ySpeed = 5;
				p.warpToTile(9, 268, true);
				doorTimer = 35;
				break;
			case 2:
				p.ySpeed = 5;
				p.warpToTile(9, 271, true);
				doorTimer = 35;
				break;
			case 3:
				p.ySpeed = 5;
				p.warpToTile(366, 268, true);
				doorTimer = 35;
				break;
			case 4:
				p.ySpeed = 5;
				p.warpToTile(366, 271, true);
				doorTimer = 35;
				break;
			case 5:
				jjAlert("A padlásra még nem lehet felmenni.");
				@silvercoin = jjObjects[jjAddObject(OBJECT::SILVERCOIN, p.xPos, p.yPos, 0, CREATOR::LEVEL)];
				break;
			case 6:
				if (PCOn[0] == false) {
					PCOn[0] = true;
				} else if (PCLoggedIn[0] == false) {
					PCOn[0] = false;
					p.cameraUnfreeze();
				}
				break;
			case 7:
				p.ySpeed = 5;
				p.warpToTile(39, 268, true);
				doorTimer = 35;
				break;
			case 8:
				p.ySpeed = 5;
				p.warpToTile(39, 271, true);
				doorTimer = 35;
				p.fly = FLIGHT::NONE;
				break;
			case 9:
			if (PCOn[1] == false) {
					PCOn[1] = true;
				} else if (PCLoggedIn[1] == false) {
					PCOn[1] = false;
					p.cameraUnfreeze();
				}
				break;
		}
	}
	
	if (PCOn[0] == true) {
//		p.cameraFreeze(p.cameraX, p.cameraY, false, false);
		p.xPos = 24*32-16;
		p.yPos = 262*32-24;
		p.direction = 1;
		p.keyRun = true;
		if (PCLoggedIn[0] == false && jjKey[F8] && !sysKeyHeld) {
			PCLoggedIn[0] = true;
			bootTimer = 350;
			PCState[0] = 0;
		} else if (PCLoggedIn[0] == true && jjKey[F8] && !sysKeyHeld) {
			PCLoggedIn[0] = false;
			jjMusicLoad("cityligh.mod", false);
		}
	}
	
	if (PCOn[1] == true) {
//		p.cameraFreeze(p.cameraX, p.cameraY, false, false);
		p.xPos = 39*32-16;
		p.yPos = 264*32-24;
		p.direction = -1;
		p.keyRun = true;
		if (PCLoggedIn[1] == false && jjKey[F8] && !sysKeyHeld) {
			PCLoggedIn[1] = true;
			bootTimer = 350;
			PCState[1] = 0;
		} else if (PCLoggedIn[1] == true && jjKey[F8] && !sysKeyHeld) {
			PCLoggedIn[1] = false;
			jjMusicLoad("cityligh.mod", false);
		}
	}
	
	sysKeyHeld = jjKey[UP] || jjKey[F8];
}

void onMain() {
	jjPLAYER@ p = jjLocalPlayers[0];
	jjOBJ@ pizza11;
	jjOBJ@ pizza12;
	jjOBJ@ pizza21;
	jjOBJ@ pizza22;
	jjOBJ@ pizza31;
	jjOBJ@ pizza32;
	for(int i=0;i<32;i++) {
		if (playerInZone(242*32, 243*32, 264*32, 265*32, i)) {
			if (inZone == false && jjPlayers[i].testForCoins(5)) {
				@pizza11 = jjObjects[jjAddObject(OBJECT::PIZZA, 247*32-16, 268*32-16, 0, CREATOR::LEVEL)];
				@pizza12 = jjObjects[jjAddObject(OBJECT::PIZZA, 249*32-16, 268*32-16, 0, CREATOR::LEVEL)];
				inZone = true;
			}
			return;
		}
		if (playerInZone(242*32, 243*32, 266*32, 267*32, i)) {
			if (inZone == false && jjPlayers[i].testForCoins(5)) {
				@pizza21 = jjObjects[jjAddObject(OBJECT::PIZZA, 252*32-16, 268*32-16, 0, CREATOR::LEVEL)];
				@pizza22 = jjObjects[jjAddObject(OBJECT::PIZZA, 254*32-16, 268*32-16, 0, CREATOR::LEVEL)];
				inZone = true;
			}
			return;
		}
		if (playerInZone(242*32, 243*32, 268*32, 269*32, i)) {
			if (inZone == false && jjPlayers[i].testForCoins(5)) {
				@pizza31 = jjObjects[jjAddObject(OBJECT::PIZZA, 257*32-16, 268*32-16, 0, CREATOR::LEVEL)];
				@pizza32 = jjObjects[jjAddObject(OBJECT::PIZZA, 259*32-16, 268*32-16, 0, CREATOR::LEVEL)];
				inZone = true;
			}
			return;
		}
	}
	inZone = false;
	
	sub();
}

void onDrawLayer2(jjPLAYER@ p, jjCANVAS@ canvas) {
	const float startX = p.cameraX + 32;
	const float startY = p.cameraY + 32;
	const float endX = p.cameraX + (jjResolutionWidth - 64);
	const float endY = p.cameraY + (jjResolutionHeight - 64);
	
	if (jjEventGet(p.xPos/32, p.yPos/32) == AREA::PATH) {
		canvas.drawTile(p.xPos - 16, p.yPos - (75 + jjCos(jjGameTicks*16)*(1*4)),2813, TILE::ALLQUADRANTS);
	}
	for(int i = 0; i < 2; i++) {
		if (PCOn[i] == true && PCLoggedIn[i] == false) canvas.drawString(p.cameraX + 250, p.cameraY + 240, "Press F8 to turn PC on", STRING::SMALL, STRING::NORMAL);
	
		if (PCLoggedIn[i] == true) {
			if (cameraOn == false) {
				for(int a=startX;a<(endX+1);a+=32) {
					for(int b=startY;b<(endY+1);b+=32) {
					canvas.drawTile(a, b, 73, TILE::ALLQUADRANTS);
					}
				}
			}
			canvas.drawString(p.cameraX + 250, p.cameraY + 460, "Press F8 to turn PC off.", STRING::SMALL, STRING::NORMAL);
			canvas.drawString(p.cameraX + 48, p.cameraY + 48, "JOS Beta v0.6 by Dollar Studios", STRING::MEDIUM, STRING::NORMAL);
			switch (PCState[i]) {
			case 0:
				PCBoot(canvas, i);
				break;
			case 1:
				PCMainMenu(canvas, i, p);
				break;
			case 2:
				PCMusicPlayer(canvas, i);
				break;
			case 3:
				PCControlPanel(canvas, i);
				break;
			case 4:
				PCAdminPanel(canvas, i);
				break;
			case 5:
				PCObserverCamera(canvas, i, p);
				break;
			case 6:
				mutePlayer(canvas, i);
				break;
			case 7:
				unmutePlayer(canvas, i);
				break;
			case 8:
				kickPlayer(canvas, i);
				break;
			case 9:
				banPlayer(canvas, i);
				break;
			case 10:
				unbanPlayer(canvas, i);
				break;
			case 11:
				killPlayer(canvas, i);
				break;
			}
		}
	}
	
	pcKeyHeld = jjKey[NUM0] || jjKey[NUM1] || jjKey[NUM2] || jjKey[NUM3] || jjKey[NUM4] || jjKey[NUM5] || jjKey[NUM6] || jjKey[NUM7] || jjKey[NUM8] || jjKey[NUM9];
}