From 16567167343024754247818e92115ed83255ed0d Mon Sep 17 00:00:00 2001 From: Patrick Davison Date: Tue, 8 Jan 2013 22:47:13 -0800 Subject: Map class and Challenges The mapclass should eventually replace the current mapmatrix array w/ headers. Work on challenges progresses nicely --- css/maps.css | 89 +++++++++++++++++++++++++++++++++++++++++++++++++ includes/maps.php | 55 ++++++++++++++++++++++++++++++ index.php | 6 ++-- pages/challengelist.php | 29 +++++++++++++--- pages/gallery.php | 26 +++++++++++++++ 5 files changed, 197 insertions(+), 8 deletions(-) diff --git a/css/maps.css b/css/maps.css index 48d3ab5..9975fc1 100644 --- a/css/maps.css +++ b/css/maps.css @@ -6,6 +6,95 @@ color:#FF2222; } +.map_thumbnail { + border: 1px solid #ff5; + border-spacing: 1px; + background-size: 100%; +} +.map_thumbnail td { + width:4px; + height:4px; + border: 0px solid #000; + padding: 4px; + margin: 0px; + background-size: 100%; +} +.map_thumbnail .o { + background-color:#ccc; + +} +/* CHECKPOINTS */ +.map_thumbnail .c { + background-image: url(../images/OverlayA50.png); + background-color: #F777FF; +} +.map_thumbnail .c2 { + background-image: url(../images/OverlayB50.png); + background-color: #FFFF11; +} +.map_thumbnail .c3 { + background-image: url(../images/OverlayC50.png); + background-color: #FF4466; +} +.map_thumbnail .c4 { + background-image: url(../images/OverlayD50.png); + background-color: #ff9911; +} +.map_thumbnail .c5 { + background-image: url(../images/OverlayE50.png); + background-color: #00FFFF; +} + +.map_thumbnail .t { + background-image: url(../images/TeleportInW.png); + background-color: #3377AA; +} +.map_thumbnail .t2 { + background-image: url(../images/TeleportIn.png); + background-color: #44EE66; +} +.map_thumbnail .t3 { + background-image: url(../images/TeleportInW.png); + background-color: #992200; +} +.map_thumbnail .t4 { + background-image: url(../images/TeleportIn.png); + background-color: #55CCFF; +} +.map_thumbnail .t5 { + background-image: url(../images/TeleportInW.png); + background-color: #005533; +} +.map_thumbnail .u { + background-image: url(../images/TeleportOutW.png); + background-color: #3377AA; +} +.map_thumbnail .u2 { + background-image: url(../images/TeleportOut.png); + background-color: #44EE66; +} +.map_thumbnail .u3 { + background-image: url(../images/TeleportOutW.png); + background-color: #992200; +} +.map_thumbnail .u4 { + background-image: url(../images/TeleportOut.png); + background-color: #55CCFF; +} +.map_thumbnail .u5 { + background-image: url(../images/TeleportOutW.png); + background-color: #005533; +} + + + + +/* grid stuff */ + + + + + .grid_dsp_data { padding:1px; font-weight:bold; 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 .= ""; + else + $r .= "
"; + + for ($y = 0; $y < $map->height; $y++) { //Number of Rows + $r .= ""; + 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 .= ""; + //$r .= ""; + break; + case TileCheckpoint: + $r .= ""; + //$r .= ""; + break; + case TileRock: + $r .= ""; + //$r .= ""; + break; + case TileStart: + $r .= ""; + //$r .= ""; + break; + case TileFinish: + $r .= ""; + //$r .= ""; + break; + case TileTeleportIn: + $r .= ""; + //$r .= ""; + break; + case TileTeleportOut: + $r .= ""; + //$r .= ""; + break; + } + } + $r .= ""; + } + $r .= "
"; + + return $r; +} + + + //Generates map function GenerateMap($rows, $cols, $rockchance, $numBlocks = -1, $cp = -1, $tp = -1, $mapName = '') { diff --git a/index.php b/index.php index 9175b30..9006d82 100644 --- a/index.php +++ b/index.php @@ -50,9 +50,9 @@ $footerLinks['#top'] = "Back to Top"; // if ($accepted) { // $footerLinks['cp'] = "Settings"; // } -if (isset($_SESSION['isAdmin']) && $_SESSION['isAdmin'] == true) { - $footerLinks['admin'] = 'Admin'; -} +// if (isset($_SESSION['isAdmin']) && $_SESSION['isAdmin'] == true) { + // $footerLinks['admin'] = 'Admin'; +// } // diff --git a/pages/challengelist.php b/pages/challengelist.php index 03dfdb3..eb9993d 100644 --- a/pages/challengelist.php +++ b/pages/challengelist.php @@ -8,17 +8,20 @@ include_once ('./includes/maps.php'); include_once ('./includes/mapoftheday.php'); include_once ('./includes/db.inc.php'); include_once ('./includes/datas.php'); +include_once ('./includes/mapclass.php'); topbar($Links); ?> +
Please login to do the challenges!
"; + echo "
Please login to do the challenges!
"; + echo "

"; htmlFooter(); return; } @@ -42,6 +45,7 @@ $challengeListResultset = loadChallengeListing($userID); displayChallengeList($challengeListResultset); ?> + '; $currentTier = -1; $currentMap = -1; + while($challenge = mysql_fetch_array($challengeListResultset)) { //Each challenge gets its own header/table + // echo "
L: $currentTier
N: "; + // echo $challenge["challengeTier"]; + // echo "
"; if($challenge["challengeTier"] != $currentTier) { if($currentTier >= 0) { - echo ''; + echo 'EndTier'; } $currentTier = $challenge["challengeTier"]; echo "
Tier $currentTier
"; - echo ""; + echo "
\n"; } //Each map gets it own row @@ -79,10 +87,20 @@ function displayChallengeList($challengeListResultset) echo ''; } $currentMap = $challenge["mapID"]; - $mapName = $challenge["name"]; + + $mapCode = getMapCode($currentMap); + $map = new map($mapCode); + $thumbnail = DisplayMapThumbnail($map); + + $mapName = $map->name; if($mapName == NULL || $mapName == "") $mapName = "(unknown)"; - echo ""; + + echo " + "; echo "
"; } @@ -94,5 +112,6 @@ function displayChallengeList($challengeListResultset) echo "
"; } echo "
"; + echo ""; } ?> \ No newline at end of file diff --git a/pages/gallery.php b/pages/gallery.php index 9df059a..f8e1b9d 100644 --- a/pages/gallery.php +++ b/pages/gallery.php @@ -54,6 +54,32 @@ $myparams['name'] = 'Round and Round'; $map = GenerateShapedMap($spin, $myparams); +include('./includes/mapclass.php'); + +$mapCode = GenerateMapCode($map); +echo $mapCode; +echo "
"; +echo "
"; + +$mapClass = new map($mapCode); +echo DisplayMapThumbnail($mapClass); + +echo "
"; +echo "
"; +echo $mapClass->width; +echo "
"; +echo $mapClass; +echo "
"; +echo "
"; +var_dump($mapClass); +echo "
"; +echo TileStart; +echo TileFinish; +echo "
"; + +exit; + + echo DisplayMap($map, 2); //addNewChallengeMap($map, 0, 0, 'Round and Round'); -- cgit v1.2.3