diff --git a/res/graphics/background_black.png b/res/graphics/background_black.png index 2468e31f8..4a0384256 100755 Binary files a/res/graphics/background_black.png and b/res/graphics/background_black.png differ diff --git a/res/graphics/background_white.png b/res/graphics/background_white.png index 06db969a5..2959ba85b 100755 Binary files a/res/graphics/background_white.png and b/res/graphics/background_white.png differ diff --git a/res/graphics/fonts/LatinExtA_ef.png b/res/graphics/fonts/LatinExtA_ef.png index eb9ea99f8..d95756b52 100644 Binary files a/res/graphics/fonts/LatinExtA_ef.png and b/res/graphics/fonts/LatinExtA_ef.png differ diff --git a/res/graphics/fonts/LatinExtA_majuscule.png b/res/graphics/fonts/LatinExtA_majuscule.png index 3d80bbe00..0c43d8468 100644 Binary files a/res/graphics/fonts/LatinExtA_majuscule.png and b/res/graphics/fonts/LatinExtA_majuscule.png differ diff --git a/res/graphics/fonts/ascii_majuscule.png b/res/graphics/fonts/ascii_majuscule.png index 90290e2ee..b8f6ff339 100644 Binary files a/res/graphics/fonts/ascii_majuscule.png and b/res/graphics/fonts/ascii_majuscule.png differ diff --git a/res/graphics/fonts/ascii_special_ef.png b/res/graphics/fonts/ascii_special_ef.png index 88d3c99c6..f022c6825 100644 Binary files a/res/graphics/fonts/ascii_special_ef.png and b/res/graphics/fonts/ascii_special_ef.png differ diff --git a/res/graphics/fonts/cjkpunct.png b/res/graphics/fonts/cjkpunct.png index 63d969571..4ebf62fea 100644 Binary files a/res/graphics/fonts/cjkpunct.png and b/res/graphics/fonts/cjkpunct.png differ diff --git a/res/graphics/fonts/cyrilic_ef.png b/res/graphics/fonts/cyrilic_ef.png index a55842440..1bb547166 100644 Binary files a/res/graphics/fonts/cyrilic_ef.png and b/res/graphics/fonts/cyrilic_ef.png differ diff --git a/res/graphics/fonts/cyrilic_majuscule.png b/res/graphics/fonts/cyrilic_majuscule.png index 2bf437a5c..b586dcdab 100644 Binary files a/res/graphics/fonts/cyrilic_majuscule.png and b/res/graphics/fonts/cyrilic_majuscule.png differ diff --git a/res/graphics/fonts/fullwidth_forms.png b/res/graphics/fonts/fullwidth_forms.png index 8d62b0940..ed5ddb41c 100644 Binary files a/res/graphics/fonts/fullwidth_forms.png and b/res/graphics/fonts/fullwidth_forms.png differ diff --git a/res/graphics/fonts/futhark.png b/res/graphics/fonts/futhark.png index 16009a5b4..3545ad8a8 100644 Binary files a/res/graphics/fonts/futhark.png and b/res/graphics/fonts/futhark.png differ diff --git a/res/graphics/fonts/han_johab.png b/res/graphics/fonts/han_johab.png index 8834dac54..390244021 100644 Binary files a/res/graphics/fonts/han_johab.png and b/res/graphics/fonts/han_johab.png differ diff --git a/res/graphics/fonts/kana.png b/res/graphics/fonts/kana.png index 8c80ffa6b..24cb990e1 100644 Binary files a/res/graphics/fonts/kana.png and b/res/graphics/fonts/kana.png differ diff --git a/res/graphics/fonts/number_small.png b/res/graphics/fonts/number_small.png index 04fd52fa2..7738f7f86 100755 Binary files a/res/graphics/fonts/number_small.png and b/res/graphics/fonts/number_small.png differ diff --git a/res/graphics/fonts/unipunct.png b/res/graphics/fonts/unipunct.png index e798499fe..7dc3d2727 100644 Binary files a/res/graphics/fonts/unipunct.png and b/res/graphics/fonts/unipunct.png differ diff --git a/res/graphics/fonts/wenquanyi_11pt_part1.png b/res/graphics/fonts/wenquanyi_11pt_part1.png index 8cd413556..a4c9be19c 100644 Binary files a/res/graphics/fonts/wenquanyi_11pt_part1.png and b/res/graphics/fonts/wenquanyi_11pt_part1.png differ diff --git a/res/graphics/fonts/wenquanyi_11pt_part2.png b/res/graphics/fonts/wenquanyi_11pt_part2.png index 7f4a409e5..e46f37790 100644 Binary files a/res/graphics/fonts/wenquanyi_11pt_part2.png and b/res/graphics/fonts/wenquanyi_11pt_part2.png differ diff --git a/res/graphics/gui/message_twoline_black_body.png b/res/graphics/gui/message_twoline_black_body.png index 7c05b5ae0..bf8e82985 100644 Binary files a/res/graphics/gui/message_twoline_black_body.png and b/res/graphics/gui/message_twoline_black_body.png differ diff --git a/res/graphics/gui/message_twoline_black_left.png b/res/graphics/gui/message_twoline_black_left.png index 2546135ba..8f442f606 100644 Binary files a/res/graphics/gui/message_twoline_black_left.png and b/res/graphics/gui/message_twoline_black_left.png differ diff --git a/res/graphics/gui/message_twoline_black_right.png b/res/graphics/gui/message_twoline_black_right.png index 08ddd8a2a..e925de099 100644 Binary files a/res/graphics/gui/message_twoline_black_right.png and b/res/graphics/gui/message_twoline_black_right.png differ diff --git a/res/graphics/gui/message_twoline_white_body.png b/res/graphics/gui/message_twoline_white_body.png deleted file mode 100644 index e3055c68c..000000000 Binary files a/res/graphics/gui/message_twoline_white_body.png and /dev/null differ diff --git a/res/graphics/gui/message_twoline_white_left.png b/res/graphics/gui/message_twoline_white_left.png deleted file mode 100644 index ef6f35cad..000000000 Binary files a/res/graphics/gui/message_twoline_white_left.png and /dev/null differ diff --git a/res/graphics/gui/message_twoline_white_right.png b/res/graphics/gui/message_twoline_white_right.png deleted file mode 100644 index 13531965c..000000000 Binary files a/res/graphics/gui/message_twoline_white_right.png and /dev/null differ diff --git a/res/graphics/gui/tooltip_black_body.png b/res/graphics/gui/tooltip_black_body.png index 9ef216d04..a69eb8da0 100644 Binary files a/res/graphics/gui/tooltip_black_body.png and b/res/graphics/gui/tooltip_black_body.png differ diff --git a/res/graphics/gui/tooltip_black_left.png b/res/graphics/gui/tooltip_black_left.png index 3ce1ca350..09783d78d 100644 Binary files a/res/graphics/gui/tooltip_black_left.png and b/res/graphics/gui/tooltip_black_left.png differ diff --git a/res/graphics/gui/tooltip_black_right.png b/res/graphics/gui/tooltip_black_right.png index 31286fa85..c69637ed4 100644 Binary files a/res/graphics/gui/tooltip_black_right.png and b/res/graphics/gui/tooltip_black_right.png differ diff --git a/res/graphics/gui/tooltip_white_body.png b/res/graphics/gui/tooltip_white_body.png deleted file mode 100644 index ec465e8e5..000000000 Binary files a/res/graphics/gui/tooltip_white_body.png and /dev/null differ diff --git a/res/graphics/gui/tooltip_white_left.png b/res/graphics/gui/tooltip_white_left.png deleted file mode 100644 index 8ac99096b..000000000 Binary files a/res/graphics/gui/tooltip_white_left.png and /dev/null differ diff --git a/res/graphics/gui/tooltip_white_right.png b/res/graphics/gui/tooltip_white_right.png deleted file mode 100644 index 6b0e8dcad..000000000 Binary files a/res/graphics/gui/tooltip_white_right.png and /dev/null differ diff --git a/res/graphics/gui/ui_background.png b/res/graphics/gui/ui_background.png index d4a97f6b0..3fa28b496 100755 Binary files a/res/graphics/gui/ui_background.png and b/res/graphics/gui/ui_background.png differ diff --git a/res/graphics/gui/ui_corners.png b/res/graphics/gui/ui_corners.png index e91dcf927..d7956a0c4 100755 Binary files a/res/graphics/gui/ui_corners.png and b/res/graphics/gui/ui_corners.png differ diff --git a/res/graphics/gui/ui_separator.png b/res/graphics/gui/ui_separator.png index 57e0511f4..f9c9d30b0 100755 Binary files a/res/graphics/gui/ui_separator.png and b/res/graphics/gui/ui_separator.png differ diff --git a/res/graphics/gui/ui_sides.png b/res/graphics/gui/ui_sides.png index dd994e3ea..cb160407e 100755 Binary files a/res/graphics/gui/ui_sides.png and b/res/graphics/gui/ui_sides.png differ diff --git a/res/locales/usermsg.csv b/res/locales/usermsg.csv index c52c71d49..4acbca788 100644 --- a/res/locales/usermsg.csv +++ b/res/locales/usermsg.csv @@ -1,6 +1,6 @@ "STRING_ID";"IETF language tag(s) without dash";"enUS";"frFR";"esES";"deDE";"itIT";"ptBR";"ptPT";"ruRU";"elGR";"trTR";"daDK";"noNB";"svSE";"nlNL";"plPL";"fiFI";"jaJP";"zhCN";"zhTW";"koKR";"csCZ";"huHU";"roRO";"thTH";"bgBG";"heIL";"jakanaJP";"isIC" -"APP_CALIBRATE_YOUR_MONITOR";;"Best player experience can be achieved with properly calibrated monitor. If you have not, please do it before you play.";"Meilleure expérience de joueur peut être réalisé avec écran correctement calibré. Si vous ne l'avez pas, s.v.p. le calibrez avant de jouer.";;;;;;;;;;;;;;;"このゲームは、適切に調整したモニターから最高のプレイができます。調整していなかったら、プレイする前に調整してください。";;;"본 게임은 적절히 보정된 모니터에서 최상으로 즐길 수 있습니다. 보정하지 않았다면 플레이하기 전에 보정해 주십시오.";;;;;;;"このゲームは、てきせつにちょうせいした モニターからさいこうのプレイができます。ちょうせいして いなかったら、プレイするまえにちょうせいしてください。";"Best leikmaður reynsla er getur náðist með rétt kvarðaður skjárinn. Ef þú ekki gerðir, gerðu svo vel að kvarða áður en þú leikur." -"COPYRIGHT_MSG";;"All rights reserved.";"Tous les droits sont réservés.";;;;;;;;;;;;;;;"全著作権所有。";;;"모든 권리 보유.";;;;;;;"ぜん ちょさくけん しょゆう。";"Allur réttur áskilinn." +"APP_CALIBRATE_YOUR_MONITOR";;"Best player experience can be achieved with properly calibrated monitor. If you have not, please do it before you play.";"Meilleure expérience de joueur peut être réalisé avec écran correctement calibré. Si vous ne l'avez pas, s.v.p. le calibrez avant de jouer.";;;;;;;;;;;;;;;"このゲームは、適切に調整したモニターから最高のプレイができます。調整していなかったら、プレイする前に調整してください。";;;"본 게임은 적절히 보정된 모니터에서 최상으로 즐길 수 있습니다. 보정하지 않았다면 플레이하기 전에 보정해 주십시오.";;;;;;;"このゲームは、てきせつにちょうせいした モニターから さいこうのプレイができます。ちょうせいして いなかったら、プレイするまえに ちょうせいしてください。";"Best leikmaður reynsla er getur náðist með rétt kvarðaður skjárinn. Ef þú ekki gerðir, gerðu svo vel að kvarða áður en þú leikur." +"COPYRIGHT_PROPRIETARY";;"All rights reserved.";"Tous les droits sont réservés.";"Todos los derechos reservados.";"Alle Rechte vorbehalten.";"Tutti i diritti riservati.";;;;;;;;;;;"Kaikki oikeudet pidätetään";"全著作権所有。";;;"모든 권리 보유.";;;;;;;"ぜんちょさくけん しょゆう。";"Öll réttindi áskilinn." "MENU_LABEL_NEW_WORLD";"";"New world";"Nouveau monde";"Nuevo mundo";"Neue Welt";"Nuovo mondo";"Novo mundo";"Novo mundo";"Новый мир";"Νέο κόσμο";"Yeni Dünya";"Ny verden";"Ny verden";"Ny värld";"Nieuwe wereld";"Nowy Świat";"Uusi maailma";"新しい世界";"新世界";"新世界";"새 세계";"Nový svět";"Új világ";"Lume noua";"โลกใหม่";"Нов свят";"עולם חדש";"あたらしい せかい";"Nýr heimur" diff --git a/src/net/torvald/random/Fudge3.kt b/src/net/torvald/random/Fudge3.kt index d9112cbc8..2a2acb4c4 100644 --- a/src/net/torvald/random/Fudge3.kt +++ b/src/net/torvald/random/Fudge3.kt @@ -7,7 +7,7 @@ import java.util.Random */ class Fudge3 /** - * Define new set of fudge dice with three dice. + * Define new set of Fudge dice with three dice (3dF). * @param randfunc java.util.Random or its extension */ (randfunc: Random) : FudgeDice(randfunc, 3) diff --git a/src/net/torvald/random/FudgeDice.kt b/src/net/torvald/random/FudgeDice.kt index 0a7917da9..95f7afd6b 100644 --- a/src/net/torvald/random/FudgeDice.kt +++ b/src/net/torvald/random/FudgeDice.kt @@ -7,20 +7,20 @@ import java.util.Random */ open class FudgeDice /** - * Define new set of fudge dice with given counts. + * Define new set of Fudge dice with given counts. * @param randfunc java.util.Random or its extension * * * @param counts amount of die */ -(private val randfunc: Random, val diceCounts: Int) { +(private val randfunc: Random, val diceCount: Int) { /** * Roll dice and get result. - * @return Normal distributed integer [-N , N] for diceCount of N. 0 is the most frequent return. + * @return Normally distributed integer [-N , N] for diceCount of N. 0 is the most frequent return. */ fun roll(): Int { var diceResult = 0 - for (c in 0..diceCounts - 1) { + for (c in 0..diceCount - 1) { diceResult += rollSingleDie() } @@ -29,14 +29,14 @@ open class FudgeDice /** * Roll dice and get result, for array index - * @return Normal distributed integer [0 , N] for N = 2 × DiceCounts + 1. 0 is the most frequent return. + * @return Normally distributed integer [0 , N] for N = 2 × DiceCounts + 1. 0 is the most frequent return. */ fun rollForArray(): Int { - return roll() + diceCounts + return roll() + diceCount } val sizeOfProbabilityRange: Int - get() = 2 * diceCounts + 1 + get() = 2 * diceCount + 1 /** * @return integer randomly picked from {-1, 0, 1} diff --git a/src/net/torvald/terrarum/Terrarum.kt b/src/net/torvald/terrarum/Terrarum.kt index c875fb246..166baccd7 100644 --- a/src/net/torvald/terrarum/Terrarum.kt +++ b/src/net/torvald/terrarum/Terrarum.kt @@ -5,10 +5,7 @@ import net.torvald.JsonFetcher import net.torvald.JsonWriter import org.lwjgl.input.Controllers import org.lwjgl.opengl.GL11 -import org.newdawn.slick.AppGameContainer -import org.newdawn.slick.Font -import org.newdawn.slick.GameContainer -import org.newdawn.slick.SlickException +import org.newdawn.slick.* import org.newdawn.slick.state.StateBasedGame import java.io.File import java.io.IOException @@ -81,7 +78,7 @@ constructor(gamename: String) : StateBasedGame(gamename) { lateinit var appgc: AppGameContainer - val WIDTH = 1060 + val WIDTH = 1072 val HEIGHT = 742 // IMAX ratio var VSYNC = true val VSYNC_TRIGGER_THRESHOLD = 56 @@ -372,6 +369,11 @@ fun setBlendAlphaMap() { GL11.glColorMask(false, false, false, true) } +fun setBlendScreen() { + GL11.glEnable(GL11.GL_BLEND) + GL11.glColorMask(true, true, true, true) + GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_COLOR)} + fun setBlendDisable() { GL11.glDisable(GL11.GL_BLEND) } diff --git a/src/net/torvald/terrarum/mapdrawer/LightmapRenderer.kt b/src/net/torvald/terrarum/mapdrawer/LightmapRenderer.kt index 0aee0b6c1..49b7f2acb 100644 --- a/src/net/torvald/terrarum/mapdrawer/LightmapRenderer.kt +++ b/src/net/torvald/terrarum/mapdrawer/LightmapRenderer.kt @@ -16,8 +16,8 @@ import java.util.* */ object LightmapRenderer { - val overscan_open: Int = (256f / (TilePropCodex.getProp(TileNameCode.AIR).opacity and 0xFF).toFloat()).ceil() - val overscan_opaque: Int = (256f / (TilePropCodex.getProp(TileNameCode.STONE).opacity and 0xFF).toFloat()).ceil() + val overscan_open: Int = Math.min(32, 256f.div(TilePropCodex.getProp(TileNameCode.AIR).opacity and 0xFF).toFloat().ceil()) + val overscan_opaque: Int = Math.min(8, 256f.div(TilePropCodex.getProp(TileNameCode.STONE).opacity and 0xFF).toFloat().ceil()) private val LIGHTMAP_WIDTH = Terrarum.game.ZOOM_MIN.inv().times(Terrarum.WIDTH) .div(MapDrawer.TILE_SIZE).ceil() + overscan_open * 2 + 3 @@ -84,8 +84,73 @@ object LightmapRenderer { * * true: overscanning is limited to 8 tiles in width (overscan_opaque) * * false: overscanning will fully applied to 32 tiles in width (overscan_open) */ - val noop_mask = BitSet(2 * (for_x_end - for_x_start + 1) + - 2 * (for_y_end - for_y_start - 1)) + /*val rect_width = for_x_end - for_x_start + val rect_height_rem_hbars = for_y_end - for_y_start - 2 + val noop_mask = BitSet(2 * (rect_width) + + 2 * (rect_height_rem_hbars)) + val rect_size = noop_mask.size() + + // get No-op mask + fun edgeToMaskNum(i: Int): Pair { + if (i > rect_size) throw IllegalArgumentException() + + if (i < rect_width) // top edge horizontal + return Pair(for_x_start + i, for_y_start) + else if (i >= rect_size - rect_width) // bottom edge horizontal + return Pair( + for_x_start + i.minus(rect_size - rect_width), + for_y_end + ) + else { // vertical edges without horizontal edge pair + return Pair( + if ((rect_width.even() && i.even()) || (rect_width.odd() && i.odd())) + // if the index is on the left side of the box + for_x_start + else for_x_end , + (i - rect_width).div(2) + for_y_start + 1 + ) + } + } + + fun posToMaskNum(x: Int, y: Int): Int? { + if (x in for_x_start + 1..for_x_end - 1 && y in for_y_start + 1..for_y_end - 1) { + return null // inside of this imaginary box + } + else if (y <= for_y_start) { // upper edge + if (x < for_x_start) return 0 + else if (x > for_x_end) return rect_width - 1 + else return x - for_x_start + } + else if (y >= for_y_end) { // lower edge + if (x < for_x_start) return rect_size - rect_width + else if (x > for_x_end) return rect_size - 1 + else return x - for_x_start + (rect_size - rect_width) + } + else { // between two edges + if (x < for_x_start) return (y - for_y_start - 1) * 2 + rect_width + else if (x > for_x_end) return (y - for_y_start - 1) * 2 + rect_width + 1 + else return null + } + } + + fun isNoop(x: Int, y: Int): Boolean = + if (posToMaskNum(x, y) == null) + false + else if (!(x in for_x_start - overscan_opaque..for_x_end + overscan_opaque && + x in for_y_start - overscan_opaque..for_y_end + overscan_opaque)) + // point is within the range of overscan_open but not overscan_opaque + noop_mask.get(posToMaskNum(x, y)!!) + else // point within the overscan_opaque must be rendered, so no no-op + false + + // build noop map + for (i in 0..rect_size) { + val point = edgeToMaskNum(i) + val tile = Terrarum.game.map.getTileFromTerrain(point.first, point.second) ?: TileNameCode.NULL + val isSolid = TilePropCodex.getProp(tile).isSolid + + noop_mask.set(i, isSolid) + }*/ /** * Updating order: @@ -527,4 +592,81 @@ object LightmapRenderer { fun Float.floor() = FastMath.floor(this) fun Float.round(): Int = Math.round(this) fun Float.ceil() = FastMath.ceil(this) + fun Int.even(): Boolean = this and 1 == 0 + fun Int.odd(): Boolean = this and 1 == 1 + + val histogram: Histogram + get() { + var reds = IntArray(MUL) // reds[intensity] ← counts + var greens = IntArray(MUL) // do. + var blues = IntArray(MUL) // do. + val render_width = for_x_end - for_x_start + val render_height = for_y_end - for_y_start + // excluiding overscans; only reckon visible lights + for (y in overscan_open..render_height + overscan_open + 1) { + for (x in overscan_open..render_width + overscan_open + 1) { + reds[lightmap[y][x].rawR()] += 1 + greens[lightmap[y][x].rawG()] += 1 + blues[lightmap[y][x].rawB()] += 1 + } + } + return Histogram(reds, greens, blues) + } + + class Histogram(val reds: IntArray, val greens: IntArray, val blues: IntArray) { + + val RED = 0 + val GREEN = 1 + val BLUE = 2 + + val screen_tiles: Int + get() = (for_x_end - for_x_start + 2) * (for_y_end - for_y_start + 2) + + val brightest: Int + get() { + for (i in CHANNEL_MAX downTo 1) { + if (reds[i] > 0 || greens[i] > 0 || blues[i] > 0) + return i + } + return 0 + } + + val brightest8Bit: Int + get() { val b = brightest + return if (brightest > 255) 255 else b + } + + val dimmest: Int + get() { + for (i in 0..CHANNEL_MAX) { + if (reds[i] > 0 || greens[i] > 0 || blues[i] > 0) + return i + } + return CHANNEL_MAX + } + + val histogramMax: Int + get() { + var max = 0 + for (c in 0..2) { + for (i in 0..CHANNEL_MAX) { + val value = get(c)[i] + if (value > max) max = value + } + } + return max + } + + val range: Int + get() = reds.size + + fun get(index: Int): IntArray { + return when (index) { + RED -> reds + GREEN -> greens + BLUE -> blues + else -> throw IllegalArgumentException() + } + } + } } diff --git a/src/net/torvald/terrarum/tileproperties/tileprop.csv b/src/net/torvald/terrarum/tileproperties/tileprop.csv index 6f94c9fd7..f110771a7 100644 --- a/src/net/torvald/terrarum/tileproperties/tileprop.csv +++ b/src/net/torvald/terrarum/tileproperties/tileprop.csv @@ -41,7 +41,7 @@ "10"; "2";"TILE_PLATFORM_EBONY" ; "8396808"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "2"; "0";"16" "10"; "3";"TILE_PLATFORM_BIRCH" ; "8396808"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "3"; "0";"16" "10"; "4";"TILE_PLATFORM_BLOODROSE" ; "8396808"; "1"; "N/A"; "0"; "0"; "0"; "0"; "0"; "10"; "4"; "0";"16" - "11"; "0";"TILE_TORCH" ; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "244454464"; "11"; "0"; "0";"16" + "11"; "0";"TILE_TORCH" ; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "267518016"; "11"; "0"; "0";"16" "11"; "1";"TILE_TORCH_FROST" ; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "81916159"; "11"; "1"; "0";"16" "12"; "0";"TILE_TORCH" ; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "0"; "11"; "0"; "0";"16" "12"; "1";"TILE_TORCH_FROST" ; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "0"; "11"; "1"; "0";"16" @@ -84,22 +84,6 @@ "15"; "4";"TILE_SANDSTONE_BLACK" ; "33587232"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "4"; "0";"16" "15"; "5";"TILE_SANDSTONE_BLACK" ; "33587232"; "25";"1900"; "0"; "0"; "1"; "1"; "0"; "15"; "5"; "0";"16" "16"; "0";"TILE_LANTERN_IRON_REGULAR"; "8396808"; "0"; "N/A"; "0"; "0"; "0"; "0"; "267619480"; "16"; "0"; "0";"16" -"255"; "0";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "1";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "2";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "3";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "4";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "5";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "6";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "7";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "8";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "9";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "10";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "11";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "12";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "13";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "14";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" -"255"; "15";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" "254"; "0";"TILE_LAVA" ;"260301048"; "100";"2600"; "1"; "48"; "0"; "0"; "205574144"; "N/A"; "N/A"; "0";"16" "254"; "1";"TILE_LAVA" ;"260301048"; "100";"2600"; "1"; "48"; "0"; "0"; "205574144"; "N/A"; "N/A"; "0";"16" "254"; "2";"TILE_LAVA" ;"260301048"; "100";"2600"; "1"; "48"; "0"; "0"; "205574144"; "N/A"; "N/A"; "0";"16" @@ -116,6 +100,22 @@ "254"; "13";"TILE_LAVA" ;"260301048"; "100";"2600"; "1"; "48"; "0"; "0"; "205574144"; "N/A"; "N/A"; "0";"16" "254"; "14";"TILE_LAVA" ;"260301048"; "100";"2600"; "1"; "48"; "0"; "0"; "205574144"; "N/A"; "N/A"; "0";"16" "254"; "15";"TILE_LAVA" ;"260301048"; "100";"2600"; "1"; "48"; "0"; "0"; "205574144"; "N/A"; "N/A"; "0";"16" +"255"; "0";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "1";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "2";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "3";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "4";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "5";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "6";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "7";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "8";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "9";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "10";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "11";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "12";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "13";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "14";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" +"255"; "15";"TILE_WATER" ; "27282445"; "100";"1000"; "1"; "12"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" "256"; "0";"TILE_NULL" ; "0"; "-1";"2600"; "0"; "0"; "0"; "0"; "0"; "N/A"; "N/A"; "0";"16" # Friction: 0: frictionless, <16: slippery, 16: regular, >16: sticky # Opacity/Lumcolor: 40-step RGB @@ -123,7 +123,7 @@ # movr: Movement resistance, (walkspeedmax) / (1 + (n/16)), 16 halves movement speed # dsty: density. As we are putting water an 1000, it is identical to specific gravity. [g/l] -# Defalut torch : L 77 a 47 b 59; real candlelight colour taken from properly configured camera. +# Defalut torch : L 70 a 51 b 59; real candlelight colour taken from properly configured camera. # 16 colour palette : Old Apple Macintosh 16-colour palette diff --git a/src/net/torvald/terrarum/ui/BasicDebugInfoWindow.kt b/src/net/torvald/terrarum/ui/BasicDebugInfoWindow.kt index 13d50c745..b42eb8cb0 100644 --- a/src/net/torvald/terrarum/ui/BasicDebugInfoWindow.kt +++ b/src/net/torvald/terrarum/ui/BasicDebugInfoWindow.kt @@ -1,11 +1,14 @@ package net.torvald.terrarum.ui +import com.jme3.math.FastMath import net.torvald.terrarum.gamemap.PairedMapLayer import net.torvald.terrarum.langpack.Lang import net.torvald.terrarum.mapdrawer.LightmapRenderer import net.torvald.terrarum.mapdrawer.MapCamera import net.torvald.terrarum.mapdrawer.MapDrawer import net.torvald.terrarum.Terrarum +import net.torvald.terrarum.setBlendNormal +import net.torvald.terrarum.setBlendScreen import org.newdawn.slick.Color import org.newdawn.slick.GameContainer import org.newdawn.slick.Graphics @@ -162,6 +165,8 @@ class BasicDebugInfoWindow : UICanvas { g.drawString( Lang["DEV_COLOUR_LEGEND_BLUE"] + " : nextHitbox", (Terrarum.WIDTH - 200).toFloat() , line(3).toFloat()) + + drawHistogram(g, LightmapRenderer.histogram, Terrarum.WIDTH - 256 - 30, Terrarum.HEIGHT - 100 - 30) } private fun printLine(g: Graphics, l: Int, s: String) { @@ -172,13 +177,45 @@ class BasicDebugInfoWindow : UICanvas { g.drawString(s, (20 + column(col)).toFloat(), line(row).toFloat()) } - private fun line(i: Int): Int { - return i * 20 + private fun drawHistogram(g: Graphics, histogram: LightmapRenderer.Histogram, x: Int, y: Int) { + val uiColour = Color(0x99000000.toInt()) + val barR = Color(0xFF0000.toInt()) + val barG = Color(0x00FF00.toInt()) + val barB = Color(0x0000FF.toInt()) + val barColour = arrayOf(barR, barG, barB) + val w = 256.toFloat() + val h = 100.toFloat() + val range = histogram.range + val histogramMax = histogram.screen_tiles + //val histogramMax = histogram.histogramMax + + g.color = uiColour + g.fillRect(x.toFloat(), y.toFloat(), w.plus(1).toFloat(), h.toFloat()) + + setBlendScreen() + for (c in 0..2) { + for (i in 0..255) { + var histogram_value = if (i == 255) 0 else histogram.get(c)[i] + if (i == 255) { + for (k in 255..range - 1) { + histogram_value += histogram.get(c)[k] + } + } + + val bar_x = x + (w / w.minus(1).toFloat()) * i.toFloat() + val bar_h = FastMath.ceil(h / histogramMax.toFloat()) * histogram_value.toFloat() + val bar_y = y + (h / histogramMax.toFloat()) - bar_h + h + val bar_w = 1f + g.color = barColour[c] + g.fillRect(bar_x, bar_y, bar_w, bar_h) + } + } + setBlendNormal() } - private fun column(i: Int): Int { - return 250 * (i - 1) - } + private fun line(i: Int): Int = i * 20 + + private fun column(i: Int): Int = 250 * (i - 1) override fun doOpening(gc: GameContainer, delta: Int) { diff --git a/work_files/graphics/fonts/wenquanyi_11pt_part1.png b/work_files/graphics/fonts/wenquanyi_11pt_part1.png index 8cd413556..a4c9be19c 100644 Binary files a/work_files/graphics/fonts/wenquanyi_11pt_part1.png and b/work_files/graphics/fonts/wenquanyi_11pt_part1.png differ diff --git a/work_files/graphics/fonts/wenquanyi_11pt_part2.png b/work_files/graphics/fonts/wenquanyi_11pt_part2.png index 7f4a409e5..e46f37790 100644 Binary files a/work_files/graphics/fonts/wenquanyi_11pt_part2.png and b/work_files/graphics/fonts/wenquanyi_11pt_part2.png differ