summaryrefslogtreecommitdiffstats
path: root/includes/maps.php
diff options
context:
space:
mode:
authorPatrick Davison <snapwilliam@gmail.com>2013-01-08 22:47:13 -0800
committerPatrick Davison <snapwilliam@gmail.com>2013-01-08 22:47:13 -0800
commit16567167343024754247818e92115ed83255ed0d (patch)
treedcd71d452cdee6996cf7547c3e1665390d9d76de /includes/maps.php
parente04ac8f4c4db236005ac045a9dbb36b163f227ee (diff)
downloadpathery-16567167343024754247818e92115ed83255ed0d.tar.xz
Map class and Challenges
The mapclass should eventually replace the current mapmatrix array w/ headers. Work on challenges progresses nicely
Diffstat (limited to 'includes/maps.php')
-rw-r--r--includes/maps.php55
1 files changed, 55 insertions, 0 deletions
diff --git a/includes/maps.php b/includes/maps.php
index 1df258d..6a831c8 100644
--- a/includes/maps.php
+++ b/includes/maps.php
@@ -285,6 +285,61 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL)
return $output;
}
+
+//This requires the map as an object.
+function DisplayMapThumbnail($map, $link = false) {
+ $r = ''; //Prepare our return value:
+
+ if ($link)
+ $r .= "<table style='cursor:pointer' onclick='document.location.href=\"$link\"' class='map_thumbnail'>";
+ else
+ $r .= "<table class='map_thumbnail'>";
+
+ for ($y = 0; $y < $map->height; $y++) { //Number of Rows
+ $r .= "<tr>";
+ for ($x = 0; $x < $map->width; $x++) { //Number of Columns
+ $value = $map->tiles[$y][$x][TileValue];
+ $type = $map->tiles[$y][$x][TileType];
+ switch($type) {
+ case TileEmpty:
+ $r .= "<td class='o'></td>";
+ //$r .= "<td class='grid_td'></td>";
+ break;
+ case TileCheckpoint:
+ $r .= "<td class='$type$value'></td>";
+ //$r .= "<td class='c'></td>";
+ break;
+ case TileRock:
+ $r .= "<td class='grid_td_rocks'></td>";
+ //$r .= "<td style='background-color:#c33; width:4px; height:4px;'></td>";
+ break;
+ case TileStart:
+ $r .= "<td class='grid_td_start'></td>";
+ //$r .= "<td style='background-color:#2c2; width:4px; height:4px;'></td>";
+ break;
+ case TileFinish:
+ $r .= "<td class='grid_td_finish'></td>";
+ //$r .= "<td style='background-color:#666; width:4px; height:4px;'></td>";
+ break;
+ case TileTeleportIn:
+ $r .= "<td class='$type$value'></td>";
+ //$r .= "<td style='background-color:#666; width:4px; height:4px;'></td>";
+ break;
+ case TileTeleportOut:
+ $r .= "<td class='$type$value'></td>";
+ //$r .= "<td style='background-color:#666; width:4px; height:4px;'></td>";
+ break;
+ }
+ }
+ $r .= "</tr>";
+ }
+ $r .= "</table>";
+
+ return $r;
+}
+
+
+
//Generates map
function GenerateMap($rows, $cols, $rockchance, $numBlocks = -1, $cp = -1, $tp = -1, $mapName = '') {