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. --- includes/maps.php | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'includes/maps.php') 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... /* -- cgit v1.2.3