From 6d7ea09fc40b66904a8ac06b50a22a1861e26ff9 Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Tue, 17 Apr 2012 16:16:45 -0700 Subject: Changed to a map-pool. --- images/OverlayStart50b.png | Bin 879 -> 2767 bytes includes/mapoftheday.php | 2 +- includes/maps.php | 24 +++++++++---- pages/home.php | 83 +++++++++++++++++++++++++++------------------ 4 files changed, 68 insertions(+), 41 deletions(-) diff --git a/images/OverlayStart50b.png b/images/OverlayStart50b.png index 4168da4..a42210a 100644 Binary files a/images/OverlayStart50b.png and b/images/OverlayStart50b.png differ diff --git a/includes/mapoftheday.php b/includes/mapoftheday.php index ee6a29e..6e0d14d 100644 --- a/includes/mapoftheday.php +++ b/includes/mapoftheday.php @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/includes/maps.php b/includes/maps.php index 37eae5f..4978411 100644 --- a/includes/maps.php +++ b/includes/maps.php @@ -93,6 +93,7 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL) $mapdata['rocks'] = $mapMatrix[0][3]; $mapdata['walls'] = $mapMatrix[0][4]; $mapdata['teleports'] = $mapMatrix[0][5]; + $mapdata['name'] = $mapMatrix[0][6]; $mapdata['example'] = $example; $mapdata['mapid'] = $idprefix; @@ -282,7 +283,7 @@ function DisplayMap($mapMatrix, $idprefix = 1, $style = 'normal', $speed = NULL) } //Generates map -function GenerateMap($rows, $cols, $rockchance, $numBlocks = -1, $cp = -1, $tp = -1) { +function GenerateMap($rows, $cols, $rockchance, $numBlocks = -1, $cp = -1, $tp = -1, $mapName = '') { if ($numBlocks == -1) $numBlocks = Rand(7, (int)($rows * $cols) * .12); @@ -373,7 +374,8 @@ function GenerateMap($rows, $cols, $rockchance, $numBlocks = -1, $cp = -1, $tp = $grid[0][3] = $rocks; $grid[0][4] = $numBlocks; $grid[0][5] = count($teleport); - + $grid[0][6] = $mapName; + //Validate map $path = routePath($grid, '', true); //Only repeat if it's blocked. @@ -413,6 +415,11 @@ function GenerateShapedMap($shape, $params) { else $teleports = 0; + if ($params['name']) + $mapName = $params['name']; + else + $mapName = ''; + if (is_int($params['walls'])) $walls = $params['walls']; else @@ -426,6 +433,7 @@ function GenerateShapedMap($shape, $params) { //walls $mapMatrix[0][4] = $walls; $mapMatrix[0][5] = $teleports; + $mapMatrix[0][6] = $mapName; do { @@ -569,11 +577,12 @@ function GenerateMapCode($mapMatrix) { // $mapMatrix[1] count will always be the width. $mapsize = $mapMatrix[0][0].'x'.$mapMatrix[0][1]; //Width x Height - $code = $mapsize. - '.c'.$mapMatrix[0][2]. - '.r'.$mapMatrix[0][3]. - '.w'.$mapMatrix[0][4]. - '.t'.$mapMatrix[0][5]; + $code = $mapsize; + $code .= '.c'.$mapMatrix[0][2]; + $code .= '.r'.$mapMatrix[0][3]; + $code .= '.w'.$mapMatrix[0][4]; + $code .= '.t'.$mapMatrix[0][5]; + $code .= '.'.$mapMatrix[0][6]; // dimensions + # checkpoints + # rocks + # placeable walls //echo $code."
"; @@ -624,6 +633,7 @@ function GenerateMapByCode($code) { $mapMatrix[0][3] = (int)substr($headers[2], 1); //Number of Rocks $mapMatrix[0][4] = (int)substr($headers[3], 1); //Number of Wall Blocks $mapMatrix[0][5] = (int)substr($headers[4], 1); //Number of Teleports + $mapMatrix[0][6] = $headers[5]; //Map Name //Printing out parameters for debug purposes... /* diff --git a/pages/home.php b/pages/home.php index ff47634..fb1d434 100644 --- a/pages/home.php +++ b/pages/home.php @@ -110,13 +110,32 @@ topbar($Links); echo "

"; } } - ?> +} + +$motd = MapOfTheDay(1); +$mapContent .= displayMaze($motd, 1); + +$motd = MapOfTheDay(2); +$mapContent .= displayMaze($motd, 2); + +$motd = MapOfTheDay(3); +$mapContent .= displayMaze($motd, 3); + +$motd = MapOfTheDay(4); +$mapContent .= displayMaze($motd, 4); + +$special = $motd['map'][0][6]; +if ($special == '') { + $special = 'Special'; +} + +?>
Simple Normal Complex - +
@@ -124,15 +143,17 @@ topbar($Links);
This game is best viewed in Google Chrome + \n$topscores\n"; @@ -148,46 +169,42 @@ function displayMaze($mapType, $name) { $mysolution = $_SESSION[$mapID.'sol']; $mymoves = $_SESSION[$mapID.'moves']; } - - - echo "
"; - echo "
"; + + $r .= "
"; + $r .= "
"; // if ($width <= 16) { - // echo '
'; - // echo $topscorediv; - // echo '
'; + // $r .= '
'; + // $r .= $topscorediv; + // $r .= '
'; - // echo '
'; - // echo "Load your best solution
"; - // echo DisplayMap($map, $mapID); - // echo '
'; - echo "
"; - echo "
"; - echo " Load your best solution
"; - echo DisplayMap($map, $mapID); - echo "
"; - - echo "
"; - echo $topscorediv; - echo '
'; - - echo '
'; - echo '
'; + // $r .= '
'; + // $r .= "Load your best solution
"; + // $r .= DisplayMap($map, $mapID); + // $r .= '
'; + $r .= "
"; + $r .= "
"; + $r .= " Load your best solution
"; + $r .= DisplayMap($map, $mapID); + $r .= "
"; + + $r .= "
"; + $r .= $topscorediv; + $r .= '
'; + + $r .= '
'; + $r .= '
'; $mapSolDiv = ""; - echo $mapSolDiv; + $r .= $mapSolDiv; //Clear our floatingness - echo '
'; + $r .= '
'; + return $r; } -displayMaze(1, 'Simple'); -displayMaze(2, 'Normal'); -displayMaze(3, 'Complex'); -displayMaze(4, 'Special'); $timerem = strtotime("tomorrow") - strtotime("now"); ?> -- cgit v1.2.3