diff --git a/chunk_x-2z4.png b/chunk_x-2z4.png
deleted file mode 100644
index 1004c7e..0000000
Binary files a/chunk_x-2z4.png and /dev/null differ
diff --git a/chunkymap-regen.py b/chunkymap-regen.py
index 7da805d..27d9271 100644
--- a/chunkymap-regen.py
+++ b/chunkymap-regen.py
@@ -590,9 +590,9 @@ class MTChunks:
# 0 becomes 0
#-1 becomes -10
return int(decachunky_x*10)
-
-
-
+
+
+
def is_worldborder_chunk(self, chunky_x, chunky_z):
result = False
image_path = self.get_chunk_image_path(chunky_x, chunky_z)
@@ -634,7 +634,7 @@ class MTChunks:
result = index
break
return result
-
+
def check_decachunk_containing_chunk(self, chunky_x, chunky_z):
try:
@@ -704,9 +704,9 @@ class MTChunks:
print(min_indent+"ERROR in check_decachunk_containing_chunk: no outline of chunks could be found around "+str(chunky_pos))
if not is_chunk_complete:
break
-
-
-
+
+
+
#if not is_any_part_queued:
#if queued_chunk_coords is None:
if is_chunk_complete and not is_any_part_queued:
@@ -1421,7 +1421,7 @@ class MTChunks:
if self.verbose_enable:
print(min_indent+"["+str(self.todo_index)+"] not branching from "+str((chunky_x, chunky_z)))
self.todo_index += 1
-
+
#check_decachunk_containing_chunk AFTER incrementing todo_index so that self being queued doesn't prevent decachunk render:
self.check_decachunk_containing_chunk(chunky_x, chunky_z)
if self.todo_index>=len(self.todo_positions): # check again since may have branched above, making this untrue
@@ -1572,7 +1572,7 @@ class MTChunks:
result = True
break
return result
-
+
def is_nonworldborder_isrendered_count_gt_or_eq(chunky_coords_list, min_count):
result = False
diff --git a/chunkymap-update C wamp www.bat b/chunkymap-update C wamp www.bat
new file mode 100644
index 0000000..f65b0e7
--- /dev/null
+++ b/chunkymap-update C wamp www.bat
@@ -0,0 +1,8 @@
+SET SOURCE_DIR=C:\Users\Owner\Documents\GitHub\minetest-chunkymap\web
+SET DEST_DIR=C:\wamp\www
+COPY /Y "%SOURCE_DIR%\browser.php" "%DEST_DIR%\"
+if NOT ["%errorlevel%"]==["0"] pause
+COPY /Y "%SOURCE_DIR%\chunkymap.php" "%DEST_DIR%\"
+if NOT ["%errorlevel%"]==["0"] pause
+COPY /Y "%SOURCE_DIR%\viewchunkymap.php" "%DEST_DIR%\"
+if NOT ["%errorlevel%"]==["0"] pause
\ No newline at end of file
diff --git a/etc/compass-rose.xcf b/etc/compass-rose.xcf
index c97c9dd..5f76054 100644
Binary files a/etc/compass-rose.xcf and b/etc/compass-rose.xcf differ
diff --git a/web/chunkymap.php b/web/chunkymap.php
index 819369b..c5e6b38 100644
--- a/web/chunkymap.php
+++ b/web/chunkymap.php
@@ -28,15 +28,15 @@ date_default_timezone_set('EST'); //required by PHP >=5.1.0
if ($is_verbose) echo "globals...";
//$chunkymap_view_x=0;
//$chunkymap_view_z=0;
-//$chunkymap_view_zoom_multiplier=25;
+//$chunkymap_view_zoom=25;
if (!isset($chunkymap_view_x)) {
$chunkymap_view_x=0;
}
if (!isset($chunkymap_view_z)) {
$chunkymap_view_z=0;
}
-if (!isset($chunkymap_view_zoom_multiplier)) {
- $chunkymap_view_zoom_multiplier=.25;
+if (!isset($chunkymap_view_zoom)) {
+ $chunkymap_view_zoom=.25;
}
$chunkymapdata_path = "chunkymapdata";
@@ -44,15 +44,15 @@ $chunkymapdata_worlds_path = $chunkymapdata_path."/worlds";
$chunkymapdata_thisworld_path = null;
$showplayers=true;
-// NOT OPTIONAL:
+// NOT OPTIONAL for table version:
$chunkymap_tile_original_w=16;
$chunkymap_tile_original_h=16;
$chunk_dimension_min=$chunkymap_tile_original_w;
if ($chunkymap_tile_original_h<$chunk_dimension_min) $chunk_dimension_min=$chunkymap_tile_original_h;
-
-$chunkymap_view_min_zoom=1.0/$chunk_dimension_min; //should be a number that would get to exactly 100 eventually if multiplied by 2 repeatedly (such as 0.09765625); 0.005 was avoided since tiles used to be 80x80 pixels
-$chunkymap_view_max_zoom=13107200.0;
+$chunkymap_zoom_delta=1.5;
+$chunkymap_view_min_zoom=0.0173415299; //1.0/$chunk_dimension_min; //should be a number that would get to exactly 100 eventually if multiplied by chunkymap_zoom_delta repeatedly (such as 0.09765625 if chunkymap_zoom_delta were 2); 0.005 was avoided since tiles used to be 80x80 pixels
+$chunkymap_view_max_zoom=16585998.48141; //13107200.0;
function echo_error($val) {
if (!isset($val)) {
@@ -118,13 +118,13 @@ function is_int_string($val) {
}
return $result;
}
-function set_chunkymap_view($set_chunkymap_view_x, $set_chunkymap_view_z, $set_chunkymap_view_zoom_multiplier) {
+function set_chunkymap_view($set_chunkymap_view_x, $set_chunkymap_view_z, $set_chunkymap_view_zoom) {
global $chunkymap_view_x;
global $chunkymap_view_z;
- global $chunkymap_view_zoom_multiplier;
+ global $chunkymap_view_zoom;
$chunkymap_view_x = $set_chunkymap_view_x;
$chunkymap_view_z = $set_chunkymap_view_z;
- $chunkymap_view_zoom_multiplier = $set_chunkymap_view_zoom_multiplier;
+ $chunkymap_view_zoom = $set_chunkymap_view_zoom;
}
function echo_chunkymap_anchor() {
global $chunkymap_anchor_name;
@@ -133,7 +133,7 @@ function echo_chunkymap_anchor() {
function echo_chunkymap_controls() {
global $chunkymap_view_x;
global $chunkymap_view_z;
- global $chunkymap_view_zoom_multiplier;
+ global $chunkymap_view_zoom;
global $chunkymap_view_max_zoom;
global $chunkymap_view_min_zoom;
global $chunkymap_anchor_name;
@@ -142,18 +142,18 @@ function echo_chunkymap_controls() {
$in_img_name = "zoom-in.png";
$out_img_name = "zoom-out.png";
- $in_zoom = $chunkymap_view_zoom_multiplier;
+ $in_zoom = $chunkymap_view_zoom;
if ($in_zoom<$chunkymap_view_max_zoom) {
$is_in=true;
- $in_zoom = $chunkymap_view_zoom_multiplier*2.0;
+ $in_zoom = $chunkymap_view_zoom*2.0;
//echo "in:$in_zoom ";
}
else $in_img_name = "zoom-in_disabled.png";
- $out_zoom = $chunkymap_view_zoom_multiplier;
+ $out_zoom = $chunkymap_view_zoom;
if ($out_zoom>$chunkymap_view_min_zoom) {
$is_out=true;
- $out_zoom = ($chunkymap_view_zoom_multiplier/2.0);
+ $out_zoom = ($chunkymap_view_zoom/2.0);
}
else $out_img_name = "zoom-out_disabled.png";
@@ -208,19 +208,15 @@ function echo_chunkymap_controls() {
}
if (!$found) $in_zoom=$chunkymap_view_max_zoom;
- $in_html="";
- $out_html="";
+ $in_html="";
+ $out_html="";
global $world_name;
- $append_vars="&";
+ $append_vars="";
if (isset($world_name)) {
- $prefix = "";
- if (strlen($append_vars)>0 && !endsWith($append_vars,"&") ) {
- $prefix = "&";
- }
- $append_vars.="$prefix"."world_name=$world_name";
+ $append_vars.="&"."world_name=$world_name";
}
- if ($is_in) $in_html="$in_html";
- if ($is_out) $out_html="$out_html";
+ if ($is_in) $in_html="$in_html";
+ if ($is_out) $out_html="$out_html";
echo $in_html;
echo $out_html;
}
@@ -287,9 +283,9 @@ function get_decachunk_folder_path_from_decachunk($chunky_x, $chunky_z) {
return $result;
}
-function get_chunky_coord_from_location($location_x) {
- $chunk_x = intval($location_x/16);
- return $chunk_x;
+function get_chunky_coord_from_location($location_coord) {
+ $chunk_coord = intval(floor((float)$location_coord/16));
+ return $chunk_coord;
}
function get_decachunky_coord_from_chunky_coord($chunky_x) {
@@ -310,10 +306,323 @@ function get_decachunk_image_name_from_decachunk($x, $z) {
return "decachunk_x"."$x"."z"."$z".".jpg";
}
-function echo_chunkymap_canvas() {
+function echo_chunk_debug_canvas() {
+ global $chunkymap_view_x;
+ global $chunkymap_view_z;
+ global $chunkymap_view_zoom;
+ global $chunkymap_view_max_zoom;
+ global $chunkymap_view_min_zoom;
+ global $showplayers;
+ global $chunkymap_zoom_delta;
+ $tile_w = 160;
+ $tile_h = 160;
+
+ if ($chunkymap_view_zoom<$chunkymap_view_min_zoom) $chunkymap_view_zoom = $chunkymap_view_min_zoom;
+ if ($chunkymap_view_zoom>$chunkymap_view_max_zoom) $chunkymap_view_zoom = $chunkymap_view_max_zoom;
+
+ $world_camera_w = 6.0 * (1.0/$chunkymap_view_zoom);
+ $world_camera_h = $world_camera_w; //start with square camera to make sure enough chunks are loaded
+
+ $chunky_view_x = get_chunky_coord_from_location($chunkymap_view_x);
+ $chunky_view_z = get_chunky_coord_from_location($chunkymap_view_z);
+
+ $chunky_min_x = 0;
+ $chunky_max_x = 0;
+ $chunky_min_z = 0;
+ $chunky_max_z = 0;
+
+
+
+ echo ' ';
+ echo '
+ ';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ echo '';
+ //TODO: $chunkymap_view_zoom SHOULD BE interpreted so each block (pixel) is 1pt: 1066x600 pt canvas would have 66+2/3 blocks horizontally, is 37.5 blocks vertically
+ //so, at zoom 1.0 canvas should show 60 chunks across (6 decachunks across)
+}
+
+function echo_decachunk_table() {
global $chunkymap_view_x;
global $chunkymap_view_z;
- global $chunkymap_view_zoom_multiplier;
+ global $chunkymap_view_zoom;
global $chunkymap_view_max_zoom;
global $chunkymap_view_min_zoom;
global $showplayers;
@@ -327,25 +636,29 @@ function echo_chunkymap_canvas() {
$z_opener="z";
$dot_and_ext = ".jpg";
- if ($chunkymap_view_zoom_multiplier<$chunkymap_view_min_zoom) $chunkymap_view_zoom_multiplier = $chunkymap_view_min_zoom;
- if ($chunkymap_view_zoom_multiplier>$chunkymap_view_max_zoom) $chunkymap_view_zoom_multiplier = $chunkymap_view_max_zoom;
+ if ($chunkymap_view_zoom<$chunkymap_view_min_zoom) $chunkymap_view_zoom = $chunkymap_view_min_zoom;
+ if ($chunkymap_view_zoom>$chunkymap_view_max_zoom) $chunkymap_view_zoom = $chunkymap_view_max_zoom;
- $decachunks_per_page = intval(1.0/$chunkymap_view_zoom_multiplier);
+ $decachunks_per_page = intval(6.0/$chunkymap_view_zoom);
if ($decachunks_per_page<1) {
$decachunks_per_page = 1;
}
- $view_w = (($decachunks_per_page*160.0));
- $view_h = (($decachunks_per_page*160.0));
- $view_left = (($chunkymap_view_x)) - (($view_w/2.0));
- $view_right = $view_left + $view_w;
+ $viewer_ratio = 16.0/9.0;
+ $world_camera_w = 6.0 * (1.0/$chunkymap_view_zoom);
+ $world_camera_h = $world_camera_w;
+ //$world_camera_w = (($decachunks_per_page*160.0));
+ //$world_camera_h = (($decachunks_per_page*160.0));
+
+ $view_left = (($chunkymap_view_x)) - (($world_camera_w/2.0));
+ $view_right = $view_left + $world_camera_w;
//z is cartesian still:
- $view_top = (($chunkymap_view_z)) + (($view_h/2.0));
- $view_bottom = $view_top - $view_h;
+ $view_top = (($chunkymap_view_z)) + (($world_camera_h/2.0));
+ $view_bottom = $view_top - $world_camera_h;
echo_chunkymap_anchor();
echo_chunkymap_controls();
echo "\r\n";
- echo " ".($chunkymap_view_zoom_multiplier*100.0)."%\r\n";//(string)((int)($chunkymap_view_zoom_multiplier*100+.5));
+ echo " ".($chunkymap_view_zoom*100.0)."%\r\n";//(string)((int)($chunkymap_view_zoom*100+.5));
//"chunkymapdata/images/compass-rose.png"
//"chunkymapdata/images/start.png"
$decachunky_min_x = get_decachunky_coord_from_location($view_left);
@@ -367,12 +680,12 @@ function echo_chunkymap_canvas() {
echo '
'."\r\n";
echo ' '."\r\n";
echo ' '."$td_placeholder_content".' | '."\r\n";
- echo " ".''.' | '."\r\n";
+ echo " ".''.' | '."\r\n";
echo ' '."$td_placeholder_content".' | '."\r\n";
echo '
'."\r\n";
$cell_perc=intval(round(100.0/$decachunky_count_x));
echo ' '."\r\n";
- echo " ".''.' | '."\r\n";
+ echo " ".''.' | '."\r\n";
echo ' '."\r\n";
echo ' '."\r\n";
while ($decachunky_z>=$decachunky_min_z) {
@@ -403,11 +716,11 @@ function echo_chunkymap_canvas() {
}
echo ' '."\r\n";
echo ' | '."\r\n";
- echo " ".''.' | '."\r\n";
+ echo " ".''.' | '."\r\n";
echo '
'."\r\n";
echo ' '."\r\n";
echo ' '."$td_placeholder_content".' | '."\r\n";
- echo " ".''.' | '."\r\n";
+ echo " ".''.' | '."\r\n";
echo ' '."$td_placeholder_content".' | '."\r\n";
echo '
'."\r\n";
echo '
'."\r\n";
@@ -447,7 +760,7 @@ function echo_chunkymap_as_chunk_table($show_all_enable) {
$is_echo_never_held=true;
global $chunkymap_view_x;
global $chunkymap_view_z;
- global $chunkymap_view_zoom_multiplier;
+ global $chunkymap_view_zoom;
global $chunkymap_view_max_zoom;
global $chunkymap_view_min_zoom;
global $chunkymapdata_path;
@@ -461,11 +774,11 @@ function echo_chunkymap_as_chunk_table($show_all_enable) {
echo_chunkymap_anchor();
echo_chunkymap_controls();
- echo " ".($chunkymap_view_zoom_multiplier*100.0)."%";//(string)((int)($chunkymap_view_zoom_multiplier*100+.5));
+ echo " ".($chunkymap_view_zoom*100.0)."%";//(string)((int)($chunkymap_view_zoom*100+.5));
- if ($chunkymap_view_zoom_multiplier<$chunkymap_view_min_zoom) $chunkymap_view_zoom_multiplier = $chunkymap_view_min_zoom;
- if ($chunkymap_view_zoom_multiplier>$chunkymap_view_max_zoom) $chunkymap_view_zoom_multiplier = $chunkymap_view_max_zoom;
- //$zoom_divisor = (int)(100/$chunkymap_view_zoom_multiplier);
+ if ($chunkymap_view_zoom<$chunkymap_view_min_zoom) $chunkymap_view_zoom = $chunkymap_view_min_zoom;
+ if ($chunkymap_view_zoom>$chunkymap_view_max_zoom) $chunkymap_view_zoom = $chunkymap_view_max_zoom;
+ //$zoom_divisor = (int)(100/$chunkymap_view_zoom);
$chunk_assoc = array(); // used for storing players; and used for determining which chunks are on the edge, since not all generated map tiles are the same size (edge tile images are smaller and corner ones are smaller yet)
$chunk_count = 0;
$x_opener="chunk_x";
@@ -475,15 +788,15 @@ function echo_chunkymap_as_chunk_table($show_all_enable) {
$min_chunkz = 0;
$max_chunkx = 0;
$max_chunkz = 0;
- $chunks_per_page = (1.0/$chunkymap_view_zoom_multiplier)*10;
+ $chunks_per_page = (1.0/$chunkymap_view_zoom)*10;
- $view_w = (($chunks_per_page*16.0));
- $view_h = (($chunks_per_page*16.0));
- $view_left = (($chunkymap_view_x)) - (($view_w/2.0));
- $view_right = $view_left + $view_w;
+ $world_camera_w = (($chunks_per_page*16.0));
+ $world_camera_h = (($chunks_per_page*16.0));
+ $view_left = (($chunkymap_view_x)) - (($world_camera_w/2.0));
+ $view_right = $view_left + $world_camera_w;
//z is cartesian still:
- $view_top = (($chunkymap_view_z)) + (($view_h/2.0));
- $view_bottom = $view_top - $view_h;
+ $view_top = (($chunkymap_view_z)) + (($world_camera_h/2.0));
+ $view_bottom = $view_top - $world_camera_h;
if (!$show_all_enable) {
$min_chunkx=intval($view_left/$chunkymap_tile_original_w);
@@ -715,7 +1028,7 @@ function echo_chunkymap_as_chunk_table($show_all_enable) {
//cellpadding="0" cellspacing="0" still needed for IE
echo_hold( " \r\n");
$z = (int)$max_chunkz;
- $scale=(float)$chunkymap_view_zoom_multiplier; // no longer /100
+ $scale=(float)$chunkymap_view_zoom; // no longer /100
$zoomed_w=(int)((float)$chunkymap_tile_original_w*$scale+.5);
$zoomed_h=(int)((float)$chunkymap_tile_original_h*$scale+.5);
$genresult_suffix_then_dot_then_ext="_mapper_result.txt";
@@ -952,12 +1265,12 @@ function echo_chunkymap_as_chunk_table($show_all_enable) {
echo "";
if ($chunkymapdata_handle = opendir($chunkymapdata_worlds_path)) {
$append_vars="&";
- if (isset($chunkymap_view_zoom_multiplier)) {
+ if (isset($chunkymap_view_zoom)) {
$prefix = "";
if (strlen($append_vars)>0 and !endsWith($append_vars,"&")) {
$prefix = "&";
}
- $append_vars.="$prefix"."&chunkymap_view_zoom_multiplier=$chunkymap_view_zoom_multiplier";
+ $append_vars.="$prefix"."&chunkymap_view_zoom=$chunkymap_view_zoom";
}
if (isset($chunkymap_anchor_name)) {
$prefix = "";
@@ -979,3 +1292,4 @@ function echo_chunkymap_as_chunk_table($show_all_enable) {
}
}
?>
+
diff --git a/web/chunkymapdata_default/images/compass-rose.png b/web/chunkymapdata_default/images/compass-rose.png
index a51b7a4..db19e4c 100644
Binary files a/web/chunkymapdata_default/images/compass-rose.png and b/web/chunkymapdata_default/images/compass-rose.png differ
diff --git a/web/viewchunkymap.php b/web/viewchunkymap.php
index 93189bc..bbbc24f 100644
--- a/web/viewchunkymap.php
+++ b/web/viewchunkymap.php
@@ -1,9 +1,9 @@
-
+
-
-
+
+
";
- echo "";
- echo_map_heading_text();
- echo "
";
- echo "";
- set_chunkymap_view($chunkymap_view_x,$chunkymap_view_z,$chunkymap_view_zoom_multiplier);
- echo "";
- echo_chunkymap_as_chunk_table(false);
- echo_chunkymap_canvas();
- echo " |
";
+ //echo "";
+ //echo "";
+ //echo_map_heading_text();
+ //echo "
";
+ //echo "";
+ set_chunkymap_view($chunkymap_view_x,$chunkymap_view_z,$chunkymap_view_zoom);
+ //echo "";
+ echo_chunk_debug_canvas();
+ //echo_chunkymap_as_chunk_table(false);
+ //echo_decachunk_table();
+ //echo " |
";
//echo "returned from echo_chunkymap_as_chunk_table.";
}
else {