24 de mayo de 2010

google.pacman||function(){
var a=true,e=false,g={},i=[1,4,2,8],l={0:{axis:0,increment:0},1:{axis:0,increment:-1},2:{axis:0,increment:+1},4:{axis:1,increment:-1},8:{axis:1,increment:+1}},m=[0,7,17,32],n=[{x:5,y:1,w:56},{x:5,y:4,w:5},{x:5,y:1,h:4},{x:9,y:1,h:12},{x:5,y:12,h:4},{x:10,y:12,h:4},{x:5,y:15,w:16},{x:5,y:12,w:31},{x:60,y:1,h:4},{x:54,y:1,h:4},{x:19,y:1,h:12},{x:19,y:4,w:26},{x:13,y:5,w:7},{x:13,y:5,h:4},{x:13,y:8,w:3},{x:56,y:4,h:9},{x:48,y:4,w:13},{x:48,y:1,h:12},{x:60,y:12,h:4},{x:44,y:15,w:17},{x:54,y:12,h:4},{x:44,
y:12,w:17},{x:44,y:1,h:15},{x:41,y:13,w:4},{x:41,y:13,h:3},{x:38,y:13,h:3},{x:38,y:15,w:4},{x:35,y:10,w:10},{x:35,y:1,h:15},{x:35,y:13,w:4},{x:21,y:12,h:4},{x:24,y:12,h:4},{x:24,y:15,w:12},{x:27,y:4,h:9},{x:52,y:9,w:5},{x:56,y:8,w:10,type:1},{x:1,y:8,w:9,type:1}],o=[{x:1,y:8,w:8},{x:57,y:8,w:9},{x:44,y:2,h:10},{x:35,y:5,h:7},{x:36,y:4,w:8},{x:36,y:10,w:8},{x:39,y:15,w:2}],p=[{x:5,y:15},{x:5,y:3},{x:15,y:8},{x:60,y:3},{x:60,y:15}],q=[{x:2,y:8},{x:63,y:8}],r={1:[{x:39.5,y:15,dir:4},{x:39.5,y:4,dir:4,
scatterX:57,scatterY:-4},{x:39.5,y:7,dir:2,scatterX:0,scatterY:-4},{x:37.625,y:7,dir:1,scatterX:57,scatterY:20},{x:41.375,y:7,dir:1,scatterX:0,scatterY:20}],2:[{x:40.25,y:15,dir:8},{x:38.75,y:15,dir:4},{x:39.5,y:4,dir:4,scatterX:57,scatterY:-4},{x:39.5,y:7,dir:2,scatterX:0,scatterY:-4},{x:37.625,y:7,dir:1,scatterX:57,scatterY:20},{x:41.375,y:7,dir:1,scatterX:0,scatterY:20}]},s=[32,312],v=[80,312],w={0:0.16,1:0.23,2:1,3:1,4:2.23,5:0.3,6:1.9,7:2.23,8:1.9,9:5,10:1.9,11:1.18,12:0.3,13:0.5,14:1.9,15:9,
16:10,17:0.26},y=0.8*0.4,z=[{},{ghostSpeed:0.75,ghostTunnelSpeed:0.4,playerSpeed:0.8,dotEatingSpeed:0.71,ghostFrightSpeed:0.5,playerFrightSpeed:0.9,dotEatingFrightSpeed:0.79,elroyDotsLeftPart1:20,elroySpeedPart1:0.8,elroyDotsLeftPart2:10,elroySpeedPart2:0.85,frightTime:6,frightBlinkCount:5,fruit:1,fruitScore:100,ghostModeSwitchTimes:[7,20,7,20,5,20,5,1],penForceTime:4,penLeavingLimits:[0,0,30,60]},{ghostSpeed:0.85,ghostTunnelSpeed:0.45,playerSpeed:0.9,dotEatingSpeed:0.79,ghostFrightSpeed:0.55,playerFrightSpeed:0.95,
dotEatingFrightSpeed:0.83,elroyDotsLeftPart1:30,elroySpeedPart1:0.9,elroyDotsLeftPart2:15,elroySpeedPart2:0.95,frightTime:5,frightBlinkCount:5,fruit:2,fruitScore:300,ghostModeSwitchTimes:[7,20,7,20,5,1033,1/60,1],penForceTime:4,penLeavingLimits:[0,0,0,50],cutsceneId:1},{ghostSpeed:0.85,ghostTunnelSpeed:0.45,playerSpeed:0.9,dotEatingSpeed:0.79,ghostFrightSpeed:0.55,playerFrightSpeed:0.95,dotEatingFrightSpeed:0.83,elroyDotsLeftPart1:40,elroySpeedPart1:0.9,elroyDotsLeftPart2:20,elroySpeedPart2:0.95,
frightTime:4,frightBlinkCount:5,fruit:3,fruitScore:500,ghostModeSwitchTimes:[7,20,7,20,5,1033,1/60,1],penForceTime:4,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.85,ghostTunnelSpeed:0.45,playerSpeed:0.9,dotEatingSpeed:0.79,ghostFrightSpeed:0.55,playerFrightSpeed:0.95,dotEatingFrightSpeed:0.83,elroyDotsLeftPart1:40,elroySpeedPart1:0.9,elroyDotsLeftPart2:20,elroySpeedPart2:0.95,frightTime:3,frightBlinkCount:5,fruit:3,fruitScore:500,ghostModeSwitchTimes:[7,20,7,20,5,1033,1/60,1],penForceTime:4,penLeavingLimits:[0,
0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:40,elroySpeedPart1:1,elroyDotsLeftPart2:20,elroySpeedPart2:1.05,frightTime:2,frightBlinkCount:5,fruit:4,fruitScore:700,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0],cutsceneId:2},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,
dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:50,elroySpeedPart1:1,elroyDotsLeftPart2:25,elroySpeedPart2:1.05,frightTime:5,frightBlinkCount:5,fruit:4,fruitScore:700,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:50,elroySpeedPart1:1,elroyDotsLeftPart2:25,elroySpeedPart2:1.05,frightTime:2,frightBlinkCount:5,
fruit:5,fruitScore:1E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:50,elroySpeedPart1:1,elroyDotsLeftPart2:25,elroySpeedPart2:1.05,frightTime:2,frightBlinkCount:5,fruit:5,fruitScore:1E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,
playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:60,elroySpeedPart1:1,elroyDotsLeftPart2:30,elroySpeedPart2:1.05,frightTime:1,frightBlinkCount:3,fruit:6,fruitScore:2E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0],cutsceneId:3},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:60,
elroySpeedPart1:1,elroyDotsLeftPart2:30,elroySpeedPart2:1.05,frightTime:5,frightBlinkCount:5,fruit:6,fruitScore:2E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:60,elroySpeedPart1:1,elroyDotsLeftPart2:30,elroySpeedPart2:1.05,frightTime:2,frightBlinkCount:5,fruit:7,fruitScore:3E3,ghostModeSwitchTimes:[5,
20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:80,elroySpeedPart1:1,elroyDotsLeftPart2:40,elroySpeedPart2:1.05,frightTime:1,frightBlinkCount:3,fruit:7,fruitScore:3E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,
ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:80,elroySpeedPart1:1,elroyDotsLeftPart2:40,elroySpeedPart2:1.05,frightTime:1,frightBlinkCount:3,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0],cutsceneId:3},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:80,elroySpeedPart1:1,elroyDotsLeftPart2:40,
elroySpeedPart2:1.05,frightTime:3,frightBlinkCount:5,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:100,elroySpeedPart1:1,elroyDotsLeftPart2:50,elroySpeedPart2:1.05,frightTime:1,frightBlinkCount:3,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,
penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:100,elroySpeedPart1:1,elroyDotsLeftPart2:50,elroySpeedPart2:1.05,frightTime:1,frightBlinkCount:3,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,
dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:100,elroySpeedPart1:1,elroyDotsLeftPart2:50,elroySpeedPart2:1.05,frightTime:0,frightBlinkCount:0,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0],cutsceneId:3},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:100,elroySpeedPart1:1,elroyDotsLeftPart2:50,elroySpeedPart2:1.05,frightTime:1,
frightBlinkCount:3,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:120,elroySpeedPart1:1,elroyDotsLeftPart2:60,elroySpeedPart2:1.05,frightTime:0,frightBlinkCount:0,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,
ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:120,elroySpeedPart1:1,elroyDotsLeftPart2:60,elroySpeedPart2:1.05,frightTime:0,frightBlinkCount:0,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:0.9,dotEatingSpeed:0.79,ghostFrightSpeed:0.75,playerFrightSpeed:0.9,dotEatingFrightSpeed:0.79,elroyDotsLeftPart1:120,
elroySpeedPart1:1,elroyDotsLeftPart2:60,elroySpeedPart2:1.05,frightTime:0,frightBlinkCount:0,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]}],A={1:[{x:37.6,y:7,dir:1,dest:6.375,speed:0.48},{x:37.6,y:6.375,dir:2,dest:7.625,speed:0.48},{x:37.6,y:7.625,dir:1,dest:7,speed:0.48}],2:[{x:39.5,y:7,dir:2,dest:7.625,speed:0.48},{x:39.5,y:7.625,dir:1,dest:6.375,speed:0.48},{x:39.5,y:6.375,dir:2,dest:7,speed:0.48}],3:[{x:41.4,y:7,dir:1,dest:6.375,
speed:0.48},{x:41.4,y:6.375,dir:2,dest:7.625,speed:0.48},{x:41.4,y:7.625,dir:1,dest:7,speed:0.48}],4:[{x:37.6,y:7,dir:8,dest:39.5,speed:y},{x:39.5,y:7,dir:1,dest:4,speed:y}],5:[{x:39.5,y:7,dir:1,dest:4,speed:y}],6:[{x:41.4,y:7,dir:4,dest:39.5,speed:y},{x:39.5,y:7,dir:1,dest:4,speed:y}],7:[{x:39.5,y:4,dir:2,dest:7,speed:1.6},{x:39.5,y:7,dir:4,dest:37.625,speed:1.6}],8:[{x:39.5,y:4,dir:2,dest:7,speed:1.6}],9:[{x:39.5,y:4,dir:2,dest:7,speed:1.6},{x:39.5,y:7,dir:8,dest:41.375,speed:1.6}],10:[{x:37.6,
y:7,dir:8,dest:39.5,speed:y},{x:39.5,y:7,dir:1,dest:4,speed:y}],11:[{x:39.5,y:7,dir:1,dest:4,speed:y}],12:[{x:41.4,y:7,dir:4,dest:39.5,speed:y},{x:39.5,y:7,dir:1,dest:4,speed:y}]},B={1:{actors:[{ghost:e,x:64,y:9,id:0},{ghost:a,x:68.2,y:9,id:1}],sequence:[{time:5.5,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0.78*0.8*2}]},{time:0.1,moves:[{dir:4,speed:32},{dir:4,speed:0}]},{time:9,moves:[{dir:8,speed:0.75*0.8*2,elId:"pcm-bpcm"},{dir:8,speed:0.8,mode:4}]}]},2:{actors:[{ghost:e,x:64,y:9,id:0},{ghost:a,
x:70.2,y:9,id:1},{ghost:a,x:32,y:9.5,id:2}],sequence:[{time:2.7,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0.78*0.8*2},{dir:0,speed:0,elId:"pcm-stck"}]},{time:1,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0.1*0.8},{dir:0,speed:0,elId:"pcm-stck"}]},{time:1.3,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0},{dir:0,speed:0,elId:"pcm-stck"}]},{time:1,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0,elId:"pcm-ghfa"},{dir:0,speed:0,elId:"pcm-stck"}]},{time:2.5,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0,
elId:"pcm-ghfa"},{dir:0,speed:0,elId:"pcm-stck"}]}]},3:{actors:[{ghost:e,x:64,y:9,id:0},{ghost:a,x:70.2,y:9,id:2}],sequence:[{time:5.3,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0.78*0.8*2,elId:"pcm-ghin"}]},{time:5.3,moves:[{dir:4,speed:0},{dir:8,speed:0.78*0.8*2,elId:"pcm-gbug"}]}]}},C=[90,45,30],D=C[0];function E(b){this.id=b}
E.prototype.A=function(){var b=r[g.playerCount][this.id];this.pos=[b.y*8,b.x*8];this.posDelta=[0,0];this.tilePos=[b.y*8,b.x*8];this.targetPos=[b.scatterY*8,b.scatterX*8];this.scatterPos=[b.scatterY*8,b.scatterX*8];this.lastActiveDir=this.dir=b.dir;this.physicalSpeed=this.requestedDir=this.nextDir=0;this.c(0);this.reverseDirectionsNext=this.freeToLeavePen=this.modeChangedWhileInPen=this.eatenInThisFrightMode=e;this.l()};
E.prototype.createElement=function(){this.el=document.createElement("div");this.el.className="pcm-ac";this.el.id="actor"+this.id;g.prepareElement(this.el,0,0);g.playfieldEl.appendChild(this.el);this.elPos=[0,0];this.elBackgroundPos=[0,0]};
E.prototype.a=function(b){var c=this.mode;this.mode=b;if(this.id==g.playerCount+3&&(b==16||c==16))g.updateCruiseElroySpeed();switch(c){case 32:g.ghostExitingPenNow=e;break;case 8:g.ghostEyesCount>0&&g.ghostEyesCount--;g.ghostEyesCount==0&&g.playAmbientSound();break}switch(b){case 4:this.fullSpeed=g.levels.ghostFrightSpeed*0.8;this.tunnelSpeed=g.levels.ghostTunnelSpeed*0.8;this.followingRoutine=e;break;case 1:this.fullSpeed=g.levels.ghostSpeed*0.8;this.tunnelSpeed=g.levels.ghostTunnelSpeed*0.8;this.followingRoutine=
e;break;case 2:this.targetPos=this.scatterPos;this.fullSpeed=g.levels.ghostSpeed*0.8;this.tunnelSpeed=g.levels.ghostTunnelSpeed*0.8;this.followingRoutine=e;break;case 8:this.tunnelSpeed=this.fullSpeed=1.6;this.targetPos=[s[0],s[1]];this.freeToLeavePen=this.followingRoutine=e;break;case 16:this.l();this.followingRoutine=a;this.routineMoveId=-1;switch(this.id){case g.playerCount+1:this.routineToFollow=2;break;case g.playerCount+2:this.routineToFollow=1;break;case g.playerCount+3:this.routineToFollow=
3;break}break;case 32:this.followingRoutine=a;this.routineMoveId=-1;switch(this.id){case g.playerCount+1:this.routineToFollow=5;break;case g.playerCount+2:this.routineToFollow=4;break;case g.playerCount+3:this.routineToFollow=6;break}g.ghostExitingPenNow=a;break;case 64:this.followingRoutine=a;this.routineMoveId=-1;switch(this.id){case g.playerCount:case g.playerCount+1:this.routineToFollow=8;break;case g.playerCount+2:this.routineToFollow=7;break;case g.playerCount+3:this.routineToFollow=9;break}break;
case 128:this.followingRoutine=a;this.routineMoveId=-1;switch(this.id){case g.playerCount:case g.playerCount+1:this.routineToFollow=11;break;case g.playerCount+2:this.routineToFollow=10;break;case g.playerCount+3:this.routineToFollow=12;break}break}this.d()};E.prototype.l=function(){if(this.id>=g.playerCount)this.targetPlayerId=Math.floor(g.rand()*g.playerCount)};
E.prototype.z=function(b){if(this.dir==g.oppositeDirections[b]){this.dir=b;this.posDelta=[0,0];this.currentSpeed!=2&&this.c(0);if(this.dir!=0)this.lastActiveDir=this.dir;this.nextDir=0}else if(this.dir!=b)if(this.dir==0){if(g.playfield[this.pos[0]][this.pos[1]].allowedDir&b)this.dir=b}else{var c=g.playfield[this.tilePos[0]][this.tilePos[1]];if(c&&c.allowedDir&b){c=l[this.dir];var d=[this.pos[0],this.pos[1]];d[c.axis]-=c.increment;var f=0;if(d[0]==this.tilePos[0]&&d[1]==this.tilePos[1])f=1;else{d[c.axis]-=
c.increment;if(d[0]==this.tilePos[0]&&d[1]==this.tilePos[1])f=2}if(f){this.dir=b;this.pos[0]=this.tilePos[0];this.pos[1]=this.tilePos[1];c=l[this.dir];this.pos[c.axis]+=c.increment*f;return}}this.nextDir=b;this.posDelta=[0,0]}};
E.prototype.i=function(b){var c=this.tilePos,d=l[this.dir],f=[c[0],c[1]];f[d.axis]+=d.increment*8;var h=g.playfield[f[0]][f[1]];if(b&&!h.intersection)h=g.playfield[c[0]][c[1]];if(h.intersection)switch(this.mode){case 2:case 1:case 8:if((this.dir&h.allowedDir)==0&&h.allowedDir==g.oppositeDirections[this.dir])this.nextDir=g.oppositeDirections[this.dir];else{b=99999999999;c=0;for(var j in i){var k=i[j];if(h.allowedDir&k&&this.dir!=g.oppositeDirections[k]){d=l[k];var x=[f[0],f[1]];x[d.axis]+=d.increment;
d=g.getDistance(x,[this.targetPos[0],this.targetPos[1]]);if(d=c[0]&&this.pos[0]<=d[0]&&this.pos[1]>=c[1]&&this.pos[1]<=d[1]){b=l[this.nextDir];this.posDelta[b.axis]+=b.increment}};
E.prototype.n=function(){if(this.pos[0]==q[0].y*8&&this.pos[1]==q[0].x*8){this.pos[0]=q[1].y*8;this.pos[1]=(q[1].x-1)*8}else if(this.pos[0]==q[1].y*8&&this.pos[1]==q[1].x*8){this.pos[0]=q[0].y*8;this.pos[1]=(q[0].x+1)*8}this.mode==8&&this.pos[0]==s[0]&&this.pos[1]==s[1]&&this.a(64);if(!this.ghost&&this.pos[0]==v[0]&&(this.pos[1]==v[1]||this.pos[1]==v[1]+8))g.eatFruit(this.id)};
E.prototype.u=function(){this.n();this.ghost&&this.i(e);var b=g.playfield[this.pos[0]][this.pos[1]];if(b.intersection)if(this.nextDir&&this.nextDir&b.allowedDir){if(this.dir!=0)this.lastActiveDir=this.dir;this.dir=this.nextDir;this.nextDir=0;if(!this.ghost){this.pos[0]+=this.posDelta[0];this.pos[1]+=this.posDelta[1];this.posDelta=[0,0]}}else if((this.dir&b.allowedDir)==0){if(this.dir!=0)this.lastActiveDir=this.dir;this.nextDir=this.dir=0;this.c(0)}};
E.prototype.o=function(){var b=this.pos[0]/8,c=this.pos[1]/8,d=[Math.round(b)*8,Math.round(c)*8];if(d[0]!=this.tilePos[0]||d[1]!=this.tilePos[1])this.p(d);else{b=[Math.floor(b)*8,Math.floor(c)*8];this.pos[1]==b[1]&&this.pos[0]==b[0]&&this.u()}!this.ghost&&this.nextDir&&g.playfield[d[0]][d[1]].intersection&&this.nextDir&g.playfield[d[0]][d[1]].allowedDir&&this.t()};
E.prototype.B=function(){if(this.id==g.playerCount&&g.dotsRemaining64?[b.tilePos[0],b.tilePos[1]]:this.scatterPos;break}}};
E.prototype.v=function(){this.routineMoveId++;if(this.routineMoveId==A[this.routineToFollow].length)if(this.mode==16&&this.freeToLeavePen&&!g.ghostExitingPenNow){this.eatenInThisFrightMode?this.a(128):this.a(32);return}else if(this.mode==32||this.mode==128){this.pos=[s[0],s[1]+4];this.dir=this.modeChangedWhileInPen?8:4;var b=g.mainGhostMode;if(this.mode==128&&b==4)b=g.lastMainGhostMode;this.a(b);return}else if(this.mode==64){if(this.id==g.playerCount||this.freeToLeavePen)this.a(128);else{this.eatenInThisFrightMode=
a;this.a(16)}return}else this.routineMoveId=0;b=A[this.routineToFollow][this.routineMoveId];this.pos[0]=b.y*8;this.pos[1]=b.x*8;this.dir=b.dir;this.physicalSpeed=0;this.speedIntervals=g.getSpeedIntervals(b.speed);this.proceedToNextRoutineMove=e;this.b()};
E.prototype.m=function(){var b=A[this.routineToFollow][this.routineMoveId];if(b)if(this.speedIntervals[g.intervalTime]){var c=l[this.dir];this.pos[c.axis]+=c.increment;switch(this.dir){case 1:case 4:if(this.pos[c.axis]b.dest*8){this.pos[c.axis]=b.dest*8;this.proceedToNextRoutineMove=a}break}this.b()}};
E.prototype.j=function(){if(this.routineMoveId==-1||this.proceedToNextRoutineMove)this.v();this.m()};E.prototype.d=function(){switch(this.currentSpeed){case 0:var b=this.id==g.playerCount&&(this.mode==2||this.mode==1)?g.cruiseElroySpeed:this.fullSpeed;break;case 1:b=this.dotEatingSpeed;break;case 2:b=this.tunnelSpeed;break}if(this.physicalSpeed!=b){this.physicalSpeed=b;this.speedIntervals=g.getSpeedIntervals(this.physicalSpeed)}};E.prototype.c=function(b){this.currentSpeed=b;this.d()};
E.prototype.e=function(){if(this.dir)if(this.speedIntervals[g.intervalTime]){var b=l[this.dir];this.pos[b.axis]+=b.increment;this.o();this.b()}};E.prototype.move=function(){if(g.gameplayMode==0||this.ghost&&g.gameplayMode==1&&(this.mode==8||this.mode==64)){if(this.requestedDir!=0){this.z(this.requestedDir);this.requestedDir=0}if(this.followingRoutine){this.j();this.mode==64&&this.j()}else{this.e();this.mode==8&&this.e()}}};
E.prototype.k=function(){var b=g.getPlayfieldX(this.pos[1]+this.posDelta[1]),c=g.getPlayfieldY(this.pos[0]+this.posDelta[0]);if(this.elPos[0]!=c||this.elPos[1]!=b){this.elPos[0]=c;this.elPos[1]=b;this.el.style.left=b+"px";this.el.style.top=c+"px"}};
E.prototype.s=function(){var b=0,c=0,d=this.dir;if(d==0)d=this.lastActiveDir;if(g.gameplayMode==1&&this.id==g.playerEatingGhostId){b=3;c=0}else if((g.gameplayMode==9||g.gameplayMode==10)&&this.id==0){b=2;c=0}else if(g.gameplayMode==4||g.gameplayMode==5||g.gameplayMode==7){b=this.id==0?2:4;c=0}else if(g.gameplayMode==3)if(this.id==g.playerDyingId){d=20-Math.floor(g.gameplayModeTime/g.timing[4]*21);if(this.id==0){b=d-1;switch(b){case -1:b=0;break;case 11:b=10;break;case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:b=
11;break}c=12}else switch(d){case 0:case 1:case 2:case 6:case 10:b=4;c=3;break;case 3:case 7:case 11:b=4;c=0;break;case 4:case 8:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:b=4;c=2;break;case 5:case 9:b=4;c=1;break}}else{b=3;c=0}else if(this.el.id=="pcm-bpcm"){b=14;c=0;d=Math.floor(g.globalTime*0.2)%4;if(d==3)d=1;c+=2*d}else{switch(d){case 4:c=0;break;case 8:c=1;break;case 1:c=2;break;case 2:c=3;break}if(g.gameplayMode!=2)b=Math.floor(g.globalTime*0.3)%4;if(b==3&&this.dir==
0)b=0;if(b==2&&this.id==0)b=0;if(b==3){b=2;if(this.id==0)c=0}if(this.id==1)b+=4}return[c,b]};
E.prototype.r=function(){var b=0,c=0;if(g.gameplayMode==10||g.gameplayMode==4||g.gameplayMode==3){b=3;c=0}else if(g.gameplayMode==1&&this.id==g.ghostBeingEatenId){switch(g.modeScoreMultiplier){case 2:b=0;break;case 4:b=1;break;case 8:b=2;break;case 16:b=3;break}c=11;this.el.className="pcm-ac pcm-n"}else if(this.mode==4||(this.mode==16||this.mode==32)&&g.mainGhostMode==4&&!this.eatenInThisFrightMode){b=0;c=8;if(g.frightModeTime60?1:g.cutsceneTime>
45?2:3:g.cutsceneSequenceId==2?3:g.cutsceneSequenceId==3||g.cutsceneSequenceId==4?4:0;c=13}else{c=this.nextDir;if(!c||g.playfield[this.tilePos[0]][this.tilePos[1]].type==1)c=this.dir;switch(c){case 4:b=4;break;case 8:b=6;break;case 1:b=0;break;case 2:b=2;break}c=4+this.id-g.playerCount;if(this.speed>0||g.gameplayMode!=13)b+=Math.floor(g.globalTime/16)%2}return[c,b]};
E.prototype.b=function(){this.k();var b=[0,0];b=g.gameplayMode==8||g.gameplayMode==14?[0,3]:this.ghost?this.r():this.s();if(this.elBackgroundPos[0]!=b[0]||this.elBackgroundPos[1]!=b[1]){this.elBackgroundPos[0]=b[0];this.elBackgroundPos[1]=b[1];b[0]*=16;b[1]*=16;g.changeElementBkPos(this.el,b[1],b[0],a)}};g.rand=function(){var b=4294967296,c=134775813;c=c*g.randSeed+1;return(g.randSeed=c%b)/b};g.seed=function(b){g.randSeed=b};
g.getDistance=function(b,c){return Math.sqrt((c[1]-b[1])*(c[1]-b[1])+(c[0]-b[0])*(c[0]-b[0]))};g.getPlayfieldX=function(b){return b+-32};g.getPlayfieldY=function(b){return b+0};g.getCorrectedSpritePos=function(b){return b/8*10+2};g.getDotElementId=function(b,c){return"pcm-d"+b+"-"+c};g.showElementById=function(b,c){var d=document.getElementById(b);if(d)d.style.visibility=c?"visible":"hidden"};
g.getAbsoluteElPos=function(b){var c=[0,0];do{c[0]+=b.offsetTop;c[1]+=b.offsetLeft}while(b=b.offsetParent);return c};
g.prepareElement=function(b,c,d){c=g.getCorrectedSpritePos(parseInt(c,10));d=g.getCorrectedSpritePos(parseInt(d,10));if(g.useCss){b.style.backgroundImage="url(/logos/pacman10-hp-sprite.png)";b.style.backgroundPosition=-c+"px "+-d+"px";b.style.backgroundRepeat="no-repeat"}else{b.style.overflow="hidden";c="display: block; position: relative; left: "+-c+"px; top: "+-d+"px";b.innerHTML=''}};
g.changeElementBkPos=function(b,c,d,f){if(f){c=g.getCorrectedSpritePos(c);d=g.getCorrectedSpritePos(d)}if(g.useCss)b.style.backgroundPosition=-c+"px "+-d+"px";else if(b.childNodes[0]){b.childNodes[0].style.left=-c+"px";b.childNodes[0].style.top=-d+"px"}};g.determinePlayfieldDimensions=function(){g.playfieldWidth=0;g.playfieldHeight=0;for(var b in n){var c=n[b];if(c.w){c=c.x+c.w-1;if(c>g.playfieldWidth)g.playfieldWidth=c}else{c=c.y+c.h-1;if(c>g.playfieldHeight)g.playfieldHeight=c}}};
g.preparePlayfield=function(){g.playfield=[];for(var b=0;b<=g.playfieldHeight+1;b++){g.playfield[b*8]=[];for(var c=-2;c<=g.playfieldWidth+1;c++)g.playfield[b*8][c*8]={path:0,dot:0,intersection:0}}};
g.preparePaths=function(){for(var b in n){var c=n[b],d=c.type;if(c.w){for(var f=c.y*8,h=c.x*8;h<=(c.x+c.w-1)*8;h+=8){g.playfield[f][h].path=a;if(g.playfield[f][h].dot==0){g.playfield[f][h].dot=1;g.dotsRemaining++}g.playfield[f][h].type=!d||h!=c.x*8&&h!=(c.x+c.w-1)*8?d:0}g.playfield[f][c.x*8].intersection=a;g.playfield[f][(c.x+c.w-1)*8].intersection=a}else{h=c.x*8;for(f=c.y*8;f<=(c.y+c.h-1)*8;f+=8){if(g.playfield[f][h].path)g.playfield[f][h].intersection=a;g.playfield[f][h].path=a;if(g.playfield[f][h].dot==
0){g.playfield[f][h].dot=1;g.dotsRemaining++}g.playfield[f][h].type=!d||f!=c.y*8&&f!=(c.y+c.h-1)*8?d:0}g.playfield[c.y*8][h].intersection=a;g.playfield[(c.y+c.h-1)*8][h].intersection=a}}for(b in o)if(o[b].w)for(h=o[b].x*8;h<=(o[b].x+o[b].w-1)*8;h+=8){g.playfield[o[b].y*8][h].dot=0;g.dotsRemaining--}else for(f=o[b].y*8;f<=(o[b].y+o[b].h-1)*8;f+=8){g.playfield[f][o[b].x*8].dot=0;g.dotsRemaining--}};
g.prepareAllowedDirections=function(){for(var b=8;b<=g.playfieldHeight*8;b+=8)for(var c=8;c<=g.playfieldWidth*8;c+=8){g.playfield[b][c].allowedDir=0;if(g.playfield[b-8][c].path)g.playfield[b][c].allowedDir+=1;if(g.playfield[b+8][c].path)g.playfield[b][c].allowedDir+=2;if(g.playfield[b][c-8].path)g.playfield[b][c].allowedDir+=4;if(g.playfield[b][c+8].path)g.playfield[b][c].allowedDir+=8}};
g.createDotElements=function(){for(var b=8;b<=g.playfieldHeight*8;b+=8)for(var c=8;c<=g.playfieldWidth*8;c+=8)if(g.playfield[b][c].dot){var d=document.createElement("div");d.className="pcm-d";d.id=g.getDotElementId(b,c);d.style.left=c+-32+"px";d.style.top=b+0+"px";g.playfieldEl.appendChild(d)}};
g.createEnergizerElements=function(){for(var b in p){var c=p[b],d=g.getDotElementId(c.y*8,c.x*8);document.getElementById(d).className="pcm-e";g.prepareElement(document.getElementById(d),0,144);g.playfield[c.y*8][c.x*8].dot=2}};g.createFruitElement=function(){g.fruitEl=document.createElement("div");g.fruitEl.id="pcm-f";g.fruitEl.style.left=g.getPlayfieldX(v[1])+"px";g.fruitEl.style.top=g.getPlayfieldY(v[0])+"px";g.prepareElement(g.fruitEl,-32,-16);g.playfieldEl.appendChild(g.fruitEl)};
g.createPlayfieldElements=function(){g.doorEl=document.createElement("div");g.doorEl.id="pcm-do";g.doorEl.style.display="none";g.playfieldEl.appendChild(g.doorEl);g.createDotElements();g.createEnergizerElements();g.createFruitElement()};g.createActors=function(){g.actors=[];for(var b=0;b8&&kf?8:4;else if(k>8&&jh?2:1};
g.handleClick=function(b){if(!b)b=window.event;g.canvasClicked(b.clientX,b.clientY)};g.registerTouch=function(){document.body.addEventListener("touchstart",g.handleTouchStart,a);g.canvasEl.addEventListener("touchstart",g.handleTouchStart,a);document.f&&document.f.q&&document.f.q.addEventListener("touchstart",g.handleTouchStart,a)};
g.handleTouchStart=function(b){g.touchDX=0;g.touchDY=0;if(b.touches.length==1){g.touchStartX=b.touches[0].pageX;g.touchStartY=b.touches[0].pageY;document.body.addEventListener("touchmove",g.handleTouchMove,a);document.body.addEventListener("touchend",g.handleTouchEnd,a)}b.preventDefault();b.stopPropagation()};g.handleTouchMove=function(b){if(b.touches.length>1)g.cancelTouch();else{g.touchDX=b.touches[0].pageX-g.touchStartX;g.touchDY=b.touches[0].pageY-g.touchStartY}b.preventDefault();b.stopPropagation()};
g.handleTouchEnd=function(b){if(g.touchDX==0&&g.touchDY==0)g.canvasClicked(g.touchStartX,g.touchStartY);else{var c=Math.abs(g.touchDX),d=Math.abs(g.touchDY);if(c<8&&d<8)g.canvasClicked(g.touchStartX,g.touchStartY);else if(c>15&&d0?8:4;else if(d>15&&c0?2:1}b.preventDefault();b.stopPropagation();g.cancelTouch()};
g.cancelTouch=function(){document.body.removeEventListener("touchmove",g.handleTouchMove,a);document.body.removeEventListener("touchend",g.handleTouchEnd,a);g.touchStartX=null;g.touchStartY=null};g.addEventListeners=function(){if(window.addEventListener){window.addEventListener("keydown",g.handleKeyDown,e);g.canvasEl.addEventListener("click",g.handleClick,e);g.registerTouch()}else{document.body.attachEvent("onkeydown",g.handleKeyDown);g.canvasEl.attachEvent("onclick",g.handleClick)}};
g.startGameplay=function(){g.score=[0,0];g.extraLifeAwarded=[e,e];g.lives=3;g.level=0;g.paused=e;g.globalTime=0;g.newLevel(a)};
g.restartGameplay=function(b){g.seed(0);g.frightModeTime=0;g.intervalTime=0;g.gameplayModeTime=0;g.fruitTime=0;g.ghostModeSwitchPos=0;g.ghostModeTime=g.levels.ghostModeSwitchTimes[0]*D;g.ghostExitingPenNow=e;g.ghostEyesCount=0;g.tilesChanged=e;g.updateCruiseElroySpeed();g.hideFruit();g.resetForcePenLeaveTime();g.restartActors();g.updateActorPositions();g.switchMainGhostMode(2,a);for(var c=g.playerCount+1;c=z.length?z[z.length-1]:z[g.level];g.levels.frightTime=Math.round(g.levels.frightTime*D);g.levels.frightTotalTime=g.levels.frightTime+g.timing[1]*(g.levels.frightBlinkCount*2-1);for(var c in g.actors)g.actors[c].dotCount=0;g.alternatePenLeavingScheme=e;g.lostLifeOnThisLevel=e;g.updateChrome();g.resetPlayfield();g.restartGameplay(b);g.level==256&&g.killScreen()};
g.newLife=function(){g.lostLifeOnThisLevel=a;g.alternatePenLeavingScheme=a;g.alternateDotCount=0;g.lives--;g.updateChromeLives();g.lives==-1?g.changeGameplayMode(8):g.restartGameplay(e)};
g.switchMainGhostMode=function(b,c){if(b==4&&g.levels.frightTime==0)for(var d in g.actors){var f=g.actors[d];if(f.ghost)f.reverseDirectionsNext=a}else{f=g.mainGhostMode;if(b==4&&g.mainGhostMode!=4)g.lastMainGhostMode=g.mainGhostMode;g.mainGhostMode=b;if(b==4||f==4)g.playAmbientSound();switch(b){case 1:case 2:g.currentPlayerSpeed=g.levels.playerSpeed*0.8;g.currentDotEatingSpeed=g.levels.dotEatingSpeed*0.8;break;case 4:g.currentPlayerSpeed=g.levels.playerFrightSpeed*0.8;g.currentDotEatingSpeed=g.levels.dotEatingFrightSpeed*
0.8;g.frightModeTime=g.levels.frightTotalTime;g.modeScoreMultiplier=1;break}for(d in g.actors){f=g.actors[d];if(f.ghost){if(b!=64&&!c)f.modeChangedWhileInPen=a;if(b==4)f.eatenInThisFrightMode=e;if(f.mode!=8&&f.mode!=16&&f.mode!=32&&f.mode!=128&&f.mode!=64||c){if(!c&&f.mode!=4&&f.mode!=b)f.reverseDirectionsNext=a;f.a(b)}}else{f.fullSpeed=g.currentPlayerSpeed;f.dotEatingSpeed=g.currentDotEatingSpeed;f.tunnelSpeed=g.currentPlayerSpeed;f.d()}}}};
g.figureOutPenLeaving=function(){if(g.alternatePenLeavingScheme){g.alternateDotCount++;switch(g.alternateDotCount){case m[1]:g.actors[g.playerCount+1].freeToLeavePen=a;break;case m[2]:g.actors[g.playerCount+2].freeToLeavePen=a;break;case m[3]:if(g.actors[g.playerCount+3].mode==16)g.alternatePenLeavingScheme=e;break}}else if(g.actors[g.playerCount+1].mode==16||g.actors[g.playerCount+1].mode==8){g.actors[g.playerCount+1].dotCount++;if(g.actors[g.playerCount+1].dotCount>=g.levels.penLeavingLimits[1])g.actors[g.playerCount+
1].freeToLeavePen=a}else if(g.actors[g.playerCount+2].mode==16||g.actors[g.playerCount+2].mode==8){g.actors[g.playerCount+2].dotCount++;if(g.actors[g.playerCount+2].dotCount>=g.levels.penLeavingLimits[2])g.actors[g.playerCount+2].freeToLeavePen=a}else if(g.actors[g.playerCount+3].mode==16||g.actors[g.playerCount+3].mode==8){g.actors[g.playerCount+3].dotCount++;if(g.actors[g.playerCount+3].dotCount>=g.levels.penLeavingLimits[3])g.actors[g.playerCount+3].freeToLeavePen=a}};
g.resetForcePenLeaveTime=function(){g.forcePenLeaveTime=g.levels.penForceTime*D};
g.dotEaten=function(b,c){g.dotsRemaining--;g.dotsEaten++;g.actors[b].c(1);g.playDotEatingSound(b);if(g.playfield[c[0]][c[1]].dot==2){g.switchMainGhostMode(4,e);g.addToScore(50,b)}else g.addToScore(10,b);var d=document.getElementById(g.getDotElementId(c[0],c[1]));d.style.display="none";g.playfield[c[0]][c[1]].dot=0;g.updateCruiseElroySpeed();g.resetForcePenLeaveTime();g.figureOutPenLeaving();if(g.dotsEaten==70||g.dotsEaten==170)g.showFruit();g.dotsRemaining==0&&g.finishLevel();g.playAmbientSound()};
g.getFruitSprite=function(b){var c=b<=4?128:160;b=128+16*((b-1)%4);return[c,b]};g.getFruitScoreSprite=function(b){var c=128;b=16*(b-1);return[c,b]};g.hideFruit=function(){g.fruitShown=e;g.changeElementBkPos(g.fruitEl,32,16,a)};g.showFruit=function(){g.fruitShown=a;var b=g.getFruitSprite(g.levels.fruit);g.changeElementBkPos(g.fruitEl,b[0],b[1],a);g.fruitTime=g.timing[15]+(g.timing[16]-g.timing[15])*g.rand()};
g.eatFruit=function(b){if(g.fruitShown){g.playSound("fruit",0);g.fruitShown=e;var c=g.getFruitScoreSprite(g.levels.fruit);g.changeElementBkPos(g.fruitEl,c[0],c[1],a);g.fruitTime=g.timing[14];g.addToScore(g.levels.fruitScore,b)}};g.updateActorTargetPositions=function(){for(var b=g.playerCount;bd){g.speedIntervals[b].push(a);d=Math.floor(c)}else g.speedIntervals[b].push(e)}}return g.speedIntervals[b]};g.finishLevel=function(){g.changeGameplayMode(9)};
g.changeGameplayMode=function(b){g.gameplayMode=b;if(b!=13)for(var c=0;c0)c+=g.playerCount-1;var d=document.createElement("div");d.className="pcm-ac";d.id="actor"+
c;g.prepareElement(d,0,0);c=new E(c);c.el=d;c.elBackgroundPos=[0,0];c.elPos=[0,0];c.pos=[g.cutscene.actors[b].y*8,g.cutscene.actors[b].x*8];c.posDelta=[0,0];c.ghost=g.cutscene.actors[b].ghost;g.cutsceneCanvasEl.appendChild(d);g.cutsceneActors.push(c)}g.cutsceneNextSequence();g.stopAllAudio();g.playAmbientSound()};g.stopCutscene=function(){g.playfieldEl.style.visibility="";google.dom.remove(g.cutsceneCanvasEl);g.showChrome(a);g.newLevel(e)};
g.cutsceneNextSequence=function(){g.cutsceneSequenceId++;if(g.cutscene.sequence.length==g.cutsceneSequenceId)g.stopCutscene();else{var b=g.cutscene.sequence[g.cutsceneSequenceId];g.cutsceneTime=b.time*D;for(var c in g.cutsceneActors){var d=g.cutsceneActors[c];d.dir=b.moves[c].dir;d.speed=b.moves[c].speed;if(b.moves[c].elId)d.el.id=b.moves[c].elId;if(b.moves[c].mode)d.mode=b.moves[c].mode;d.b()}}};g.checkCutscene=function(){g.cutsceneTime<=0&&g.cutsceneNextSequence()};
g.advanceCutscene=function(){for(var b in g.cutsceneActors){var c=g.cutsceneActors[b],d=l[c.dir];c.pos[d.axis]+=d.increment*c.speed;c.b()}g.cutsceneTime--};g.updateActorPositions=function(){for(var b in g.actors)g.actors[b].k()};
g.blinkEnergizers=function(){switch(g.gameplayMode){case 4:case 5:case 6:case 7:case 9:case 10:case 11:case 12:g.playfieldEl.className="";break;case 8:case 14:g.playfieldEl.className="blk";break;default:if(g.globalTime%(g.timing[0]*2)==0)g.playfieldEl.className="";else if(g.globalTime%(g.timing[0]*2)==g.timing[0])g.playfieldEl.className="blk";break}};
g.blinkScoreLabels=function(){if(g.gameplayMode!=13){var b="";if(g.globalTime%(g.timing[17]*2)==0)b="visible";else if(g.globalTime%(g.timing[17]*2)==g.timing[17])b="hidden";if(b)for(var c=0;c0){g.ghostModeTime--;if(g.ghostModeTime<=0){g.ghostModeTime=0;g.ghostModeSwitchPos++;if(g.levels.ghostModeSwitchTimes[g.ghostModeSwitchPos]){g.ghostModeTime=g.levels.ghostModeSwitchTimes[g.ghostModeSwitchPos]*D;switch(g.mainGhostMode){case 2:g.switchMainGhostMode(1,e);break;case 1:g.switchMainGhostMode(2,e);break}}}}};
g.handleForcePenLeaveTimer=function(){if(g.forcePenLeaveTime){g.forcePenLeaveTime--;if(g.forcePenLeaveTime<=0){for(var b=1;b<=3;b++)if(g.actors[g.playerCount+b].mode==16){g.actors[g.playerCount+b].freeToLeavePen=a;break}g.resetForcePenLeaveTime()}}};g.handleTimers=function(){if(g.gameplayMode==0){g.handleForcePenLeaveTimer();g.handleFruitTimer();g.handleGhostModeTimer()}g.handleGameplayModeTimer()};
g.tick=function(){var b=(new Date).getTime();g.lastTimeDelta+=b-g.lastTime-g.tickInterval;if(g.lastTimeDelta>100)g.lastTimeDelta=100;if(g.canDecreaseFps&&g.lastTimeDelta>50){g.lastTimeSlownessCount++;g.lastTimeSlownessCount==20&&g.decreaseFps()}var c=0;if(g.lastTimeDelta>g.tickInterval){c=Math.floor(g.lastTimeDelta/g.tickInterval);g.lastTimeDelta-=g.tickInterval*c}g.lastTime=b;if(g.gameplayMode==13){for(b=0;b5)g.lives=5;g.updateChromeLives()};
g.addToScore=function(b,c){g.score[c]+=b;!g.extraLifeAwarded[c]&&g.score[c]>1E4&&g.extraLife(c);g.updateChromeScore(c)};g.updateChrome=function(){g.updateChromeLevel();g.updateChromeLives();for(var b=0;bg.scoreDigits)c=c.substr(c.length-g.scoreDigits,g.scoreDigits);for(var d=0;d=Math.max(g.level-4+1,1);b--){var c=b>=z.length?z[z.length-1].fruit:z[b].fruit,d=document.createElement("div");c=g.getFruitSprite(c);g.prepareElement(d,c[0],c[1]);g.levelEl.appendChild(d)}g.levelEl.style.marginTop=(4-Math.min(g.level,4))*16+"px"};
g.createChrome=function(){g.canvasEl.innerHTML="";g.scoreDigits=g.playerCount==1?10:5;g.scoreLabelEl=[];g.scoreLabelEl[0]=document.createElement("div");g.scoreLabelEl[0].id="pcm-sc-1-l";g.prepareElement(g.scoreLabelEl[0],160,56);g.canvasEl.appendChild(g.scoreLabelEl[0]);g.scoreEl=[];g.scoreEl[0]=document.createElement("div");g.scoreEl[0].id="pcm-sc-1";for(var b=0;b241?"ambient-4":g.dotsEaten>207?"ambient-3":g.dotsEaten>138?"ambient-2":"ambient-1";else if(g.gameplayMode==13)b="cutscene";if(b)try{g.flashSoundPlayer.playAmbientTrack(b)}catch(c){g.soundAvailable=e}}};
g.initializeTickTimer=function(){window.clearInterval(g.tickTimer);g.fps=C[g.fpsChoice];g.tickInterval=1E3/g.fps;g.tickMultiplier=D/g.fps;g.timing={};for(var b in w){var c=!g.soundEnabled&&(b==7||b==8)?1:w[b];g.timing[b]=Math.round(c*D)}g.lastTime=(new Date).getTime();g.lastTimeDelta=0;g.lastTimeSlownessCount=0;g.tickTimer=window.setInterval(g.tick,g.tickInterval)};
g.decreaseFps=function(){if(g.fpsChoicec)return 1;return 0};
g.compareVersions=function(b,c){for(var d=0,f=g.trimString(String(b)).split("."),h=g.trimString(String(c)).split("."),j=Math.max(f.length,h.length),k=0;d==0&&k=0};
g.prepareSound=function(){g.soundAvailable=e;g.soundEnabled=e;g.soundReady=e;g.detectFlash();if(!g.hasFlash||!g.isFlashVersion("9.0.0.0")){g.soundReady=a;g.checkIfEverythingIsReady()}else{g.flashIframe=document.createElement("iframe");g.flashIframe.name="pm-sound";g.flashIframe.style.position="absolute";g.flashIframe.style.top="-150px";g.flashIframe.style.border=0;g.flashIframe.style.width="100px";g.flashIframe.style.height="100px";google.dom.append(g.flashIframe);g.flashIframeDoc=g.flashIframe.contentDocument;
if(g.flashIframeDoc==undefined||g.flashIframeDoc==null)g.flashIframeDoc=g.flashIframe.contentWindow.document;g.flashIframeDoc.open();g.flashIframeDoc.write('    ');
g.flashIframeDoc.close();window.setTimeout(g.flashNotReady,3E3)}};g.flashNotReady=function(){if(!g.ready){g.soundAvailable=e;g.soundEnabled=e;g.soundReady=a;g.checkIfEverythingIsReady()}};g.flashReady=function(b){g.flashSoundPlayer=b;g.soundAvailable=a;g.soundEnabled=a;g.soundReady=a;g.checkIfEverythingIsReady()};
g.flashLoaded=function(){if(g.flashIframeDoc){var b=g.flashIframeDoc.getElementById("pacman-sound-player");if(b&&b.playTrack){g.flashReady(b);return}else if((b=g.flashIframeDoc.getElementById("pacman-sound-player-2"))&&b.playTrack){g.flashReady(b);return}}g.flashNotReady()};
g.destroy=function(){if(google.pacman){g.stopAllAudio();window.clearInterval(g.tickTimer);window.clearInterval(g.dotTimer);window.clearInterval(g.dotTimerMs);google.dom.remove(g.styleElement);google.dom.remove(g.flashIframe);google.dom.remove(g.canvasEl);google.pacman=undefined}};g.exportFunctionCalls=function(){google.pacman={};google.pacman.insertCoin=g.insertCoin;google.pacman.flashLoaded=g.flashLoaded;google.pacman.destroy=g.destroy};
g.updateLoadingProgress=function(b){b=Math.round(b*200);document.getElementById("logo-b").style.width=b+"px"};g.init=function(){g.ready=e;document.getElementById("logo").title="";g.updateLoadingProgress(0.33);g.exportFunctionCalls();g.useCss=navigator.userAgent.indexOf("MSIE 5.")!=-1||navigator.userAgent.indexOf("MSIE 6.")!=-1||navigator.userAgent.indexOf("MSIE 7.")!=-1?e:a;g.prepareGraphics();g.prepareSound()};g.init();
}();

esty

google.pacman||function(){
var a=true,e=false,g={},i=[1,4,2,8],l={0:{axis:0,increment:0},1:{axis:0,increment:-1},2:{axis:0,increment:+1},4:{axis:1,increment:-1},8:{axis:1,increment:+1}},m=[0,7,17,32],n=[{x:5,y:1,w:56},{x:5,y:4,w:5},{x:5,y:1,h:4},{x:9,y:1,h:12},{x:5,y:12,h:4},{x:10,y:12,h:4},{x:5,y:15,w:16},{x:5,y:12,w:31},{x:60,y:1,h:4},{x:54,y:1,h:4},{x:19,y:1,h:12},{x:19,y:4,w:26},{x:13,y:5,w:7},{x:13,y:5,h:4},{x:13,y:8,w:3},{x:56,y:4,h:9},{x:48,y:4,w:13},{x:48,y:1,h:12},{x:60,y:12,h:4},{x:44,y:15,w:17},{x:54,y:12,h:4},{x:44,
y:12,w:17},{x:44,y:1,h:15},{x:41,y:13,w:4},{x:41,y:13,h:3},{x:38,y:13,h:3},{x:38,y:15,w:4},{x:35,y:10,w:10},{x:35,y:1,h:15},{x:35,y:13,w:4},{x:21,y:12,h:4},{x:24,y:12,h:4},{x:24,y:15,w:12},{x:27,y:4,h:9},{x:52,y:9,w:5},{x:56,y:8,w:10,type:1},{x:1,y:8,w:9,type:1}],o=[{x:1,y:8,w:8},{x:57,y:8,w:9},{x:44,y:2,h:10},{x:35,y:5,h:7},{x:36,y:4,w:8},{x:36,y:10,w:8},{x:39,y:15,w:2}],p=[{x:5,y:15},{x:5,y:3},{x:15,y:8},{x:60,y:3},{x:60,y:15}],q=[{x:2,y:8},{x:63,y:8}],r={1:[{x:39.5,y:15,dir:4},{x:39.5,y:4,dir:4,
scatterX:57,scatterY:-4},{x:39.5,y:7,dir:2,scatterX:0,scatterY:-4},{x:37.625,y:7,dir:1,scatterX:57,scatterY:20},{x:41.375,y:7,dir:1,scatterX:0,scatterY:20}],2:[{x:40.25,y:15,dir:8},{x:38.75,y:15,dir:4},{x:39.5,y:4,dir:4,scatterX:57,scatterY:-4},{x:39.5,y:7,dir:2,scatterX:0,scatterY:-4},{x:37.625,y:7,dir:1,scatterX:57,scatterY:20},{x:41.375,y:7,dir:1,scatterX:0,scatterY:20}]},s=[32,312],v=[80,312],w={0:0.16,1:0.23,2:1,3:1,4:2.23,5:0.3,6:1.9,7:2.23,8:1.9,9:5,10:1.9,11:1.18,12:0.3,13:0.5,14:1.9,15:9,
16:10,17:0.26},y=0.8*0.4,z=[{},{ghostSpeed:0.75,ghostTunnelSpeed:0.4,playerSpeed:0.8,dotEatingSpeed:0.71,ghostFrightSpeed:0.5,playerFrightSpeed:0.9,dotEatingFrightSpeed:0.79,elroyDotsLeftPart1:20,elroySpeedPart1:0.8,elroyDotsLeftPart2:10,elroySpeedPart2:0.85,frightTime:6,frightBlinkCount:5,fruit:1,fruitScore:100,ghostModeSwitchTimes:[7,20,7,20,5,20,5,1],penForceTime:4,penLeavingLimits:[0,0,30,60]},{ghostSpeed:0.85,ghostTunnelSpeed:0.45,playerSpeed:0.9,dotEatingSpeed:0.79,ghostFrightSpeed:0.55,playerFrightSpeed:0.95,
dotEatingFrightSpeed:0.83,elroyDotsLeftPart1:30,elroySpeedPart1:0.9,elroyDotsLeftPart2:15,elroySpeedPart2:0.95,frightTime:5,frightBlinkCount:5,fruit:2,fruitScore:300,ghostModeSwitchTimes:[7,20,7,20,5,1033,1/60,1],penForceTime:4,penLeavingLimits:[0,0,0,50],cutsceneId:1},{ghostSpeed:0.85,ghostTunnelSpeed:0.45,playerSpeed:0.9,dotEatingSpeed:0.79,ghostFrightSpeed:0.55,playerFrightSpeed:0.95,dotEatingFrightSpeed:0.83,elroyDotsLeftPart1:40,elroySpeedPart1:0.9,elroyDotsLeftPart2:20,elroySpeedPart2:0.95,
frightTime:4,frightBlinkCount:5,fruit:3,fruitScore:500,ghostModeSwitchTimes:[7,20,7,20,5,1033,1/60,1],penForceTime:4,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.85,ghostTunnelSpeed:0.45,playerSpeed:0.9,dotEatingSpeed:0.79,ghostFrightSpeed:0.55,playerFrightSpeed:0.95,dotEatingFrightSpeed:0.83,elroyDotsLeftPart1:40,elroySpeedPart1:0.9,elroyDotsLeftPart2:20,elroySpeedPart2:0.95,frightTime:3,frightBlinkCount:5,fruit:3,fruitScore:500,ghostModeSwitchTimes:[7,20,7,20,5,1033,1/60,1],penForceTime:4,penLeavingLimits:[0,
0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:40,elroySpeedPart1:1,elroyDotsLeftPart2:20,elroySpeedPart2:1.05,frightTime:2,frightBlinkCount:5,fruit:4,fruitScore:700,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0],cutsceneId:2},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,
dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:50,elroySpeedPart1:1,elroyDotsLeftPart2:25,elroySpeedPart2:1.05,frightTime:5,frightBlinkCount:5,fruit:4,fruitScore:700,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:50,elroySpeedPart1:1,elroyDotsLeftPart2:25,elroySpeedPart2:1.05,frightTime:2,frightBlinkCount:5,
fruit:5,fruitScore:1E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:50,elroySpeedPart1:1,elroyDotsLeftPart2:25,elroySpeedPart2:1.05,frightTime:2,frightBlinkCount:5,fruit:5,fruitScore:1E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,
playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:60,elroySpeedPart1:1,elroyDotsLeftPart2:30,elroySpeedPart2:1.05,frightTime:1,frightBlinkCount:3,fruit:6,fruitScore:2E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0],cutsceneId:3},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:60,
elroySpeedPart1:1,elroyDotsLeftPart2:30,elroySpeedPart2:1.05,frightTime:5,frightBlinkCount:5,fruit:6,fruitScore:2E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:60,elroySpeedPart1:1,elroyDotsLeftPart2:30,elroySpeedPart2:1.05,frightTime:2,frightBlinkCount:5,fruit:7,fruitScore:3E3,ghostModeSwitchTimes:[5,
20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:80,elroySpeedPart1:1,elroyDotsLeftPart2:40,elroySpeedPart2:1.05,frightTime:1,frightBlinkCount:3,fruit:7,fruitScore:3E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,
ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:80,elroySpeedPart1:1,elroyDotsLeftPart2:40,elroySpeedPart2:1.05,frightTime:1,frightBlinkCount:3,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0],cutsceneId:3},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:80,elroySpeedPart1:1,elroyDotsLeftPart2:40,
elroySpeedPart2:1.05,frightTime:3,frightBlinkCount:5,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:100,elroySpeedPart1:1,elroyDotsLeftPart2:50,elroySpeedPart2:1.05,frightTime:1,frightBlinkCount:3,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,
penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:100,elroySpeedPart1:1,elroyDotsLeftPart2:50,elroySpeedPart2:1.05,frightTime:1,frightBlinkCount:3,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,
dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:100,elroySpeedPart1:1,elroyDotsLeftPart2:50,elroySpeedPart2:1.05,frightTime:0,frightBlinkCount:0,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0],cutsceneId:3},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:100,elroySpeedPart1:1,elroyDotsLeftPart2:50,elroySpeedPart2:1.05,frightTime:1,
frightBlinkCount:3,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:120,elroySpeedPart1:1,elroyDotsLeftPart2:60,elroySpeedPart2:1.05,frightTime:0,frightBlinkCount:0,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,
ghostTunnelSpeed:0.5,playerSpeed:1,dotEatingSpeed:0.87,ghostFrightSpeed:0.6,playerFrightSpeed:1,dotEatingFrightSpeed:0.87,elroyDotsLeftPart1:120,elroySpeedPart1:1,elroyDotsLeftPart2:60,elroySpeedPart2:1.05,frightTime:0,frightBlinkCount:0,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]},{ghostSpeed:0.95,ghostTunnelSpeed:0.5,playerSpeed:0.9,dotEatingSpeed:0.79,ghostFrightSpeed:0.75,playerFrightSpeed:0.9,dotEatingFrightSpeed:0.79,elroyDotsLeftPart1:120,
elroySpeedPart1:1,elroyDotsLeftPart2:60,elroySpeedPart2:1.05,frightTime:0,frightBlinkCount:0,fruit:8,fruitScore:5E3,ghostModeSwitchTimes:[5,20,5,20,5,1037,1/60,1],penForceTime:3,penLeavingLimits:[0,0,0,0]}],A={1:[{x:37.6,y:7,dir:1,dest:6.375,speed:0.48},{x:37.6,y:6.375,dir:2,dest:7.625,speed:0.48},{x:37.6,y:7.625,dir:1,dest:7,speed:0.48}],2:[{x:39.5,y:7,dir:2,dest:7.625,speed:0.48},{x:39.5,y:7.625,dir:1,dest:6.375,speed:0.48},{x:39.5,y:6.375,dir:2,dest:7,speed:0.48}],3:[{x:41.4,y:7,dir:1,dest:6.375,
speed:0.48},{x:41.4,y:6.375,dir:2,dest:7.625,speed:0.48},{x:41.4,y:7.625,dir:1,dest:7,speed:0.48}],4:[{x:37.6,y:7,dir:8,dest:39.5,speed:y},{x:39.5,y:7,dir:1,dest:4,speed:y}],5:[{x:39.5,y:7,dir:1,dest:4,speed:y}],6:[{x:41.4,y:7,dir:4,dest:39.5,speed:y},{x:39.5,y:7,dir:1,dest:4,speed:y}],7:[{x:39.5,y:4,dir:2,dest:7,speed:1.6},{x:39.5,y:7,dir:4,dest:37.625,speed:1.6}],8:[{x:39.5,y:4,dir:2,dest:7,speed:1.6}],9:[{x:39.5,y:4,dir:2,dest:7,speed:1.6},{x:39.5,y:7,dir:8,dest:41.375,speed:1.6}],10:[{x:37.6,
y:7,dir:8,dest:39.5,speed:y},{x:39.5,y:7,dir:1,dest:4,speed:y}],11:[{x:39.5,y:7,dir:1,dest:4,speed:y}],12:[{x:41.4,y:7,dir:4,dest:39.5,speed:y},{x:39.5,y:7,dir:1,dest:4,speed:y}]},B={1:{actors:[{ghost:e,x:64,y:9,id:0},{ghost:a,x:68.2,y:9,id:1}],sequence:[{time:5.5,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0.78*0.8*2}]},{time:0.1,moves:[{dir:4,speed:32},{dir:4,speed:0}]},{time:9,moves:[{dir:8,speed:0.75*0.8*2,elId:"pcm-bpcm"},{dir:8,speed:0.8,mode:4}]}]},2:{actors:[{ghost:e,x:64,y:9,id:0},{ghost:a,
x:70.2,y:9,id:1},{ghost:a,x:32,y:9.5,id:2}],sequence:[{time:2.7,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0.78*0.8*2},{dir:0,speed:0,elId:"pcm-stck"}]},{time:1,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0.1*0.8},{dir:0,speed:0,elId:"pcm-stck"}]},{time:1.3,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0},{dir:0,speed:0,elId:"pcm-stck"}]},{time:1,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0,elId:"pcm-ghfa"},{dir:0,speed:0,elId:"pcm-stck"}]},{time:2.5,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0,
elId:"pcm-ghfa"},{dir:0,speed:0,elId:"pcm-stck"}]}]},3:{actors:[{ghost:e,x:64,y:9,id:0},{ghost:a,x:70.2,y:9,id:2}],sequence:[{time:5.3,moves:[{dir:4,speed:0.75*0.8*2},{dir:4,speed:0.78*0.8*2,elId:"pcm-ghin"}]},{time:5.3,moves:[{dir:4,speed:0},{dir:8,speed:0.78*0.8*2,elId:"pcm-gbug"}]}]}},C=[90,45,30],D=C[0];function E(b){this.id=b}
E.prototype.A=function(){var b=r[g.playerCount][this.id];this.pos=[b.y*8,b.x*8];this.posDelta=[0,0];this.tilePos=[b.y*8,b.x*8];this.targetPos=[b.scatterY*8,b.scatterX*8];this.scatterPos=[b.scatterY*8,b.scatterX*8];this.lastActiveDir=this.dir=b.dir;this.physicalSpeed=this.requestedDir=this.nextDir=0;this.c(0);this.reverseDirectionsNext=this.freeToLeavePen=this.modeChangedWhileInPen=this.eatenInThisFrightMode=e;this.l()};
E.prototype.createElement=function(){this.el=document.createElement("div");this.el.className="pcm-ac";this.el.id="actor"+this.id;g.prepareElement(this.el,0,0);g.playfieldEl.appendChild(this.el);this.elPos=[0,0];this.elBackgroundPos=[0,0]};
E.prototype.a=function(b){var c=this.mode;this.mode=b;if(this.id==g.playerCount+3&&(b==16||c==16))g.updateCruiseElroySpeed();switch(c){case 32:g.ghostExitingPenNow=e;break;case 8:g.ghostEyesCount>0&&g.ghostEyesCount--;g.ghostEyesCount==0&&g.playAmbientSound();break}switch(b){case 4:this.fullSpeed=g.levels.ghostFrightSpeed*0.8;this.tunnelSpeed=g.levels.ghostTunnelSpeed*0.8;this.followingRoutine=e;break;case 1:this.fullSpeed=g.levels.ghostSpeed*0.8;this.tunnelSpeed=g.levels.ghostTunnelSpeed*0.8;this.followingRoutine=
e;break;case 2:this.targetPos=this.scatterPos;this.fullSpeed=g.levels.ghostSpeed*0.8;this.tunnelSpeed=g.levels.ghostTunnelSpeed*0.8;this.followingRoutine=e;break;case 8:this.tunnelSpeed=this.fullSpeed=1.6;this.targetPos=[s[0],s[1]];this.freeToLeavePen=this.followingRoutine=e;break;case 16:this.l();this.followingRoutine=a;this.routineMoveId=-1;switch(this.id){case g.playerCount+1:this.routineToFollow=2;break;case g.playerCount+2:this.routineToFollow=1;break;case g.playerCount+3:this.routineToFollow=
3;break}break;case 32:this.followingRoutine=a;this.routineMoveId=-1;switch(this.id){case g.playerCount+1:this.routineToFollow=5;break;case g.playerCount+2:this.routineToFollow=4;break;case g.playerCount+3:this.routineToFollow=6;break}g.ghostExitingPenNow=a;break;case 64:this.followingRoutine=a;this.routineMoveId=-1;switch(this.id){case g.playerCount:case g.playerCount+1:this.routineToFollow=8;break;case g.playerCount+2:this.routineToFollow=7;break;case g.playerCount+3:this.routineToFollow=9;break}break;
case 128:this.followingRoutine=a;this.routineMoveId=-1;switch(this.id){case g.playerCount:case g.playerCount+1:this.routineToFollow=11;break;case g.playerCount+2:this.routineToFollow=10;break;case g.playerCount+3:this.routineToFollow=12;break}break}this.d()};E.prototype.l=function(){if(this.id>=g.playerCount)this.targetPlayerId=Math.floor(g.rand()*g.playerCount)};
E.prototype.z=function(b){if(this.dir==g.oppositeDirections[b]){this.dir=b;this.posDelta=[0,0];this.currentSpeed!=2&&this.c(0);if(this.dir!=0)this.lastActiveDir=this.dir;this.nextDir=0}else if(this.dir!=b)if(this.dir==0){if(g.playfield[this.pos[0]][this.pos[1]].allowedDir&b)this.dir=b}else{var c=g.playfield[this.tilePos[0]][this.tilePos[1]];if(c&&c.allowedDir&b){c=l[this.dir];var d=[this.pos[0],this.pos[1]];d[c.axis]-=c.increment;var f=0;if(d[0]==this.tilePos[0]&&d[1]==this.tilePos[1])f=1;else{d[c.axis]-=
c.increment;if(d[0]==this.tilePos[0]&&d[1]==this.tilePos[1])f=2}if(f){this.dir=b;this.pos[0]=this.tilePos[0];this.pos[1]=this.tilePos[1];c=l[this.dir];this.pos[c.axis]+=c.increment*f;return}}this.nextDir=b;this.posDelta=[0,0]}};
E.prototype.i=function(b){var c=this.tilePos,d=l[this.dir],f=[c[0],c[1]];f[d.axis]+=d.increment*8;var h=g.playfield[f[0]][f[1]];if(b&&!h.intersection)h=g.playfield[c[0]][c[1]];if(h.intersection)switch(this.mode){case 2:case 1:case 8:if((this.dir&h.allowedDir)==0&&h.allowedDir==g.oppositeDirections[this.dir])this.nextDir=g.oppositeDirections[this.dir];else{b=99999999999;c=0;for(var j in i){var k=i[j];if(h.allowedDir&k&&this.dir!=g.oppositeDirections[k]){d=l[k];var x=[f[0],f[1]];x[d.axis]+=d.increment;
d=g.getDistance(x,[this.targetPos[0],this.targetPos[1]]);if(d=c[0]&&this.pos[0]<=d[0]&&this.pos[1]>=c[1]&&this.pos[1]<=d[1]){b=l[this.nextDir];this.posDelta[b.axis]+=b.increment}};
E.prototype.n=function(){if(this.pos[0]==q[0].y*8&&this.pos[1]==q[0].x*8){this.pos[0]=q[1].y*8;this.pos[1]=(q[1].x-1)*8}else if(this.pos[0]==q[1].y*8&&this.pos[1]==q[1].x*8){this.pos[0]=q[0].y*8;this.pos[1]=(q[0].x+1)*8}this.mode==8&&this.pos[0]==s[0]&&this.pos[1]==s[1]&&this.a(64);if(!this.ghost&&this.pos[0]==v[0]&&(this.pos[1]==v[1]||this.pos[1]==v[1]+8))g.eatFruit(this.id)};
E.prototype.u=function(){this.n();this.ghost&&this.i(e);var b=g.playfield[this.pos[0]][this.pos[1]];if(b.intersection)if(this.nextDir&&this.nextDir&b.allowedDir){if(this.dir!=0)this.lastActiveDir=this.dir;this.dir=this.nextDir;this.nextDir=0;if(!this.ghost){this.pos[0]+=this.posDelta[0];this.pos[1]+=this.posDelta[1];this.posDelta=[0,0]}}else if((this.dir&b.allowedDir)==0){if(this.dir!=0)this.lastActiveDir=this.dir;this.nextDir=this.dir=0;this.c(0)}};
E.prototype.o=function(){var b=this.pos[0]/8,c=this.pos[1]/8,d=[Math.round(b)*8,Math.round(c)*8];if(d[0]!=this.tilePos[0]||d[1]!=this.tilePos[1])this.p(d);else{b=[Math.floor(b)*8,Math.floor(c)*8];this.pos[1]==b[1]&&this.pos[0]==b[0]&&this.u()}!this.ghost&&this.nextDir&&g.playfield[d[0]][d[1]].intersection&&this.nextDir&g.playfield[d[0]][d[1]].allowedDir&&this.t()};
E.prototype.B=function(){if(this.id==g.playerCount&&g.dotsRemaining64?[b.tilePos[0],b.tilePos[1]]:this.scatterPos;break}}};
E.prototype.v=function(){this.routineMoveId++;if(this.routineMoveId==A[this.routineToFollow].length)if(this.mode==16&&this.freeToLeavePen&&!g.ghostExitingPenNow){this.eatenInThisFrightMode?this.a(128):this.a(32);return}else if(this.mode==32||this.mode==128){this.pos=[s[0],s[1]+4];this.dir=this.modeChangedWhileInPen?8:4;var b=g.mainGhostMode;if(this.mode==128&&b==4)b=g.lastMainGhostMode;this.a(b);return}else if(this.mode==64){if(this.id==g.playerCount||this.freeToLeavePen)this.a(128);else{this.eatenInThisFrightMode=
a;this.a(16)}return}else this.routineMoveId=0;b=A[this.routineToFollow][this.routineMoveId];this.pos[0]=b.y*8;this.pos[1]=b.x*8;this.dir=b.dir;this.physicalSpeed=0;this.speedIntervals=g.getSpeedIntervals(b.speed);this.proceedToNextRoutineMove=e;this.b()};
E.prototype.m=function(){var b=A[this.routineToFollow][this.routineMoveId];if(b)if(this.speedIntervals[g.intervalTime]){var c=l[this.dir];this.pos[c.axis]+=c.increment;switch(this.dir){case 1:case 4:if(this.pos[c.axis]b.dest*8){this.pos[c.axis]=b.dest*8;this.proceedToNextRoutineMove=a}break}this.b()}};
E.prototype.j=function(){if(this.routineMoveId==-1||this.proceedToNextRoutineMove)this.v();this.m()};E.prototype.d=function(){switch(this.currentSpeed){case 0:var b=this.id==g.playerCount&&(this.mode==2||this.mode==1)?g.cruiseElroySpeed:this.fullSpeed;break;case 1:b=this.dotEatingSpeed;break;case 2:b=this.tunnelSpeed;break}if(this.physicalSpeed!=b){this.physicalSpeed=b;this.speedIntervals=g.getSpeedIntervals(this.physicalSpeed)}};E.prototype.c=function(b){this.currentSpeed=b;this.d()};
E.prototype.e=function(){if(this.dir)if(this.speedIntervals[g.intervalTime]){var b=l[this.dir];this.pos[b.axis]+=b.increment;this.o();this.b()}};E.prototype.move=function(){if(g.gameplayMode==0||this.ghost&&g.gameplayMode==1&&(this.mode==8||this.mode==64)){if(this.requestedDir!=0){this.z(this.requestedDir);this.requestedDir=0}if(this.followingRoutine){this.j();this.mode==64&&this.j()}else{this.e();this.mode==8&&this.e()}}};
E.prototype.k=function(){var b=g.getPlayfieldX(this.pos[1]+this.posDelta[1]),c=g.getPlayfieldY(this.pos[0]+this.posDelta[0]);if(this.elPos[0]!=c||this.elPos[1]!=b){this.elPos[0]=c;this.elPos[1]=b;this.el.style.left=b+"px";this.el.style.top=c+"px"}};
E.prototype.s=function(){var b=0,c=0,d=this.dir;if(d==0)d=this.lastActiveDir;if(g.gameplayMode==1&&this.id==g.playerEatingGhostId){b=3;c=0}else if((g.gameplayMode==9||g.gameplayMode==10)&&this.id==0){b=2;c=0}else if(g.gameplayMode==4||g.gameplayMode==5||g.gameplayMode==7){b=this.id==0?2:4;c=0}else if(g.gameplayMode==3)if(this.id==g.playerDyingId){d=20-Math.floor(g.gameplayModeTime/g.timing[4]*21);if(this.id==0){b=d-1;switch(b){case -1:b=0;break;case 11:b=10;break;case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:b=
11;break}c=12}else switch(d){case 0:case 1:case 2:case 6:case 10:b=4;c=3;break;case 3:case 7:case 11:b=4;c=0;break;case 4:case 8:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:b=4;c=2;break;case 5:case 9:b=4;c=1;break}}else{b=3;c=0}else if(this.el.id=="pcm-bpcm"){b=14;c=0;d=Math.floor(g.globalTime*0.2)%4;if(d==3)d=1;c+=2*d}else{switch(d){case 4:c=0;break;case 8:c=1;break;case 1:c=2;break;case 2:c=3;break}if(g.gameplayMode!=2)b=Math.floor(g.globalTime*0.3)%4;if(b==3&&this.dir==
0)b=0;if(b==2&&this.id==0)b=0;if(b==3){b=2;if(this.id==0)c=0}if(this.id==1)b+=4}return[c,b]};
E.prototype.r=function(){var b=0,c=0;if(g.gameplayMode==10||g.gameplayMode==4||g.gameplayMode==3){b=3;c=0}else if(g.gameplayMode==1&&this.id==g.ghostBeingEatenId){switch(g.modeScoreMultiplier){case 2:b=0;break;case 4:b=1;break;case 8:b=2;break;case 16:b=3;break}c=11;this.el.className="pcm-ac pcm-n"}else if(this.mode==4||(this.mode==16||this.mode==32)&&g.mainGhostMode==4&&!this.eatenInThisFrightMode){b=0;c=8;if(g.frightModeTime60?1:g.cutsceneTime>
45?2:3:g.cutsceneSequenceId==2?3:g.cutsceneSequenceId==3||g.cutsceneSequenceId==4?4:0;c=13}else{c=this.nextDir;if(!c||g.playfield[this.tilePos[0]][this.tilePos[1]].type==1)c=this.dir;switch(c){case 4:b=4;break;case 8:b=6;break;case 1:b=0;break;case 2:b=2;break}c=4+this.id-g.playerCount;if(this.speed>0||g.gameplayMode!=13)b+=Math.floor(g.globalTime/16)%2}return[c,b]};
E.prototype.b=function(){this.k();var b=[0,0];b=g.gameplayMode==8||g.gameplayMode==14?[0,3]:this.ghost?this.r():this.s();if(this.elBackgroundPos[0]!=b[0]||this.elBackgroundPos[1]!=b[1]){this.elBackgroundPos[0]=b[0];this.elBackgroundPos[1]=b[1];b[0]*=16;b[1]*=16;g.changeElementBkPos(this.el,b[1],b[0],a)}};g.rand=function(){var b=4294967296,c=134775813;c=c*g.randSeed+1;return(g.randSeed=c%b)/b};g.seed=function(b){g.randSeed=b};
g.getDistance=function(b,c){return Math.sqrt((c[1]-b[1])*(c[1]-b[1])+(c[0]-b[0])*(c[0]-b[0]))};g.getPlayfieldX=function(b){return b+-32};g.getPlayfieldY=function(b){return b+0};g.getCorrectedSpritePos=function(b){return b/8*10+2};g.getDotElementId=function(b,c){return"pcm-d"+b+"-"+c};g.showElementById=function(b,c){var d=document.getElementById(b);if(d)d.style.visibility=c?"visible":"hidden"};
g.getAbsoluteElPos=function(b){var c=[0,0];do{c[0]+=b.offsetTop;c[1]+=b.offsetLeft}while(b=b.offsetParent);return c};
g.prepareElement=function(b,c,d){c=g.getCorrectedSpritePos(parseInt(c,10));d=g.getCorrectedSpritePos(parseInt(d,10));if(g.useCss){b.style.backgroundImage="url(/logos/pacman10-hp-sprite.png)";b.style.backgroundPosition=-c+"px "+-d+"px";b.style.backgroundRepeat="no-repeat"}else{b.style.overflow="hidden";c="display: block; position: relative; left: "+-c+"px; top: "+-d+"px";b.innerHTML=''}};
g.changeElementBkPos=function(b,c,d,f){if(f){c=g.getCorrectedSpritePos(c);d=g.getCorrectedSpritePos(d)}if(g.useCss)b.style.backgroundPosition=-c+"px "+-d+"px";else if(b.childNodes[0]){b.childNodes[0].style.left=-c+"px";b.childNodes[0].style.top=-d+"px"}};g.determinePlayfieldDimensions=function(){g.playfieldWidth=0;g.playfieldHeight=0;for(var b in n){var c=n[b];if(c.w){c=c.x+c.w-1;if(c>g.playfieldWidth)g.playfieldWidth=c}else{c=c.y+c.h-1;if(c>g.playfieldHeight)g.playfieldHeight=c}}};
g.preparePlayfield=function(){g.playfield=[];for(var b=0;b<=g.playfieldHeight+1;b++){g.playfield[b*8]=[];for(var c=-2;c<=g.playfieldWidth+1;c++)g.playfield[b*8][c*8]={path:0,dot:0,intersection:0}}};
g.preparePaths=function(){for(var b in n){var c=n[b],d=c.type;if(c.w){for(var f=c.y*8,h=c.x*8;h<=(c.x+c.w-1)*8;h+=8){g.playfield[f][h].path=a;if(g.playfield[f][h].dot==0){g.playfield[f][h].dot=1;g.dotsRemaining++}g.playfield[f][h].type=!d||h!=c.x*8&&h!=(c.x+c.w-1)*8?d:0}g.playfield[f][c.x*8].intersection=a;g.playfield[f][(c.x+c.w-1)*8].intersection=a}else{h=c.x*8;for(f=c.y*8;f<=(c.y+c.h-1)*8;f+=8){if(g.playfield[f][h].path)g.playfield[f][h].intersection=a;g.playfield[f][h].path=a;if(g.playfield[f][h].dot==
0){g.playfield[f][h].dot=1;g.dotsRemaining++}g.playfield[f][h].type=!d||f!=c.y*8&&f!=(c.y+c.h-1)*8?d:0}g.playfield[c.y*8][h].intersection=a;g.playfield[(c.y+c.h-1)*8][h].intersection=a}}for(b in o)if(o[b].w)for(h=o[b].x*8;h<=(o[b].x+o[b].w-1)*8;h+=8){g.playfield[o[b].y*8][h].dot=0;g.dotsRemaining--}else for(f=o[b].y*8;f<=(o[b].y+o[b].h-1)*8;f+=8){g.playfield[f][o[b].x*8].dot=0;g.dotsRemaining--}};
g.prepareAllowedDirections=function(){for(var b=8;b<=g.playfieldHeight*8;b+=8)for(var c=8;c<=g.playfieldWidth*8;c+=8){g.playfield[b][c].allowedDir=0;if(g.playfield[b-8][c].path)g.playfield[b][c].allowedDir+=1;if(g.playfield[b+8][c].path)g.playfield[b][c].allowedDir+=2;if(g.playfield[b][c-8].path)g.playfield[b][c].allowedDir+=4;if(g.playfield[b][c+8].path)g.playfield[b][c].allowedDir+=8}};
g.createDotElements=function(){for(var b=8;b<=g.playfieldHeight*8;b+=8)for(var c=8;c<=g.playfieldWidth*8;c+=8)if(g.playfield[b][c].dot){var d=document.createElement("div");d.className="pcm-d";d.id=g.getDotElementId(b,c);d.style.left=c+-32+"px";d.style.top=b+0+"px";g.playfieldEl.appendChild(d)}};
g.createEnergizerElements=function(){for(var b in p){var c=p[b],d=g.getDotElementId(c.y*8,c.x*8);document.getElementById(d).className="pcm-e";g.prepareElement(document.getElementById(d),0,144);g.playfield[c.y*8][c.x*8].dot=2}};g.createFruitElement=function(){g.fruitEl=document.createElement("div");g.fruitEl.id="pcm-f";g.fruitEl.style.left=g.getPlayfieldX(v[1])+"px";g.fruitEl.style.top=g.getPlayfieldY(v[0])+"px";g.prepareElement(g.fruitEl,-32,-16);g.playfieldEl.appendChild(g.fruitEl)};
g.createPlayfieldElements=function(){g.doorEl=document.createElement("div");g.doorEl.id="pcm-do";g.doorEl.style.display="none";g.playfieldEl.appendChild(g.doorEl);g.createDotElements();g.createEnergizerElements();g.createFruitElement()};g.createActors=function(){g.actors=[];for(var b=0;b8&&kf?8:4;else if(k>8&&jh?2:1};
g.handleClick=function(b){if(!b)b=window.event;g.canvasClicked(b.clientX,b.clientY)};g.registerTouch=function(){document.body.addEventListener("touchstart",g.handleTouchStart,a);g.canvasEl.addEventListener("touchstart",g.handleTouchStart,a);document.f&&document.f.q&&document.f.q.addEventListener("touchstart",g.handleTouchStart,a)};
g.handleTouchStart=function(b){g.touchDX=0;g.touchDY=0;if(b.touches.length==1){g.touchStartX=b.touches[0].pageX;g.touchStartY=b.touches[0].pageY;document.body.addEventListener("touchmove",g.handleTouchMove,a);document.body.addEventListener("touchend",g.handleTouchEnd,a)}b.preventDefault();b.stopPropagation()};g.handleTouchMove=function(b){if(b.touches.length>1)g.cancelTouch();else{g.touchDX=b.touches[0].pageX-g.touchStartX;g.touchDY=b.touches[0].pageY-g.touchStartY}b.preventDefault();b.stopPropagation()};
g.handleTouchEnd=function(b){if(g.touchDX==0&&g.touchDY==0)g.canvasClicked(g.touchStartX,g.touchStartY);else{var c=Math.abs(g.touchDX),d=Math.abs(g.touchDY);if(c<8&&d<8)g.canvasClicked(g.touchStartX,g.touchStartY);else if(c>15&&d0?8:4;else if(d>15&&c0?2:1}b.preventDefault();b.stopPropagation();g.cancelTouch()};
g.cancelTouch=function(){document.body.removeEventListener("touchmove",g.handleTouchMove,a);document.body.removeEventListener("touchend",g.handleTouchEnd,a);g.touchStartX=null;g.touchStartY=null};g.addEventListeners=function(){if(window.addEventListener){window.addEventListener("keydown",g.handleKeyDown,e);g.canvasEl.addEventListener("click",g.handleClick,e);g.registerTouch()}else{document.body.attachEvent("onkeydown",g.handleKeyDown);g.canvasEl.attachEvent("onclick",g.handleClick)}};
g.startGameplay=function(){g.score=[0,0];g.extraLifeAwarded=[e,e];g.lives=3;g.level=0;g.paused=e;g.globalTime=0;g.newLevel(a)};
g.restartGameplay=function(b){g.seed(0);g.frightModeTime=0;g.intervalTime=0;g.gameplayModeTime=0;g.fruitTime=0;g.ghostModeSwitchPos=0;g.ghostModeTime=g.levels.ghostModeSwitchTimes[0]*D;g.ghostExitingPenNow=e;g.ghostEyesCount=0;g.tilesChanged=e;g.updateCruiseElroySpeed();g.hideFruit();g.resetForcePenLeaveTime();g.restartActors();g.updateActorPositions();g.switchMainGhostMode(2,a);for(var c=g.playerCount+1;c=z.length?z[z.length-1]:z[g.level];g.levels.frightTime=Math.round(g.levels.frightTime*D);g.levels.frightTotalTime=g.levels.frightTime+g.timing[1]*(g.levels.frightBlinkCount*2-1);for(var c in g.actors)g.actors[c].dotCount=0;g.alternatePenLeavingScheme=e;g.lostLifeOnThisLevel=e;g.updateChrome();g.resetPlayfield();g.restartGameplay(b);g.level==256&&g.killScreen()};
g.newLife=function(){g.lostLifeOnThisLevel=a;g.alternatePenLeavingScheme=a;g.alternateDotCount=0;g.lives--;g.updateChromeLives();g.lives==-1?g.changeGameplayMode(8):g.restartGameplay(e)};
g.switchMainGhostMode=function(b,c){if(b==4&&g.levels.frightTime==0)for(var d in g.actors){var f=g.actors[d];if(f.ghost)f.reverseDirectionsNext=a}else{f=g.mainGhostMode;if(b==4&&g.mainGhostMode!=4)g.lastMainGhostMode=g.mainGhostMode;g.mainGhostMode=b;if(b==4||f==4)g.playAmbientSound();switch(b){case 1:case 2:g.currentPlayerSpeed=g.levels.playerSpeed*0.8;g.currentDotEatingSpeed=g.levels.dotEatingSpeed*0.8;break;case 4:g.currentPlayerSpeed=g.levels.playerFrightSpeed*0.8;g.currentDotEatingSpeed=g.levels.dotEatingFrightSpeed*
0.8;g.frightModeTime=g.levels.frightTotalTime;g.modeScoreMultiplier=1;break}for(d in g.actors){f=g.actors[d];if(f.ghost){if(b!=64&&!c)f.modeChangedWhileInPen=a;if(b==4)f.eatenInThisFrightMode=e;if(f.mode!=8&&f.mode!=16&&f.mode!=32&&f.mode!=128&&f.mode!=64||c){if(!c&&f.mode!=4&&f.mode!=b)f.reverseDirectionsNext=a;f.a(b)}}else{f.fullSpeed=g.currentPlayerSpeed;f.dotEatingSpeed=g.currentDotEatingSpeed;f.tunnelSpeed=g.currentPlayerSpeed;f.d()}}}};
g.figureOutPenLeaving=function(){if(g.alternatePenLeavingScheme){g.alternateDotCount++;switch(g.alternateDotCount){case m[1]:g.actors[g.playerCount+1].freeToLeavePen=a;break;case m[2]:g.actors[g.playerCount+2].freeToLeavePen=a;break;case m[3]:if(g.actors[g.playerCount+3].mode==16)g.alternatePenLeavingScheme=e;break}}else if(g.actors[g.playerCount+1].mode==16||g.actors[g.playerCount+1].mode==8){g.actors[g.playerCount+1].dotCount++;if(g.actors[g.playerCount+1].dotCount>=g.levels.penLeavingLimits[1])g.actors[g.playerCount+
1].freeToLeavePen=a}else if(g.actors[g.playerCount+2].mode==16||g.actors[g.playerCount+2].mode==8){g.actors[g.playerCount+2].dotCount++;if(g.actors[g.playerCount+2].dotCount>=g.levels.penLeavingLimits[2])g.actors[g.playerCount+2].freeToLeavePen=a}else if(g.actors[g.playerCount+3].mode==16||g.actors[g.playerCount+3].mode==8){g.actors[g.playerCount+3].dotCount++;if(g.actors[g.playerCount+3].dotCount>=g.levels.penLeavingLimits[3])g.actors[g.playerCount+3].freeToLeavePen=a}};
g.resetForcePenLeaveTime=function(){g.forcePenLeaveTime=g.levels.penForceTime*D};
g.dotEaten=function(b,c){g.dotsRemaining--;g.dotsEaten++;g.actors[b].c(1);g.playDotEatingSound(b);if(g.playfield[c[0]][c[1]].dot==2){g.switchMainGhostMode(4,e);g.addToScore(50,b)}else g.addToScore(10,b);var d=document.getElementById(g.getDotElementId(c[0],c[1]));d.style.display="none";g.playfield[c[0]][c[1]].dot=0;g.updateCruiseElroySpeed();g.resetForcePenLeaveTime();g.figureOutPenLeaving();if(g.dotsEaten==70||g.dotsEaten==170)g.showFruit();g.dotsRemaining==0&&g.finishLevel();g.playAmbientSound()};
g.getFruitSprite=function(b){var c=b<=4?128:160;b=128+16*((b-1)%4);return[c,b]};g.getFruitScoreSprite=function(b){var c=128;b=16*(b-1);return[c,b]};g.hideFruit=function(){g.fruitShown=e;g.changeElementBkPos(g.fruitEl,32,16,a)};g.showFruit=function(){g.fruitShown=a;var b=g.getFruitSprite(g.levels.fruit);g.changeElementBkPos(g.fruitEl,b[0],b[1],a);g.fruitTime=g.timing[15]+(g.timing[16]-g.timing[15])*g.rand()};
g.eatFruit=function(b){if(g.fruitShown){g.playSound("fruit",0);g.fruitShown=e;var c=g.getFruitScoreSprite(g.levels.fruit);g.changeElementBkPos(g.fruitEl,c[0],c[1],a);g.fruitTime=g.timing[14];g.addToScore(g.levels.fruitScore,b)}};g.updateActorTargetPositions=function(){for(var b=g.playerCount;bd){g.speedIntervals[b].push(a);d=Math.floor(c)}else g.speedIntervals[b].push(e)}}return g.speedIntervals[b]};g.finishLevel=function(){g.changeGameplayMode(9)};
g.changeGameplayMode=function(b){g.gameplayMode=b;if(b!=13)for(var c=0;c0)c+=g.playerCount-1;var d=document.createElement("div");d.className="pcm-ac";d.id="actor"+
c;g.prepareElement(d,0,0);c=new E(c);c.el=d;c.elBackgroundPos=[0,0];c.elPos=[0,0];c.pos=[g.cutscene.actors[b].y*8,g.cutscene.actors[b].x*8];c.posDelta=[0,0];c.ghost=g.cutscene.actors[b].ghost;g.cutsceneCanvasEl.appendChild(d);g.cutsceneActors.push(c)}g.cutsceneNextSequence();g.stopAllAudio();g.playAmbientSound()};g.stopCutscene=function(){g.playfieldEl.style.visibility="";google.dom.remove(g.cutsceneCanvasEl);g.showChrome(a);g.newLevel(e)};
g.cutsceneNextSequence=function(){g.cutsceneSequenceId++;if(g.cutscene.sequence.length==g.cutsceneSequenceId)g.stopCutscene();else{var b=g.cutscene.sequence[g.cutsceneSequenceId];g.cutsceneTime=b.time*D;for(var c in g.cutsceneActors){var d=g.cutsceneActors[c];d.dir=b.moves[c].dir;d.speed=b.moves[c].speed;if(b.moves[c].elId)d.el.id=b.moves[c].elId;if(b.moves[c].mode)d.mode=b.moves[c].mode;d.b()}}};g.checkCutscene=function(){g.cutsceneTime<=0&&g.cutsceneNextSequence()};
g.advanceCutscene=function(){for(var b in g.cutsceneActors){var c=g.cutsceneActors[b],d=l[c.dir];c.pos[d.axis]+=d.increment*c.speed;c.b()}g.cutsceneTime--};g.updateActorPositions=function(){for(var b in g.actors)g.actors[b].k()};
g.blinkEnergizers=function(){switch(g.gameplayMode){case 4:case 5:case 6:case 7:case 9:case 10:case 11:case 12:g.playfieldEl.className="";break;case 8:case 14:g.playfieldEl.className="blk";break;default:if(g.globalTime%(g.timing[0]*2)==0)g.playfieldEl.className="";else if(g.globalTime%(g.timing[0]*2)==g.timing[0])g.playfieldEl.className="blk";break}};
g.blinkScoreLabels=function(){if(g.gameplayMode!=13){var b="";if(g.globalTime%(g.timing[17]*2)==0)b="visible";else if(g.globalTime%(g.timing[17]*2)==g.timing[17])b="hidden";if(b)for(var c=0;c0){g.ghostModeTime--;if(g.ghostModeTime<=0){g.ghostModeTime=0;g.ghostModeSwitchPos++;if(g.levels.ghostModeSwitchTimes[g.ghostModeSwitchPos]){g.ghostModeTime=g.levels.ghostModeSwitchTimes[g.ghostModeSwitchPos]*D;switch(g.mainGhostMode){case 2:g.switchMainGhostMode(1,e);break;case 1:g.switchMainGhostMode(2,e);break}}}}};
g.handleForcePenLeaveTimer=function(){if(g.forcePenLeaveTime){g.forcePenLeaveTime--;if(g.forcePenLeaveTime<=0){for(var b=1;b<=3;b++)if(g.actors[g.playerCount+b].mode==16){g.actors[g.playerCount+b].freeToLeavePen=a;break}g.resetForcePenLeaveTime()}}};g.handleTimers=function(){if(g.gameplayMode==0){g.handleForcePenLeaveTimer();g.handleFruitTimer();g.handleGhostModeTimer()}g.handleGameplayModeTimer()};
g.tick=function(){var b=(new Date).getTime();g.lastTimeDelta+=b-g.lastTime-g.tickInterval;if(g.lastTimeDelta>100)g.lastTimeDelta=100;if(g.canDecreaseFps&&g.lastTimeDelta>50){g.lastTimeSlownessCount++;g.lastTimeSlownessCount==20&&g.decreaseFps()}var c=0;if(g.lastTimeDelta>g.tickInterval){c=Math.floor(g.lastTimeDelta/g.tickInterval);g.lastTimeDelta-=g.tickInterval*c}g.lastTime=b;if(g.gameplayMode==13){for(b=0;b5)g.lives=5;g.updateChromeLives()};
g.addToScore=function(b,c){g.score[c]+=b;!g.extraLifeAwarded[c]&&g.score[c]>1E4&&g.extraLife(c);g.updateChromeScore(c)};g.updateChrome=function(){g.updateChromeLevel();g.updateChromeLives();for(var b=0;bg.scoreDigits)c=c.substr(c.length-g.scoreDigits,g.scoreDigits);for(var d=0;d=Math.max(g.level-4+1,1);b--){var c=b>=z.length?z[z.length-1].fruit:z[b].fruit,d=document.createElement("div");c=g.getFruitSprite(c);g.prepareElement(d,c[0],c[1]);g.levelEl.appendChild(d)}g.levelEl.style.marginTop=(4-Math.min(g.level,4))*16+"px"};
g.createChrome=function(){g.canvasEl.innerHTML="";g.scoreDigits=g.playerCount==1?10:5;g.scoreLabelEl=[];g.scoreLabelEl[0]=document.createElement("div");g.scoreLabelEl[0].id="pcm-sc-1-l";g.prepareElement(g.scoreLabelEl[0],160,56);g.canvasEl.appendChild(g.scoreLabelEl[0]);g.scoreEl=[];g.scoreEl[0]=document.createElement("div");g.scoreEl[0].id="pcm-sc-1";for(var b=0;b241?"ambient-4":g.dotsEaten>207?"ambient-3":g.dotsEaten>138?"ambient-2":"ambient-1";else if(g.gameplayMode==13)b="cutscene";if(b)try{g.flashSoundPlayer.playAmbientTrack(b)}catch(c){g.soundAvailable=e}}};
g.initializeTickTimer=function(){window.clearInterval(g.tickTimer);g.fps=C[g.fpsChoice];g.tickInterval=1E3/g.fps;g.tickMultiplier=D/g.fps;g.timing={};for(var b in w){var c=!g.soundEnabled&&(b==7||b==8)?1:w[b];g.timing[b]=Math.round(c*D)}g.lastTime=(new Date).getTime();g.lastTimeDelta=0;g.lastTimeSlownessCount=0;g.tickTimer=window.setInterval(g.tick,g.tickInterval)};
g.decreaseFps=function(){if(g.fpsChoicec)return 1;return 0};
g.compareVersions=function(b,c){for(var d=0,f=g.trimString(String(b)).split("."),h=g.trimString(String(c)).split("."),j=Math.max(f.length,h.length),k=0;d==0&&k=0};
g.prepareSound=function(){g.soundAvailable=e;g.soundEnabled=e;g.soundReady=e;g.detectFlash();if(!g.hasFlash||!g.isFlashVersion("9.0.0.0")){g.soundReady=a;g.checkIfEverythingIsReady()}else{g.flashIframe=document.createElement("iframe");g.flashIframe.name="pm-sound";g.flashIframe.style.position="absolute";g.flashIframe.style.top="-150px";g.flashIframe.style.border=0;g.flashIframe.style.width="100px";g.flashIframe.style.height="100px";google.dom.append(g.flashIframe);g.flashIframeDoc=g.flashIframe.contentDocument;
if(g.flashIframeDoc==undefined||g.flashIframeDoc==null)g.flashIframeDoc=g.flashIframe.contentWindow.document;g.flashIframeDoc.open();g.flashIframeDoc.write('    ');
g.flashIframeDoc.close();window.setTimeout(g.flashNotReady,3E3)}};g.flashNotReady=function(){if(!g.ready){g.soundAvailable=e;g.soundEnabled=e;g.soundReady=a;g.checkIfEverythingIsReady()}};g.flashReady=function(b){g.flashSoundPlayer=b;g.soundAvailable=a;g.soundEnabled=a;g.soundReady=a;g.checkIfEverythingIsReady()};
g.flashLoaded=function(){if(g.flashIframeDoc){var b=g.flashIframeDoc.getElementById("pacman-sound-player");if(b&&b.playTrack){g.flashReady(b);return}else if((b=g.flashIframeDoc.getElementById("pacman-sound-player-2"))&&b.playTrack){g.flashReady(b);return}}g.flashNotReady()};
g.destroy=function(){if(google.pacman){g.stopAllAudio();window.clearInterval(g.tickTimer);window.clearInterval(g.dotTimer);window.clearInterval(g.dotTimerMs);google.dom.remove(g.styleElement);google.dom.remove(g.flashIframe);google.dom.remove(g.canvasEl);google.pacman=undefined}};g.exportFunctionCalls=function(){google.pacman={};google.pacman.insertCoin=g.insertCoin;google.pacman.flashLoaded=g.flashLoaded;google.pacman.destroy=g.destroy};
g.updateLoadingProgress=function(b){b=Math.round(b*200);document.getElementById("logo-b").style.width=b+"px"};g.init=function(){g.ready=e;document.getElementById("logo").title="";g.updateLoadingProgress(0.33);g.exportFunctionCalls();g.useCss=navigator.userAgent.indexOf("MSIE 5.")!=-1||navigator.userAgent.indexOf("MSIE 6.")!=-1||navigator.userAgent.indexOf("MSIE 7.")!=-1?e:a;g.prepareGraphics();g.prepareSound()};g.init();
}();