From d354078ad100c96e5a70ca2ba921dee85e2738a7 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 27 Oct 2023 18:18:26 +0200 Subject: [PATCH] Can disable cell colors in v6 mode --- mibpov.js | 99 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 53 insertions(+), 46 deletions(-) diff --git a/mibpov.js b/mibpov.js index 5e5a229..7812d2e 100644 --- a/mibpov.js +++ b/mibpov.js @@ -1131,6 +1131,7 @@ function drawV6() { clear(context); + if (v6_flag_snowbiomes) { let cx, cy; @@ -1149,52 +1150,58 @@ function drawV6() { // Desert <-> Jungle <-> Temperate [cx_hot2, cy_hot2] = biomeCoordsToCanvasPixelCoords(MGV6_FREQ_HOT, MGV6_FREQ_JUNGLE); - // Render biome areas - context.fillStyle = CELL_COLOR_V6_NORMAL; - // Temperate - context.beginPath(); - context.moveTo(cx_snow, 0); - context.lineTo(cx_snow, h); - context.lineTo(cx_hot, h); - context.lineTo(cx_hot, 0); - context.closePath(); - context.fill(); - // Tundra - context.fillStyle = CELL_COLOR_V6_TUNDRA; - context.beginPath(); - context.moveTo(0, 0); - context.lineTo(cx_snow2, 0); - context.lineTo(cx_snow2, cy_snow2); - context.lineTo(0, cy_snow2); - context.closePath(); - context.fill(); - // Taiga - context.fillStyle = CELL_COLOR_V6_TAIGA; - context.beginPath(); - context.moveTo(cx_snow2, cy_snow2); - context.lineTo(cx_snow2, h); - context.lineTo(0, h); - context.lineTo(0, cy_snow2); - context.closePath(); - context.fill(); - // Jungle - context.fillStyle = CELL_COLOR_V6_JUNGLE; - context.beginPath(); - context.moveTo(w, 0); - context.lineTo(cx_hot2, 0); - context.lineTo(cx_hot2, cy_hot2); - context.lineTo(w, cy_hot2); - context.closePath(); - context.fill(); - // Desert - context.fillStyle = CELL_COLOR_V6_DESERT; - context.beginPath(); - context.moveTo(cx_hot2, cy_hot2); - context.lineTo(cx_hot2, h); - context.lineTo(w, h); - context.lineTo(w, cy_snow2); - context.closePath(); - context.fill(); + if (showCellColors) { + // Render biome areas + context.fillStyle = CELL_COLOR_V6_NORMAL; + // Temperate + context.beginPath(); + context.moveTo(cx_snow, 0); + context.lineTo(cx_snow, h); + context.lineTo(cx_hot, h); + context.lineTo(cx_hot, 0); + context.closePath(); + context.fill(); + // Tundra + context.fillStyle = CELL_COLOR_V6_TUNDRA; + context.beginPath(); + context.moveTo(0, 0); + context.lineTo(cx_snow2, 0); + context.lineTo(cx_snow2, cy_snow2); + context.lineTo(0, cy_snow2); + context.closePath(); + context.fill(); + // Taiga + context.fillStyle = CELL_COLOR_V6_TAIGA; + context.beginPath(); + context.moveTo(cx_snow2, cy_snow2); + context.lineTo(cx_snow2, h); + context.lineTo(0, h); + context.lineTo(0, cy_snow2); + context.closePath(); + context.fill(); + // Jungle + context.fillStyle = CELL_COLOR_V6_JUNGLE; + context.beginPath(); + context.moveTo(w, 0); + context.lineTo(cx_hot2, 0); + context.lineTo(cx_hot2, cy_hot2); + context.lineTo(w, cy_hot2); + context.closePath(); + context.fill(); + // Desert + context.fillStyle = CELL_COLOR_V6_DESERT; + context.beginPath(); + context.moveTo(cx_hot2, cy_hot2); + context.lineTo(cx_hot2, h); + context.lineTo(w, h); + context.lineTo(w, cy_snow2); + context.closePath(); + context.fill(); + } else { + // Use a "neutral" background color for the whole area if cell colors are disabled + context.fillStyle = CELL_COLOR_NEUTRAL; + context.fillRect(-DRAW_OFFSET, -DRAW_OFFSET, w+DRAW_OFFSET, h+DRAW_OFFSET); + } // Render biome borders context.lineWidth = 2.5;