diff options
Diffstat (limited to 'js/mapspecs.js')
-rw-r--r-- | js/mapspecs.js | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/js/mapspecs.js b/js/mapspecs.js index e1def28..ee9759d 100644 --- a/js/mapspecs.js +++ b/js/mapspecs.js @@ -20,6 +20,7 @@ else if (document.attachEvent) { // IE 8- }
var isChallenge = false;
+var isTutorial = false;
var solution = new Array();
var blocks = new Array();
@@ -190,6 +191,12 @@ function requestSol(mapID) { ajax.runAJAX();
}
+function requestChallengeSolution(mapID, challengeID) {
+ ajax.requestFile = "do.php?r=getChallengeSolution&mapID="+mapID+'&challengeID='+challengeID; //prepare strdata
+ ajax.onCompletion = requestSolDone; // specify function to be executed on response
+ ajax.runAJAX();
+}
+
function requestSolDone() {
var JO;
JO = decryptJSON(ajax.response);
@@ -261,7 +268,10 @@ function request_path_done() { return;
}
+
var disptext = "Record: "+JO.best+" by "+JO.bestby;
+ if (isChallenge)
+ disptext = '';
updateDsp(JO.mapid, 'dspID', disptext);
mapdata[mapid].moveCount = new Object;
@@ -277,18 +287,6 @@ function request_path_done() { mapdata[mapid].pathColor[i] = '#ffffff';
animatePath(JO.path[i].path, mapid, JO.path[i].start, i);
}
-
- //Mark off challenges
- //TODO: Temporarly disabled because it breaks the tutorial;
- if(isChallenge && 2 == 4)
- {
- for(var i = 0; i < JO.completedChallenges.length; i++)
- {
- var challengeId = JO.completedChallenges[i];
- document.getElementById("challenge_id_" + challengeId).className = "challenge_complete";
- }
- }
-
}
function decryptJSON(text) {
@@ -323,6 +321,22 @@ function animatePathDone(mapid) { if (isChallenge == true) {
challengeGo(mapid);
}
+ //Mark off challenges
+ //TODO: This hack is stupidd :(
+ if(isChallenge && isTutorial == false)
+ {
+ for(var i = 0; i < mapjson[mapid].completedChallenges.length; i++)
+ {
+ var challengeId = mapjson[mapid].completedChallenges[i];
+ var handle = document.getElementById("challenge_id_" + challengeId);
+
+ if (handle.className.indexOf('challenge_complete') < 0) {
+
+ handle.className = "challenge_complete";
+ flashelement("challenge_id_" + challengeId, 4);
+ }
+ }
+ }
}
function checkSound(mapid) {
@@ -597,6 +611,7 @@ function doanimate(x, y, p, c, mapid, pathNumber) { switch (selected) {
case '1':
rs =120;
+ rs =0;
break;
case '2':
@@ -670,8 +685,13 @@ function doanimate(x, y, p, c, mapid, pathNumber) { // if (mapdata[mapid].moveCount[1] < mapdata[mapid].moveCount[pathNumber] - 2
// || mapdata[mapid].moveCount[0] < mapdata[mapid].moveCount[pathNumber] - 2)
// rs = rs + 100;
+
+ if (count[mapid] % 2 == 1 && rs == 0)
+ doanimate(x,y,p,t,mapid,pathNumber);
+ else
+ setTimeout("doanimate("+x+","+y+",'"+p+"','"+t+"','"+mapid+"','"+pathNumber+"')",rs);
+ //setTimeout("doanimate("+x+","+y+",'"+p+"','"+t+"','"+mapid+"','"+pathNumber+"')",1);
- setTimeout("doanimate("+x+","+y+",'"+p+"','"+t+"','"+mapid+"','"+pathNumber+"')",rs);
}
|