summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--css/maps.css41
-rw-r--r--do.php4
-rw-r--r--includes/maps.php12
-rw-r--r--js/mapspecs.js204
-rw-r--r--pages/gallery.php73
5 files changed, 237 insertions, 97 deletions
diff --git a/css/maps.css b/css/maps.css
index 13fcacb..3b2cd85 100644
--- a/css/maps.css
+++ b/css/maps.css
@@ -86,7 +86,8 @@
.grid_td_animate, .grid_td_animate_pre,
.grid_td_tp1_in, .grid_td_tp2_in, .grid_td_tp3_in, .grid_td_tp4_in, .grid_td_tp5_in,
.grid_td_tp1_out, .grid_td_tp2_out, .grid_td_tp3_out, .grid_td_tp4_out,.grid_td_tp5_out,
-.grid_td_path1 , .grid_td_path2, .grid_td_path3, .grid_td_path4
+.grid_td_path0-1 , .grid_td_path0-2, .grid_td_path0-3, .grid_td_path0-4,
+.grid_td_path1-1 , .grid_td_path1-2, .grid_td_path1-3, .grid_td_path1-4
{
padding: 0px;
margin: 0px;
@@ -295,26 +296,46 @@
-o-transition:background-color 0s;
-moz-transition:background-color 0s;
}
-.grid_td_path1 , .grid_td_path2, .grid_td_path3, .grid_td_path4 {
+
+.grid_td_path0-1 , .grid_td_path0-2, .grid_td_path0-3, .grid_td_path0-4 {
transition:background-color .5s ease-out;
-webkit-transition:background-color .5s ease-out;
-o-transition:background-color .5s ease-out;
-moz-transition:background-color .5s ease-out;
}
-.grid_td_path1 {
- background: url(../images/Path1.png);
+.grid_td_path0-1 {
+ background: url(../images/paths/Path1-1.png);
+}
+.grid_td_path0-2 {
+ background: url(../images/paths/Path1-2.png);
+}
+.grid_td_path0-3 {
+ background: url(../images/paths/Path1-3.png);
+}
+.grid_td_path0-4 {
+ background: url(../images/paths/Path1-4.png);
+}
+.grid_td_path1-1 , .grid_td_path1-2, .grid_td_path1-3, .grid_td_path1-4 {
+ transition:background-color .5s ease-out;
+ -webkit-transition:background-color .5s ease-out;
+ -o-transition:background-color .5s ease-out;
+ -moz-transition:background-color .5s ease-out;
+}
+.grid_td_path1-1 {
+ background: url(../images/paths/Path2-1.png);
}
-.grid_td_path2 {
- background: url(../images/Path2.png);
+.grid_td_path1-2 {
+ background: url(../images/paths/Path2-2.png);
}
-.grid_td_path3 {
- background: url(../images/Path3.png);
+.grid_td_path1-3 {
+ background: url(../images/paths/Path2-3.png);
}
-.grid_td_path4 {
- background: url(../images/Path4.png);
+.grid_td_path1-4 {
+ background: url(../images/paths/Path2-4.png);
}
+
.mapdisplay, .mapdisplay_up
{
position:absolute;
diff --git a/do.php b/do.php
index 5473cba..e0dc2eb 100644
--- a/do.php
+++ b/do.php
@@ -134,8 +134,8 @@ if ($_GET['r'] == 'getpath') {
// New
// !! Broken!
//Route the path
- $json['path1'] = routePath($mygrid);
- $json['path2'] = routePath($mygrid, 'X');
+ $json['path'][] = routePath($mygrid);
+ $json['path'][] = routePath($mygrid, 'X');
// !! Tmp
//$moves = $json['moves'];
diff --git a/includes/maps.php b/includes/maps.php
index 474a2ad..f49900f 100644
--- a/includes/maps.php
+++ b/includes/maps.php
@@ -888,19 +888,21 @@ function routePath($mygrid, $start = '', $validate = false) {
if (in_array("S", $tileLocations)) {
}
-
+ $pathx = false;
// Tmp bad code..
- if ($start == 'X')
+ if ($start == 'X') {
+ $pathx = true;
$start = findTiles($mygrid, "S");
- else
+ } else
$start = findTiles($mygrid, "s");
//Checkpoint names
$cpnames = array("a", "b", "c", "d", "e");
-
+ if ($pathx)
+ $cpnames = array("e", "d", "c", "b", "a");
//!! Improve the 'findTiles' function to prevent duplicate itterations.
//Add the existing checkpoints to target array.
@@ -1065,4 +1067,4 @@ function findTilesM ($mapMatrix, $search) {
return $r;
}
-?>
+?>
diff --git a/js/mapspecs.js b/js/mapspecs.js
index 4d4acbe..cbb642c 100644
--- a/js/mapspecs.js
+++ b/js/mapspecs.js
@@ -268,7 +268,7 @@ function request_path_done() {
mixpanel.track('click go', {
'speed': speed,
'mute': mute,
- 'mapid': JO.mapid,
+ 'mapid': mapid,
'type': mapType,
'response time': responseTime
});
@@ -284,9 +284,16 @@ function request_path_done() {
var disptext = "Record: "+JO.best+" by "+JO.bestby;
updateDsp(JO.mapid, 'dspID', disptext);
- animatePath(JO.path1.path, JO.mapid, JO.path1.start);
-
- animatePath(JO.path2.path, JO.mapid, JO.path2.start);
+ mapdata[mapid].moveCount = new Object;
+ mapdata[mapid].restoreTiles = new Array();
+ mapdata[mapid].pathColor = new Object;
+
+ for(var i in JO.path) {
+ mapdata[mapid].moveCount[i] = 0;
+ mapdata[mapid].pathColor[i] = '#ffffff';
+ animatePath(JO.path[i].path, mapid, JO.path[i].start, i);
+ }
+ mapdata[JO.mapid].pathsPending = i;
}
function decryptJSON(text) {
@@ -300,7 +307,7 @@ function decryptJSON(text) {
}
-function animatePath(path, mapid, start) {
+function animatePath(path, mapid, start, pathNumber) {
tmp = start.split(',');
y = tmp[0];
x = tmp[1];
@@ -310,12 +317,14 @@ function animatePath(path, mapid, start) {
t = '';
//count[mapid] = 0;
document.getElementById(mapid+',btn').disabled = true;
- doanimate(x, y, p, t, mapid);
+ doanimate(x, y, p, t, mapid, pathNumber);
//setTimeout("doanimate("+x+","+y+",'"+p+"',"+t+")",500);
}
function animatePathDone(mapid) {
- // console.log('Animate Path Done', mapid);
+
+ //console.log('Animate Path Done', mapid);
+
scoresRequestPage(mapid, currentPage[mapid]);
document.getElementById(mapid+',btn').disabled = false;
if (isChallenge == true) {
@@ -334,8 +343,7 @@ function checkSound(mapid) {
}
var snake = new Array();
-var snakeeffected = new Array();
-function doanimate(x, y, p, c, mapid) {
+function doanimate(x, y, p, c, mapid, pathNumber) {
//x, y position
//p path string being trunicated.
@@ -349,19 +357,22 @@ function doanimate(x, y, p, c, mapid) {
}
if (snake[mapid] == undefined) {
snake[mapid] = new Array();
- snake[mapid]['color'] = '#ccc';
+ mapdata[mapid].pathColor[pathNumber] = '#ccc';
}
if (count[mapid] == 0) {
if (t == 'a') {
- snake[mapid]['color'] = '#F777FF';
+ mapdata[mapid].pathColor[pathNumber] = '#F777FF';
}
if (t == 'f') {
- snake[mapid]['color'] = '#ccc';
+ mapdata[mapid].pathColor[pathNumber] = '#ccc';
}
}
//Display movecount
- updateDsp(mapid, 'dspCount', count[mapid]+ " moves");
+ if (mapdata[mapid].moveCount[1] > 0) {
+ updateDsp(mapid, 'dspCount', mapdata[mapid].moveCount[0] + ' + ' + mapdata[mapid].moveCount[1] + ' = ' + count[mapid] + " moves");
+ } else
+ updateDsp(mapid, 'dspCount', count[mapid]+ " moves");
//document.getElementById(mapid+',dspCount').innerHTML = count[mapid]+ " moves";
//Get a handle on the element.
@@ -376,15 +387,15 @@ function doanimate(x, y, p, c, mapid) {
//Maintain our original classname, no matter the cost!
origclass = handle.className;
- if ( origclass == 'grid_td_path1' ||
- origclass == 'grid_td_path2' ||
- origclass == 'grid_td_path3' ||
- origclass == 'grid_td_path4' ) {
+ if ( origclass == 'grid_td_path'+pathNumber+'-1' ||
+ origclass == 'grid_td_path'+pathNumber+'-2' ||
+ origclass == 'grid_td_path'+pathNumber+'-3' ||
+ origclass == 'grid_td_path'+pathNumber+'-4' ) {
// if (origclass == 'grid_td_animate' || origclass == 'grid_td_animate_pre' ) {
origclass = handle.classOrigName;
//setTimeout(handle.setAttribute('class', origclass), 850);
}
- //handle.style.backgroundColor = snake[mapid]['color'];
+ //handle.style.backgroundColor = mapdata[mapid].pathColor[pathNumber];
handle.classOrigName = origclass;
@@ -395,16 +406,19 @@ function doanimate(x, y, p, c, mapid) {
if (count[mapid] !== 0)
break;
count[mapid]--;
+ mapdata[mapid].moveCount[pathNumber]--;
+ //break;
case '1': //1 - Up
case '2': //2 - Right
case '3': //3 - Down
case '4': //4 - Left
count[mapid]++;
+ mapdata[mapid].moveCount[pathNumber]++;
//Starting;
switch(count[mapid]) {
case mapjson[mapid].best:
- flashelement(mapid+',dspCount', 4, "#FF0000");
+ //flashelement(mapid+',dspCount', 4, "#FF0000");
break;
case 500:
case 400:
@@ -425,47 +439,68 @@ function doanimate(x, y, p, c, mapid) {
childdiv = document.getElementById('child_'+handle.id);
if (childdiv.className != 'grid_td_walls') {
- childdiv.setAttribute('class', 'grid_td_path'+c);
-
- handle.style.backgroundColor = snake[mapid]['color'];
- var origColor = handle.style.backgroundColor;
+ childdiv.setAttribute('class', 'grid_td_path'+pathNumber+'-'+c);
+
+ var origColor = rgbStringToHex(handle.style.backgroundColor);
+ console.log("OriginalColor", origColor);
+
+ handle.style.backgroundColor = mapdata[mapid].pathColor[pathNumber];
- string = "if (document.getElementById('"+'child_'+eid+"').className == 'grid_td_path"+c+"')";
+
+ string = "if (document.getElementById('"+'child_'+eid+"').className == 'grid_td_path"+pathNumber+'-'+c+"')";
string += "document.getElementById('"+'child_'+eid+"').removeAttribute('class');";
setTimeout(string, 855);
+ //Reset our color back to the way it was.
+ //setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+origColor+"';", 865);
//Maintain disabled appearnce of checkpoints
if (handle.pressed == true) {
- setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '#dddddd';", 865);
+ setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+origColor+"';", 865);
} else {
setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '';", 865);
}
}
-
break;
//Teleports
- case 't':
- //case 'u':
- case 'm':
- case 'g':
- case 'i':
- case 'k':
+ case 't': case 'u': case 'm': case 'g': case 'i': case 'k':
case 'q': //Teleport out;
- case 'b': //Checkpoints
- case 'c':
- case 'd':
- case 'e':
+ //Checkpoints
case 'r':
+ if (handle.pressed == true)
+ break;
+ case 'b': case 'c': case 'd': case 'e':
+
+
//handle.setAttribute('class', 'grid_td_pressed');
//handle.classOrigName = 'grid_td_pressed';
- snakeeffected.push("document.getElementById('"+eid+"').style.backgroundColor = '';");
- snakeeffected.push("document.getElementById('"+eid+"').pressed = false;");
- handle.style.backgroundColor = '#dddddd';
- setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '#dddddd';", 865);
+ if (handle.pressed == true) {
+ handle.style.backgroundColor = '#dddddd';
+ setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '#dddddd';", 865);
+ //alert("Pressed Point Solid Grayed is " + c);
+ break;
+ }
+
+ var currentColor = rgbStringToHex(handle.style.backgroundColor);
+ if (currentColor == '')
+ break;
+
+ var dulled = '#'+dullColor(currentColor, .6);
+
+ console.log('bgcolor', dulled, currentColor);
+ //handle.style.backgroundColor = '#dddddd';
+
+ handle.style.backgroundColor = dulled;
+ setTimeout("document.getElementById('"+eid+"').style.backgroundColor = '"+dulled+"';", 865);
+
handle.pressed = true;
+ mapdata[mapid].restoreTiles.push("document.getElementById('"+eid+"').style.backgroundColor = '';");
+ mapdata[mapid].restoreTiles.push("document.getElementById('"+eid+"').pressed = false;");
+
+ //alert(mapdata[mapid].pathColor[pathNumber]);
+
break;
}
@@ -483,6 +518,13 @@ function doanimate(x, y, p, c, mapid) {
//Speaking of the next tile - does it exist?
//End of the line?
if (t == '') {
+
+ mapdata[mapid].pathsPending--;
+ //console.log('path pending', mapdata[mapid].pathsPending);
+ if (mapdata[mapid].pathsPending >= 0)
+ return;
+
+ //console.log('path pending complete', mapdata[mapid].pathsPending);
//Did we beat or tie any records?
//Saw someone do this, thought it was clever.
@@ -524,14 +566,14 @@ function doanimate(x, y, p, c, mapid) {
//This is the end, lets reset stuff to defaults.
count[mapid] = 0;
- snake[mapid]['color'] = '#ffffff';
+ mapdata[mapid].pathColor[pathNumber] = '#ffffff';
//Bring the color back to our checkpoints/teleports.
- for(var i in snakeeffected) {
- //eval(snakeeffected[i]);
- setTimeout((snakeeffected[i]), 2000);
+ for(var i in mapdata[mapid].restoreTiles) {
+ //eval(mapdata[mapid].restoreTiles[i]);
+ setTimeout((mapdata[mapid].restoreTiles[i]), 2000);
}
//Clear
- snakeeffected = new Array();
+ mapdata[mapid].restoreTiles = new Array();
//We're done,
animatePathDone(mapid);
return;
@@ -575,29 +617,29 @@ function doanimate(x, y, p, c, mapid) {
//Checkpoint targets:
case 'a':
// rs = rs * 9;
- snake[mapid]['color'] = '#F777FF';
+ mapdata[mapid].pathColor[pathNumber] = '#F777FF';
break;
case 'b':
rs = rs + 410;
- snake[mapid]['color'] = '#FFFF11';
+ mapdata[mapid].pathColor[pathNumber] = '#FFFF11';
//handle.style.backgroundColor = "#000000";
break;
case 'c':
rs = rs + 410;
- snake[mapid]['color'] = '#FF4466';
+ mapdata[mapid].pathColor[pathNumber] = '#FF4466';
break;
case 'd':
rs = rs + 410;
- snake[mapid]['color'] = '#ff9911';
+ mapdata[mapid].pathColor[pathNumber] = '#ff9911';
break;
case 'e':
rs = rs + 410;
- snake[mapid]['color'] = '#00FFFF';
+ mapdata[mapid].pathColor[pathNumber] = '#00FFFF';
break;
//Finish target
case 'f':
rs = rs + 410;
- snake[mapid]['color'] = '#ccc';
+ mapdata[mapid].pathColor[pathNumber] = '#ccc';
break;
//Hey, we've ran into a teleport.
@@ -622,21 +664,22 @@ function doanimate(x, y, p, c, mapid) {
document.getElementById(eid).style.backgroundColor='#CCCCCC';
document.getElementById(tpEid).style.backgroundColor='#CCCCCC';
- flashelement(tpEid, 8, snake[mapid]['color']);
+ flashelement(tpEid, 8, mapdata[mapid].pathColor[pathNumber]);
//The path once teleported - and an r to indicate to gray the teleport-out too.
p = 'q'+tmp[2];
//Slow down
rs = rs + 1200;
- setTimeout("doanimate("+x+","+y+",'"+p+"','"+t+"',"+mapid+")",rs);
- return;
break;
}
//Remove move from p
p = p.substring(1);
//rs = (10 * p.length) + 40;
+ // if (mapdata[mapid].moveCount[1] < mapdata[mapid].moveCount[pathNumber] - 2
+ // || mapdata[mapid].moveCount[0] < mapdata[mapid].moveCount[pathNumber] - 2)
+ // rs = rs + 100;
- setTimeout("doanimate("+x+","+y+",'"+p+"','"+t+"','"+mapid+"')",rs);
+ setTimeout("doanimate("+x+","+y+",'"+p+"','"+t+"','"+mapid+"','"+pathNumber+"')",rs);
}
function flashelement(eid, times, color, speed) {
@@ -673,6 +716,56 @@ function flashelement(eid, times, color, speed) {
}
+function dullColor(colorAsHex, value) {
+ var r = hexToR(colorAsHex);
+ var g = hexToG(colorAsHex);
+ var b = hexToB(colorAsHex);
+
+ r = r + ((221 - r) * value)
+ g = g + ((221 - g) * value)
+ b = b + ((221 - b) * value)
+ r = parseInt(r);
+ g = parseInt(g);
+ b = parseInt(b);
+ // r = r + value;
+ // g = g + value;
+ // b = b + value;
+ return rgbToHex(r, g, b);
+}
+
+//Color modifications
+// Thanks javascripter.net
+function rgbToHex(R,G,B) {return toHex(R)+toHex(G)+toHex(B)}
+function toHex(n) {
+ n = parseInt(n,10);
+ if (isNaN(n)) return "00";
+ n = Math.max(0,Math.min(n,255));
+ return "0123456789ABCDEF".charAt((n-n%16)/16)
+ + "0123456789ABCDEF".charAt(n%16);
+}
+function hexToR(h) {return parseInt((cutHex(h)).substring(0,2),16)}
+function hexToG(h) {return parseInt((cutHex(h)).substring(2,4),16)}
+function hexToB(h) {return parseInt((cutHex(h)).substring(4,6),16)}
+function cutHex(h) {return (h.charAt(0)=="#") ? h.substring(1,7):h}
+
+//Thanks stackExchange
+function rgbStringToHex(rgbString) {
+ if (rgbString == '')
+ return '';
+ // var rgbString = "rgb(0, 70, 255)"; // get this in whatever way.
+
+ var parts = rgbString.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
+ // parts now should be ["rgb(0, 70, 255", "0", "70", "255"]
+
+ delete (parts[0]);
+ for (var i = 1; i <= 3; ++i) {
+ parts[i] = parseInt(parts[i]).toString(16);
+ if (parts[i].length == 1) parts[i] = '0' + parts[i];
+ }
+ return hexString ='#'+parts.join('').toUpperCase(); // "#0070FF"
+}
+
+
function savePref(pref, value) {
setCookie('pref_'+pref, value,31);
@@ -702,7 +795,6 @@ for (i=0;i<ARRcookies.length;i++)
}
-
//== Outdated functions
var de = false;
function displaymap(obj) {
diff --git a/pages/gallery.php b/pages/gallery.php
index e4e5d17..a860a7c 100644
--- a/pages/gallery.php
+++ b/pages/gallery.php
@@ -1,8 +1,27 @@
<?PHP
htmlHeader(array(), '', '', array('scores'));
+
+include_once ('./includes/db.inc.php');
+if ($accepted) {
+ $userID = $_SESSION['userID'];
+
+ $sql = "
+ SELECT
+ userData.wallColor,
+ userData.wallEmblem
+ FROM `userData`
+ WHERE userID = '$userID' ";
+ $result = mysql_query($sql);
+ if ($result)
+ list($wallColor, $wallEmblem) = mysql_fetch_row($result);
+}
?>
<body>
+<script type="text/javascript">
+playerWallColor = '<?PHP echo isset($wallColor) ? $wallColor : ''; ?>';
+playerWallEmblem = '<?PHP echo isset($wallEmblem) ? $wallEmblem : ''; ?>';
+</script>
<?php
topbar($Links);
@@ -10,6 +29,36 @@ include('./includes/maps.php');
include('./includes/mapoftheday.php');
+$openmaps[] = 'Souooooooooooooooooooooo';
+$openmaps[] = 'oooooooooooooooooooooooo';
+$openmaps[] = 'ooooooooooooooooeocooooo';
+$openmaps[] = 'oooooooooooooooooooooooo';
+$openmaps[] = 'ooooooooooaoootooooooooo';
+$openmaps[] = 'oooooooooooooooooooooooo';
+$openmaps[] = 'oooooooooooooooooooooooo';
+$openmaps[] = 'oooooooooooooooooooooooo';
+$openmaps[] = 'oooooobdoooooooooooooooo';
+$openmaps[] = 'foooooooooooooooooooooos';
+
+$myparams['checkpoints'] = 5;
+$myparams['teleports'] = 0;
+$myparams['rockchance'] = 15;
+$myparams['walls'] = 38;
+$myparams['name'] = 'Dualing Starts';
+
+$map = GenerateShapedMap($openmaps, $myparams);
+
+echo DisplayMap($map, 1);
+
+?>
+<script src="sounds/script/soundmanager.js"></script>
+<script type="text/javascript">soundManagerInit();</script>
+<?
+
+exit;
+
+
+
$basic3[] = "orooooooooof";
$basic3[] = "orooooooooof";
$basic3[] = "oroooaooooof";
@@ -79,31 +128,7 @@ $dualsmape[] = 'rooooooooooooor';
$dualsmape[] = 'sooooooooooooof';
$dualsmape[] = 'rfrfrforofrfrfr';
-$openmaps[] = 'Souooooooooooooooooooooo';
-$openmaps[] = 'oooooooooooooooooooooooo';
-$openmaps[] = 'oooooooooooooooooooooooo';
-$openmaps[] = 'oooooooooooooooooooooooo';
-$openmaps[] = 'ooooooooooaoootooooooooo';
-$openmaps[] = 'oooooooooooooooooooooooo';
-$openmaps[] = 'oooooooooooooooooooooooo';
-$openmaps[] = 'oooooooooooooooooooooooo';
-$openmaps[] = 'oooooooooooooooooooooooo';
-$openmaps[] = 'foooooooooooooooooooooos';
-
-//$dualsmape = insertPoint($dualsmape, 'abcptu');
-$myparams['checkpoints'] = 5;
-$myparams['teleports'] = 0;
-$myparams['rockchance'] = 15;
-$myparams['walls'] = 38;
-$myparams['name'] = 'Dualing Starts';
-
-$map = GenerateShapedMap($openmaps, $myparams);
-
-echo DisplayMap($map, 1);
-
-
-exit;
echo "Prep..";