diff --git a/.idea/libraries/lib.xml b/.idea/libraries/lib.xml index e9b373787..ed64fcc7f 100644 --- a/.idea/libraries/lib.xml +++ b/.idea/libraries/lib.xml @@ -8,6 +8,8 @@ + + diff --git a/lib/commons-codec-1.10-javadoc.jar b/lib/commons-codec-1.10-javadoc.jar new file mode 100644 index 000000000..2f372ecfb Binary files /dev/null and b/lib/commons-codec-1.10-javadoc.jar differ diff --git a/lib/commons-codec-1.10.jar b/lib/commons-codec-1.10.jar new file mode 100644 index 000000000..1d7417c40 Binary files /dev/null and b/lib/commons-codec-1.10.jar differ diff --git a/out/production/Terrarum_renewed/com/Torvald/CSVFetcher.class b/out/production/Terrarum_renewed/com/Torvald/CSVFetcher.class index 2f366bbb5..d4dc011aa 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/CSVFetcher.class and b/out/production/Terrarum_renewed/com/Torvald/CSVFetcher.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/ImageFont/GameFontBase.class b/out/production/Terrarum_renewed/com/Torvald/ImageFont/GameFontBase.class index d4c07248d..7b05084f0 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/ImageFont/GameFontBase.class and b/out/production/Terrarum_renewed/com/Torvald/ImageFont/GameFontBase.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/ImageFont/GameFontWhite.class b/out/production/Terrarum_renewed/com/Torvald/ImageFont/GameFontWhite.class index 76b65cc11..f4b1fcac3 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/ImageFont/GameFontWhite.class and b/out/production/Terrarum_renewed/com/Torvald/ImageFont/GameFontWhite.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/ActorWithBody.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/ActorWithBody.class index 4db77b891..8157f1ef2 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/ActorWithBody.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/ActorWithBody.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/Faction/FactionRelatorFactory.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/Faction/FactionRelatorFactory.class index 09c04a5f1..6af94e618 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/Faction/FactionRelatorFactory.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/Faction/FactionRelatorFactory.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/Luminous.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/Luminous.class new file mode 100644 index 000000000..80ce4b82f Binary files /dev/null and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/Luminous.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/PBFSigrid.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/PBFSigrid.class index c5870601d..32e58c2eb 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/PBFSigrid.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/PBFSigrid.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/Player.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/Player.class index 6ef492cfe..564098542 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/Player.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Actors/Player.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/Authenticator.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/Authenticator.class new file mode 100644 index 000000000..f25c6032d Binary files /dev/null and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/Authenticator.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/CodexEdictis.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/CodexEdictis.class index 9a10fc75c..394173585 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/CodexEdictis.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/CodexEdictis.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/CommandInput.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/CommandInput.class index d77df8fee..a3ed5e198 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/CommandInput.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/CommandInput.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/CommandInterpreter.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/CommandInterpreter.class index 1dca464d5..9cd1b59a7 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/CommandInterpreter.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/CommandInterpreter.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/GetAV.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/GetAV.class index 0e617f73b..f62d41d7b 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/GetAV.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/GetAV.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/QuitApp.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/QuitApp.class index dcc8dc709..a35956aca 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/QuitApp.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/ConsoleCommand/QuitApp.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Game.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Game.class index e361db3b2..69ed05556 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Game.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Game.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapLantern.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapLantern.class index 04f490aca..959fabf6a 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapLantern.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapLantern.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.class index 30da333c1..37d9e85c5 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapGenerator/MapGenerator.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapGenerator/MapGenerator.class index fb3ca46e5..e9a743bc0 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapGenerator/MapGenerator.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/MapGenerator/MapGenerator.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Terrarum.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Terrarum.class index 0843c1bea..4af13fcbd 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/Terrarum.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/Terrarum.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/TileProperties/TilePropCodex.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/TileProperties/TilePropCodex.class index 71cab86dd..9751c5278 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/TileProperties/TilePropCodex.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/TileProperties/TilePropCodex.class differ diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/TileProperties/propdata.csv b/out/production/Terrarum_renewed/com/Torvald/Terrarum/TileProperties/propdata.csv index bf66a2a04..3ff60be43 100644 --- a/out/production/Terrarum_renewed/com/Torvald/Terrarum/TileProperties/propdata.csv +++ b/out/production/Terrarum_renewed/com/Torvald/Terrarum/TileProperties/propdata.csv @@ -21,7 +21,7 @@ "17";"TILE_ORE_NATURAL_GOLD" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "17"; "0";"16" "18";"TILE_ORE_NATURAL_SILVER" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "18"; "0";"16" "19";"TILE_ORE_RUTILE" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "19"; "0";"16" - "20";"TILE_ORE_AURICHALCUMITE" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "20"; "0";"16" + "20";"TILE_ORE_AURICHALCUMITE" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "20"; "0";"16" "21";"TILE_GEM_RUBY" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "21"; "0";"16" "22";"TILE_GEM_EMERALD" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "22"; "0";"16" "23";"TILE_GEM_SAPPHIRE" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "23"; "0";"16" diff --git a/out/production/Terrarum_renewed/com/Torvald/Terrarum/UserInterface/ConsoleWindow.class b/out/production/Terrarum_renewed/com/Torvald/Terrarum/UserInterface/ConsoleWindow.class index 5a437e649..fe805abeb 100644 Binary files a/out/production/Terrarum_renewed/com/Torvald/Terrarum/UserInterface/ConsoleWindow.class and b/out/production/Terrarum_renewed/com/Torvald/Terrarum/UserInterface/ConsoleWindow.class differ diff --git a/res/books/polyglot_test.txt b/res/books/polyglot_test.txt index a5ec4519c..24b0742cc 100644 --- a/res/books/polyglot_test.txt +++ b/res/books/polyglot_test.txt @@ -3,10 +3,10 @@ Un royaume de solitude, ma place est là pour toujours Der Wind, er heult so wie der Sturm ganz tief in mir Het werd mij te veel, hoe ik mijn best ook deed -[han logographics not supported] +别让他们进来看见,做好女孩,就像妳的从前 Visa ingenting, vad du än gör, allt är förstört -ありの ままの すがた みせるのよ +ありのままの姿見せるのよ Libre soy, libre soy, ¡libertad sin vuelta atrás! Wszystkim wbrew na ten gest mnie stać Jöjjön száz orkán, és közben a szívemen ül a jég @@ -17,7 +17,7 @@ Non è un difetto, è una virtù! e non la fermerò mai più, 내 맘대로 자유롭게 살래! Сад је крај, сад је крај На крилима ветра сам -[han logographics not supported] +誰亦要隨心講忘掉昨天悲歌 Estou aqui, e vou ficar! Venha a tempestade Kuasaku buat hidup bercelaru diff --git a/res/graphics/fonts/ascii_special_ef.png b/res/graphics/fonts/ascii_special_ef.png index cc7cba6ad..9d1604a6a 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 394ef9cf7..03d3be57f 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 new file mode 100644 index 000000000..5d7a81c73 Binary files /dev/null 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 new file mode 100644 index 000000000..dadfb77e4 Binary files /dev/null and b/res/graphics/fonts/cyrilic_majuscule.png differ diff --git a/res/graphics/fonts/unifont_unihan.png b/res/graphics/fonts/unifont_unihan.png new file mode 100644 index 000000000..aed4a2317 Binary files /dev/null and b/res/graphics/fonts/unifont_unihan.png differ diff --git a/res/locales/jp.lang b/res/locales/jp.lang index ff6c61a07..4423a5c38 100644 --- a/res/locales/jp.lang +++ b/res/locales/jp.lang @@ -222,7 +222,7 @@ TERM_PHYS_MASS=質量 ########## DEV_MEMORY_SHORT_CAP=メモリー -DEV_MEMORY_A_OF_B=%2$sM 中 %1$sM +DEV_MEMORY_A_OF_B=%2$sM中%1$sM DEV_COLOUR_LEGEND_GREEN=緑 DEV_COLOUR_LEGEND_BLUE=青 @@ -255,8 +255,8 @@ CREDITS_POLYGLOT=Translated by the Polyglot Project. ## Languages # ################ -LANGUAGE_ENGLISH=えい ご -LANGUAGE_FRENCH=フランス ご +LANGUAGE_ENGLISH=英語 +LANGUAGE_FRENCH=フランス語 LANGUAGE_JAPANESE=日本語 LANGUAGE_JAPANESE_KANA=日本語・仮名 -LANGUAGE_KOREAN=かんこく ご +LANGUAGE_KOREAN=韓国語 diff --git a/src/com/Torvald/ImageFont/GameFontBase.java b/src/com/Torvald/ImageFont/GameFontBase.java index ca8d6eb9b..be7ce7104 100644 --- a/src/com/Torvald/ImageFont/GameFontBase.java +++ b/src/com/Torvald/ImageFont/GameFontBase.java @@ -17,16 +17,21 @@ public class GameFontBase implements Font { static SpriteSheet extASheetEF; static SpriteSheet kanaSheet; static SpriteSheet cjkPunct; + static SpriteSheet uniHan; + static SpriteSheet cyrilic; + static SpriteSheet cyrilicEF; static final int JUNG_COUNT = 21; static final int JONG_COUNT = 28; static final int W_CJK = 10; + static final int W_UNIHAN = 16; static final int W_CJK_DRAW = 11; static final int W_LATIN_WIDE = 9; // width of regular letters, including m static final int W_LATIN_NARROW = 5; // width of letter f, t, i, l static final int H = 20; static final int H_HANGUL = 16; + static final int H_UNIHAN = 16; static final int H_KANA = 20; static final int SHEET_ASCII_EM = 0; @@ -37,17 +42,24 @@ public class GameFontBase implements Font { static final int SHEET_EXTA_EF = 5; static final int SHEET_KANA = 6; static final int SHEET_CJK_PUNCT = 7; + static final int SHEET_UNIHAN = 8; + static final int SHEET_CYRILIC_EM = 9; + static final int SHEET_CYRILIC_EF = 10; static SpriteSheet[] sheetKey; static final Character[] asciiEFList = { - ' ','!','"','\'','(',')','I','[',']','`','f','i','j','l','t','{' - ,'|','}',0xA1,'Ì','Í','Î','Ï','ì','í','î','ï','·' + ' ','!','"','\'','(',')',',','.',':',';','I','[',']','`','f','i' + ,'j','l','t','{','|','}',0xA1,'Ì','Í','Î','Ï','ì','í','î','ï','·' }; static final Character[] extAEFList = { 0x12E, 0x12F, 0x130, 0x131, 0x135, 0x13A, 0x13C, 0x142, 0x163, 0x167, 0x17F }; + static final Character[] cyrilecEFList = { + 0x406, 0x407, 0x456, 0x457, 0x458 + }; + /** * Runic letters list used for game. The set is * Younger Futhark + Medieval rune 'e' + Punct + Runic Almanac @@ -111,6 +123,18 @@ public class GameFontBase implements Font { return (c >= 0x3000 && c < 0x3040); } + private boolean isUniHan(char c) { + return (c >= 0x3400 && c < 0xA000); + } + + private boolean isCyrilic(char c) { + return (c >= 0x400 && c < 0x460); + } + + private boolean isCyrilicEF(char c) { + return (Arrays.asList(cyrilecEFList).contains(c)); + } + private int asciiEFindexX(char c) { return (Arrays.asList(asciiEFList).indexOf(c) % 16); } @@ -151,18 +175,49 @@ public class GameFontBase implements Font { return (c - 0x3000) / 16; } + private int uniHanIndexX(char c) { + return (c - 0x3400) % 256; + } + + private int uniHanIndexY(char c) { + return (c - 0x3400) / 256; + } + + private int cyrilicIndexX(char c) { + return (c - 0x400) % 16; + } + + private int cyrilicIndexY(char c) { + return (c - 0x400) / 16; + } + + private int cyrilicEFindexX(char c) { + return (Arrays.asList(cyrilecEFList).indexOf(c) % 16); + } + + private int cyrilicEFindexY(char c) { + return (Arrays.asList(cyrilecEFList).indexOf(c) / 16); + } + @Override public int getWidth(String s) { int len = 0; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); + switch (getSheetType(c)) { case SHEET_ASCII_EF: len += W_LATIN_NARROW; break; - case SHEET_HANGUL: case SHEET_KANA: case SHEET_CJK_PUNCT: + case SHEET_KANA: case SHEET_CJK_PUNCT: len += W_CJK_DRAW; break; + case SHEET_HANGUL: + len += W_CJK_DRAW; + break; + case SHEET_UNIHAN: + len += W_UNIHAN; break; default: len += W_LATIN_WIDE; + } } return len; @@ -204,12 +259,31 @@ public class GameFontBase implements Font { } hangulSheet.endUse(); + // unihan fonts + uniHan.startUse(); + for (int i = 0; i < s.length(); i++) { + char ch = s.charAt(i); + + if (isUniHan(ch)) { + uniHan.renderInUse( + Math.round(x + + getWidth(s.substring(0, i)) + ) + , Math.round((H - H_HANGUL) / 2 + y) + , uniHanIndexX(ch) + , uniHanIndexY(ch) + ); + } + } + + uniHan.endUse(); + //ascii fonts int prevInstance = -1; for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); - if (!isHangul(ch)) { + if (!isHangul(ch) && !isUniHan(ch)) { // if not init, enduse first if (prevInstance != -1) { @@ -245,6 +319,14 @@ public class GameFontBase implements Font { sheetX = cjkPunctIndexX(ch); sheetY = cjkPunctIndexY(ch); break; + case SHEET_CYRILIC_EM: + sheetX = cyrilicIndexX(ch); + sheetY = cyrilicIndexY(ch); + break; + case SHEET_CYRILIC_EF: + sheetX = cyrilicEFindexX(ch); + sheetY = cyrilicEFindexY(ch); + break; default: sheetX = ch % 16; sheetY = ch / 16; @@ -253,9 +335,9 @@ public class GameFontBase implements Font { try { sheetKey[prevInstance].renderInUse( - Math.round(x - + getWidth(s.substring(0, i)) - ) + Math.round(x + getWidth(s.substring(0, i))) + // pull punct right next to hangul to the left + + ((i > 0 && isHangul(s.charAt(i - 1))) ? -2 : 0) , Math.round(y) - ((prevInstance == SHEET_CJK_PUNCT) ? 1 : 0) , sheetX @@ -263,11 +345,11 @@ public class GameFontBase implements Font { ); } catch (ArrayIndexOutOfBoundsException e) { - System.out.println("char: '" + ch + "' (" + String.valueOf((int) ch) + ")"); - System.out.println("sheet: " + prevInstance); - System.out.println("sheetX: " + sheetX); - System.out.println("sheetY: " + sheetY); - e.printStackTrace(); + // System.out.println("ArrayIndexOutOfBoundsException") + // System.out.println("char: '" + ch + "' (" + String.valueOf((int) ch) + ")"); + // System.out.println("sheet: " + prevInstance); + // System.out.println("sheetX: " + sheetX); + // System.out.println("sheetY: " + sheetY); } } @@ -279,14 +361,22 @@ public class GameFontBase implements Font { } private int getSheetType(char c) { + // EFs if (isAsciiEF(c)) return SHEET_ASCII_EF; - else if (isHangul(c)) return SHEET_HANGUL; - else if (isRunic(c)) return SHEET_RUNIC; - else if (isExtA(c)) return SHEET_EXTA_EM; else if (isExtAEF(c)) return SHEET_EXTA_EF; + else if (isCyrilicEF(c)) return SHEET_CYRILIC_EF; + // fixed width + else if (isRunic(c)) return SHEET_RUNIC; + else if (isHangul(c)) return SHEET_HANGUL; else if (isKana(c)) return SHEET_KANA; + else if (isUniHan(c)) return SHEET_UNIHAN; + else if (isAscii(c)) return SHEET_ASCII_EM; + else if (isExtA(c)) return SHEET_EXTA_EM; + else if (isCyrilic(c)) return SHEET_CYRILIC_EM; + // fixed width punctuations else if (isCJKPunct(c)) return SHEET_CJK_PUNCT; - else return SHEET_ASCII_EM; + + else return SHEET_ASCII_EM; // fallback } @Override diff --git a/src/com/Torvald/ImageFont/GameFontWhite.java b/src/com/Torvald/ImageFont/GameFontWhite.java index b10b4396b..98f22062e 100644 --- a/src/com/Torvald/ImageFont/GameFontWhite.java +++ b/src/com/Torvald/ImageFont/GameFontWhite.java @@ -42,9 +42,21 @@ public class GameFontWhite extends GameFontBase { "./res/graphics/fonts/cjkpunct.png" , W_CJK, H_KANA ); + uniHan = new SpriteSheet( + "./res/graphics/fonts/unifont_unihan.png" + , W_UNIHAN, H_UNIHAN + ); + cyrilic = new SpriteSheet( + "./res/graphics/fonts/cyrilic_majuscule.png" + , W_LATIN_WIDE, H + ); + cyrilicEF = new SpriteSheet( + "./res/graphics/fonts/cyrilic_ef.png" + , W_LATIN_NARROW, H + ); SpriteSheet[] shk = { - asciiSheet + asciiSheet , asciiSheetEF , hangulSheet , runicSheet @@ -52,6 +64,9 @@ public class GameFontWhite extends GameFontBase { , extASheetEF , kanaSheet , cjkPunct + , uniHan + , cyrilic + , cyrilicEF }; sheetKey = shk; } diff --git a/src/com/Torvald/Terrarum/Actors/ActorWithBody.java b/src/com/Torvald/Terrarum/Actors/ActorWithBody.java index 029860ffe..c47b9f2bb 100644 --- a/src/com/Torvald/Terrarum/Actors/ActorWithBody.java +++ b/src/com/Torvald/Terrarum/Actors/ActorWithBody.java @@ -77,7 +77,7 @@ public class ActorWithBody implements Actor, Visible, Glowing { private final int CONTACT_AREA_BOTTOM = 2; private final int CONTACT_AREA_LEFT = 3; - private final int UD_COMPENSATOR_MAX = 100; + private final int UD_COMPENSATOR_MAX = TSIZE; private final int LR_COMPENSATOR_MAX = TSIZE; private final int TILE_CLIMB_RATE = 4; @@ -155,17 +155,15 @@ public class ActorWithBody implements Actor, Visible, Glowing { if (veloY > VELO_HARD_LIMIT) veloY = VELO_HARD_LIMIT; // Set 'next' positions to fiddle with - if (!playerNoClip()) { - updateNextHitboxY(); - updateVerticalPos(); - clampNextHitbox(); - updateHitboxY(); + updateNextHitboxY(); + updateVerticalPos(); + clampNextHitbox(); + updateHitboxY(); - updateNextHitboxX(); - updateHorizontalPos(); - clampNextHitbox(); - updateHitboxX(); - } + updateNextHitboxX(); + updateHorizontalPos(); + clampNextHitbox(); + updateHitboxX(); clampHitbox(); } @@ -200,16 +198,18 @@ public class ActorWithBody implements Actor, Visible, Glowing { } private void updateVerticalPos() { - if (collidedBottomAndAdjusted()) { - grounded = true; - veloY = 0; - } - else { - grounded = false; - } + if (!playerNoClip()) { + if (collidedBottomAndAdjusted()) { + grounded = true; + veloY = 0; + } + else { + grounded = false; + } - if (collidedTopAndAdjusted()) { - veloY = 0; + if (collidedTopAndAdjusted()) { + veloY = 0; + } } } @@ -254,20 +254,22 @@ public class ActorWithBody implements Actor, Visible, Glowing { } private void updateHorizontalPos() { - if (collidedRightAndAdjusted()) { // treat as 'event--collided right' - veloX = 0; - walledRight = true; + if (!playerNoClip()) { + if (collidedRightAndAdjusted()) { // treat as 'event--collided right' + veloX = 0; + walledRight = true; - // TODO remove above two lines and implement tile climb (multi-frame calculation.) - // Use variable TILE_CLIMB_RATE - } - else if (collidedLeftAndAdjusted()) { // treat as 'event--collided left' - veloX = 0; - walledLeft = true; - } - else { - walledRight = false; - walledLeft = false; + // TODO remove above two lines and implement tile climb (multi-frame calculation.) + // Use variable TILE_CLIMB_RATE + } + else if (collidedLeftAndAdjusted()) { // treat as 'event--collided left' + veloX = 0; + walledLeft = true; + } + else { + walledRight = false; + walledLeft = false; + } } } diff --git a/src/com/Torvald/Terrarum/Actors/Luminous.java b/src/com/Torvald/Terrarum/Actors/Luminous.java new file mode 100644 index 000000000..bcad0a50e --- /dev/null +++ b/src/com/Torvald/Terrarum/Actors/Luminous.java @@ -0,0 +1,11 @@ +package com.Torvald.Terrarum.Actors; + +/** + * Created by minjaesong on 16-02-19. + */ +public interface Luminous { + + void setLuminance(int RGB); + int getLuminance(); + +} diff --git a/src/com/Torvald/Terrarum/Actors/PBFSigrid.java b/src/com/Torvald/Terrarum/Actors/PBFSigrid.java index 077a96f7f..69a39270c 100644 --- a/src/com/Torvald/Terrarum/Actors/PBFSigrid.java +++ b/src/com/Torvald/Terrarum/Actors/PBFSigrid.java @@ -62,7 +62,7 @@ public class PBFSigrid { p.actorValue.set("intelligent", true); - p.setHitboxDimension(17, 47, 9, 0); + p.setHitboxDimension(17, 46, 9, 0); p.inventory = new ActorInventory(0x7FFFFFFF, true); diff --git a/src/com/Torvald/Terrarum/Actors/Player.java b/src/com/Torvald/Terrarum/Actors/Player.java index 961ea3dcf..74243e761 100644 --- a/src/com/Torvald/Terrarum/Actors/Player.java +++ b/src/com/Torvald/Terrarum/Actors/Player.java @@ -3,6 +3,9 @@ package com.Torvald.Terrarum.Actors; import com.Torvald.Terrarum.Actors.Faction.Faction; import com.Torvald.Terrarum.GameControl.EnumKeyFunc; import com.Torvald.Terrarum.GameControl.KeyMap; +import com.Torvald.Terrarum.MapDrawer.LightmapRenderer; +import com.Torvald.Terrarum.MapDrawer.MapCamera; +import com.Torvald.Terrarum.MapDrawer.MapDrawer; import com.Torvald.Terrarum.Terrarum; import com.Torvald.spriteAnimation.SpriteAnimation; import com.jme3.math.FastMath; @@ -18,7 +21,7 @@ import java.util.HashSet; /** * Created by minjaesong on 15-12-31. */ -public class Player extends ActorWithBody implements Controllable, Pocketed, Factionable { +public class Player extends ActorWithBody implements Controllable, Pocketed, Factionable, Luminous { @Nullable public Controllable vehicleRiding; @@ -50,6 +53,10 @@ public class Player extends ActorWithBody implements Controllable, Pocketed, Fac private final float AXIS_POSMAX = 1.0f; private final int GAMEPAD_JUMP = 5; + private final int TSIZE = MapDrawer.TILE_SIZE; + + private int LUMINANCE_RGB = 0xFFFFFF; + private HashSet factionSet = new HashSet<>(); /** @@ -78,6 +85,8 @@ public class Player extends ActorWithBody implements Controllable, Pocketed, Fac updateMovementControl(); if (noClip) { super.setGrounded(true); } + + } private void updatePhysicalInfos() { @@ -536,4 +545,14 @@ public class Player extends ActorWithBody implements Controllable, Pocketed, Fac public void clearFactionAssigning() { factionSet.clear(); } + + @Override + public void setLuminance(int RGB) { + LUMINANCE_RGB = RGB; + } + + @Override + public int getLuminance() { + return LUMINANCE_RGB; + } } diff --git a/src/com/Torvald/Terrarum/ConsoleCommand/Authenticator.java b/src/com/Torvald/Terrarum/ConsoleCommand/Authenticator.java new file mode 100644 index 000000000..d12c63bdc --- /dev/null +++ b/src/com/Torvald/Terrarum/ConsoleCommand/Authenticator.java @@ -0,0 +1,44 @@ +package com.Torvald.Terrarum.ConsoleCommand; + +import com.Torvald.Terrarum.Terrarum; +import com.Torvald.Terrarum.UserInterface.ConsoleWindow; +import org.apache.commons.codec.digest.DigestUtils; +import org.newdawn.slick.SlickException; + +/** + * Created by minjaesong on 16-02-19. + */ +public class Authenticator implements ConsoleCommand { + + private static final String A = "0d34076fc15db1b7c7a0943045699eba6f186ec1"; // alpine + // or 'srisrimahasri' + + private static boolean B = false; + + @Override + public void execute(String[] args) { + if (args.length == 2) { + String pwd = args[1]; + + String hashedPwd = DigestUtils.sha1Hex(pwd); + + if (A.equalsIgnoreCase(hashedPwd)) { + new Echo().execute(((B) ? "Dis" : "") + "authenticated."); + B = !B; + ((ConsoleWindow) (Terrarum.game.consoleHandler.getUI())).reset(); + } + } + else { + printUsage(); + } + } + + public boolean C() { + return B; + } + + @Override + public void printUsage() { + CommandInterpreter.echoUnknownCmd("auth"); + } +} diff --git a/src/com/Torvald/Terrarum/ConsoleCommand/CommandInterpreter.java b/src/com/Torvald/Terrarum/ConsoleCommand/CommandInterpreter.java index 1d6490ba1..4863c403b 100644 --- a/src/com/Torvald/Terrarum/ConsoleCommand/CommandInterpreter.java +++ b/src/com/Torvald/Terrarum/ConsoleCommand/CommandInterpreter.java @@ -1,6 +1,7 @@ package com.Torvald.Terrarum.ConsoleCommand; import com.Torvald.Terrarum.LangPack.Lang; +import com.Torvald.Terrarum.Terrarum; import java.util.ArrayList; import java.util.Formatter; @@ -17,18 +18,28 @@ public class CommandInterpreter { for (CommandInput single_command : cmd) { try { - ConsoleCommand commandObj = CommandDict.getCommand(single_command.getName().toLowerCase()); - commandObj.execute(single_command.toStringArray()); + if (single_command.getName().equalsIgnoreCase("auth")) { + Terrarum.game.auth.execute(single_command.toStringArray()); + } + else if (single_command.getName().equalsIgnoreCase("qqq")) { + new QuitApp().execute(single_command.toStringArray()); + } + else if (single_command.getName().equalsIgnoreCase("zoom")) { + new Zoom().execute(single_command.toStringArray()); + } + else { + if (Terrarum.game.auth.C()) { + ConsoleCommand commandObj = CommandDict.getCommand( + single_command.getName().toLowerCase()); + commandObj.execute(single_command.toStringArray()); + } + else { + throw new NullPointerException(); // if not authorised, say "Unknown command" + } + } } catch (NullPointerException e) { - StringBuilder sb = new StringBuilder(); - Formatter formatter = new Formatter(sb); - - new Echo().execute( - formatter.format(Lang.get("DEV_MESSAGE_CONSOLE_COMMAND_UNKNOWN") - , single_command.getName() - ).toString() - ); + echoUnknownCmd(single_command.getName()); } } } @@ -64,6 +75,17 @@ public class CommandInterpreter { return parsedCommands; } + static void echoUnknownCmd(String cmdname) { + StringBuilder sb = new StringBuilder(); + Formatter formatter = new Formatter(sb); + + new Echo().execute( + formatter.format(Lang.get("DEV_MESSAGE_CONSOLE_COMMAND_UNKNOWN") + , cmdname + ).toString() + ); + } + } class CommandInput { diff --git a/src/com/Torvald/Terrarum/ConsoleCommand/QuitApp.java b/src/com/Torvald/Terrarum/ConsoleCommand/QuitApp.java index 2e10f3068..11f25ef60 100644 --- a/src/com/Torvald/Terrarum/ConsoleCommand/QuitApp.java +++ b/src/com/Torvald/Terrarum/ConsoleCommand/QuitApp.java @@ -7,7 +7,7 @@ public class QuitApp implements ConsoleCommand { @Override public void execute(String[] args) { - System.exit(0); + System.exit(1); } @Override diff --git a/src/com/Torvald/Terrarum/Game.java b/src/com/Torvald/Terrarum/Game.java index 3f1d61076..c2f1d3834 100644 --- a/src/com/Torvald/Terrarum/Game.java +++ b/src/com/Torvald/Terrarum/Game.java @@ -1,6 +1,7 @@ package com.Torvald.Terrarum; import com.Torvald.Terrarum.Actors.*; +import com.Torvald.Terrarum.ConsoleCommand.Authenticator; import com.Torvald.Terrarum.ConsoleCommand.CommandDict; import com.Torvald.Terrarum.GameControl.GameController; import com.Torvald.Terrarum.GameControl.KeyMap; @@ -61,6 +62,8 @@ public class Game extends BasicGameState { private Shader shaderBlurH; private Shader shaderBlurV; + public static Authenticator auth = new Authenticator(); + public Game() throws SlickException { } @Override diff --git a/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.java b/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.java index 8c7c0fd21..0834453de 100644 --- a/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.java +++ b/src/com/Torvald/Terrarum/MapDrawer/LightmapRenderer.java @@ -45,9 +45,21 @@ public class LightmapRenderer { } - public static void addLantern(int x, int y, LightmapLantern lantern) { - // TODO check for duplicates - lanterns.add(lantern); + public static void addLantern(int x, int y, int intensity) { + LightmapLantern thisLantern = new LightmapLantern(x, y, intensity); + + for (int i = lanterns.size() - 1; i >= 0; i--) { + LightmapLantern lanternInList = lanterns.get(i); + // found duplicates + if (lanternInList.getX() == x && lanternInList.getY() == y) { + // add colour + int addedL = addRaw(intensity, lanternInList.getIntensity()); + lanternInList.intensity = addedL; + return; + } + } + //else + lanterns.add(thisLantern); } public static void removeLantern(int x, int y) { @@ -260,6 +272,18 @@ public class LightmapRenderer { } } + // mix actor Luminous + // test player TODO for all actor.Luminous in the game + int tileX = Math.round(Terrarum.game.getPlayer().getHitbox().getPointedX() / TSIZE); + int tileY = Math.round(Terrarum.game.getPlayer().getHitbox().getPointedY() / TSIZE) + - 1; + int lum = Terrarum.game.getPlayer().getLuminance(); + if (x == tileX && y == tileY) { + lightColorR = getR(lum); + lightColorG = getG(lum); + lightColorB = getB(lum); + } + float[] bgrVal = new float[3]; // {B, G, R} // test for each R, G, B channel @@ -375,7 +399,15 @@ public class LightmapRenderer { return getRawB(rgb) / 255f; } - private static int constructRGBFromFloat(int r, int g, int b) { + private static int addRaw(int rgb1, int rgb2) { + int newR = clampByte(getRawR(rgb1) + getRawB(rgb2)); + int newG = clampByte(getRawG(rgb1) + getRawG(rgb2)); + int newB = clampByte(getRawB(rgb1) + getRawB(rgb2)); + + return constructRGBFromInt(newR, newG, newB); + } + + private static int constructRGBFromInt(int r, int g, int b) { if (r < 0 || r > 0xFF) { throw new IllegalArgumentException("Red: out of range"); } if (g < 0 || g > 0xFF) { throw new IllegalArgumentException("Green: out of range"); } if (b < 0 || b > 0xFF) { throw new IllegalArgumentException("Blue: out of range"); } @@ -391,14 +423,14 @@ public class LightmapRenderer { int intG = Math.round(g * 0xFF); int intB = Math.round(b * 0xFF); - return constructRGBFromFloat(intR, intG, intB); + return constructRGBFromInt(intR, intG, intB); } private static int colourLinearMix(int colA, int colB) { int r = (getRawR(colA) + getRawR(colB)) >> 1; int g = (getRawG(colA) + getRawG(colB)) >> 1; int b = (getRawB(colA) + getRawB(colB)) >> 1; - return constructRGBFromFloat(r, g, b); + return constructRGBFromInt(r, g, b); } /** @@ -417,7 +449,7 @@ public class LightmapRenderer { int bSide = max(getRawG(side1), getRawG(side2), getRawG(corner) / 2); int b = arithmeticAverage(bSide, getRawG(thisTile)); - return constructRGBFromFloat(r, g, b); + return constructRGBFromInt(r, g, b); } private static int quantise16(int x) { @@ -454,13 +486,15 @@ public class LightmapRenderer { } private static int clampZero(int i) { - if (i < 0) return 0; - else return i; + return (i < 0) ? 0 : i; } private static float clampZero(float i) { - if (i < 0) return 0; - else return i; + return (i < 0) ? 0 : i; + } + + private static int clampByte(int i) { + return (i < 0) ? 0 : (i > 0xFF) ? 0xFF : i; } public static int[][] getStaticLightMap() { diff --git a/src/com/Torvald/Terrarum/MapGenerator/MapGenerator.java b/src/com/Torvald/Terrarum/MapGenerator/MapGenerator.java index 53b39f531..a61648e48 100644 --- a/src/com/Torvald/Terrarum/MapGenerator/MapGenerator.java +++ b/src/com/Torvald/Terrarum/MapGenerator/MapGenerator.java @@ -125,6 +125,14 @@ public class MapGenerator { , "Carving out cave..." ); + fillByMapNoFilterUnderground( + generate2DSimplexNoiseWorldSize(1f, 1f) + , 0.9f + , AIR + , STONE + , "Collapsing caves..." + ); + /*fillByMapInverseGradFilter( generate2DSimplexNoiseWorldSize(2.5f, 2.5f) , 1.02f @@ -223,9 +231,9 @@ public class MapGenerator { float[][] noiseMap = new float[height][width]; SimplexNoise simplexNoise = new SimplexNoise(CAVEGEN_LARGEST_FEATURE, CAVEGEN_PERTURB_RATE - , 0x51621D); + , seed); SimplexNoise simplexNoisePerturbMap = new SimplexNoise(CAVEGEN_LARGEST_FEATURE_PERTURB, 0.5f - , 0x51621D ^ random.nextLong()); + , seed ^ random.nextLong()); float xEnd=width * yStretch; float yEnd=height * xStretch; @@ -293,8 +301,11 @@ public class MapGenerator { /** higher = denser. * Recommended: (width or height) * 3 */ - float xEnd=height * yStretch; - float yEnd=width * xStretch; + float xEnd=width * yStretch; + float yEnd=height * xStretch; + + float lowestNoiseVal = 10000f; + float highestNoiseVal = -10000f; float[][] result=new float[sizeY][sizeX]; @@ -302,22 +313,31 @@ public class MapGenerator { for(int j=0;j highestNoiseVal) highestNoiseVal = noiseValue; + + result[i][j] = noiseValue; + } + } + + // Auto-scaling noise + + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + float noiseInit = result[y][x] - lowestNoiseVal; + + float noiseFin = noiseInit * (1f / (highestNoiseVal - lowestNoiseVal)); + + result[y][x] = noiseFin; } } return result; } - private static float[] generateWhiteNoiseArray(long seed) { - float[] noiseArray = new float[MapGenerator.width + 1]; - for (int i = 0; i < noiseArray.length; i++) { - noiseArray[i] = random.nextFloat(); - } - - return noiseArray; - } - private static int[] generateOcean(int[] noiseArrayLocal) { int oceanLeftP1 = noiseArrayLocal[OCEAN_WIDTH]; int oceanRightP1 = noiseArrayLocal[noiseArrayLocal.length - OCEAN_WIDTH]; @@ -557,7 +577,8 @@ public class MapGenerator { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { - if (map[i][j] > gradientQuadratic(i, noiseGradientStart, noiseGrdCaveEnd) / scarcity) { + if (map[i][j] > gradientQuadratic(i, noiseGradientStart, noiseGrdCaveEnd) * + scarcity) { MapGenerator.map.getTerrainArray()[i][j] = tile; } } @@ -577,7 +598,7 @@ public class MapGenerator { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { - if (map[i][j] > getNoiseGradient(i, noiseGradientStart, noiseGradientEnd) / scarcity + if (map[i][j] > getNoiseGradient(i, noiseGradientStart, noiseGradientEnd) * scarcity && MapGenerator.map.getTileFromTerrain(j, i) == replaceFrom) { MapGenerator.map.getTerrainArray()[i][j] = tile; } @@ -598,7 +619,8 @@ public class MapGenerator { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { - if (map[i][j] > getNoiseGradientInversed(i, noiseGradientEnd, noiseGradientStart) / scarcity + if (map[i][j] > getNoiseGradientInversed(i, noiseGradientEnd, noiseGradientStart) + * scarcity && MapGenerator.map.getTileFromTerrain(j, i) == replaceFrom) { MapGenerator.map.getTerrainArray()[i][j] = tile; } @@ -621,7 +643,7 @@ public class MapGenerator { for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { - if (map[i][j] > noiseGradientStart / scarcity + if (map[i][j] > noiseGradientStart * scarcity && MapGenerator.map.getTileFromTerrain(j, i) == replaceFrom) { MapGenerator.map.getTerrainArray()[i][j] = tile; } @@ -629,12 +651,27 @@ public class MapGenerator { } } + private static void fillByMapNoFilterUnderground(float[][] map, float scarcity, byte replaceFrom, byte + tile, String message) { + System.out.println("[MapGenerator] " + message); + + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + if (map[i][j] > noiseGradientStart * scarcity + && MapGenerator.map.getTileFromTerrain(j, i) == replaceFrom + && MapGenerator.map.getTileFromWall(j, i) == STONE) { + MapGenerator.map.getTerrainArray()[i][j] = tile; + } + } + } + } + private static void fillByMap(float[][] map, float scarcity, byte replaceFrom, byte[] tile, String message) { System.out.println("[MapGenerator] " + message); for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { - if (map[i][j] > getNoiseGradient(i, noiseGradientStart, noiseGradientEnd) / scarcity + if (map[i][j] > getNoiseGradient(i, noiseGradientStart, noiseGradientEnd) * scarcity && MapGenerator.map.getTileFromTerrain(j, i) == replaceFrom) { MapGenerator.map.getTerrainArray()[i][j] = tile[random.nextInt(tile.length)]; diff --git a/src/com/Torvald/Terrarum/Terrarum.java b/src/com/Torvald/Terrarum/Terrarum.java index b06bef8ac..9e6dfd034 100644 --- a/src/com/Torvald/Terrarum/Terrarum.java +++ b/src/com/Torvald/Terrarum/Terrarum.java @@ -6,6 +6,7 @@ import java.util.logging.Level; import java.util.logging.Logger; import com.Torvald.ImageFont.GameFontWhite; +import com.Torvald.Terrarum.ConsoleCommand.Authenticator; import com.Torvald.Terrarum.LangPack.Lang; import org.lwjgl.input.Controllers; import org.newdawn.slick.*; @@ -41,7 +42,7 @@ public class Terrarum extends StateBasedGame { public static String defaultDir; public static String defaultSaveDir; - public static String gameLocale = "jp_kana"; + public static String gameLocale = "ko"; public static Font gameFontWhite; diff --git a/src/com/Torvald/Terrarum/TileProperties/propdata.csv b/src/com/Torvald/Terrarum/TileProperties/propdata.csv index bf66a2a04..3ff60be43 100644 --- a/src/com/Torvald/Terrarum/TileProperties/propdata.csv +++ b/src/com/Torvald/Terrarum/TileProperties/propdata.csv @@ -21,7 +21,7 @@ "17";"TILE_ORE_NATURAL_GOLD" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "17"; "0";"16" "18";"TILE_ORE_NATURAL_SILVER" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "18"; "0";"16" "19";"TILE_ORE_RUTILE" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "19"; "0";"16" - "20";"TILE_ORE_AURICHALCUMITE" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "20"; "0";"16" + "20";"TILE_ORE_AURICHALCUMITE" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "20"; "0";"16" "21";"TILE_GEM_RUBY" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "21"; "0";"16" "22";"TILE_GEM_EMERALD" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "22"; "0";"16" "23";"TILE_GEM_SAPPHIRE" ; "32"; "25"; "0"; "N/A"; "1"; "0"; "0"; "23"; "0";"16" diff --git a/src/com/Torvald/Terrarum/UserInterface/ConsoleWindow.java b/src/com/Torvald/Terrarum/UserInterface/ConsoleWindow.java index e757edb09..8ad187bb7 100644 --- a/src/com/Torvald/Terrarum/UserInterface/ConsoleWindow.java +++ b/src/com/Torvald/Terrarum/UserInterface/ConsoleWindow.java @@ -16,15 +16,15 @@ public class ConsoleWindow implements UICanvas { Color UIColour = new Color(0x90000000); - private StringBuffer commandInputPool = new StringBuffer(); - private String prevCommand = ""; + private StringBuffer commandInputPool; + private String prevCommand; - private int inputCursorPos = 0; + private int inputCursorPos; private final int MESSAGES_MAX = 5000; - private String[] messages = new String[MESSAGES_MAX]; - private int messageDisplayPos = 0; - private int messagesCount = 0; + private String[] messages; + private int messageDisplayPos; + private int messagesCount; private final int LINE_HEIGHT = 20; private final int MESSAGES_DISPLAY_COUNT = 9; @@ -34,11 +34,7 @@ public class ConsoleWindow implements UICanvas { public ConsoleWindow() { super(); - - width = Terrarum.WIDTH; - height = 200; - - sendMessage(Lang.get("DEV_MESSAGE_CONSOLE_CODEX")); + reset(); } @Override @@ -182,6 +178,20 @@ public class ConsoleWindow implements UICanvas { } + public void reset() { + width = Terrarum.WIDTH; + height = 200; + + messages = new String[MESSAGES_MAX]; + messageDisplayPos = 0; + messagesCount = 0; + inputCursorPos = 0; + prevCommand = ""; + commandInputPool = new StringBuffer(); + + if (Terrarum.game.auth.C()) sendMessage(Lang.get("DEV_MESSAGE_CONSOLE_CODEX")); + } + @Override public int getWidth() { return width; diff --git a/work_files/Shutdown_codes.txt b/work_files/Shutdown_codes.txt new file mode 100644 index 000000000..44d9e2425 --- /dev/null +++ b/work_files/Shutdown_codes.txt @@ -0,0 +1,11 @@ + +== Shutdown codes + +bit 0 0 0 0 0 0 0 0 +index 8 7 6 5 4 3 2 1 + +all zero: nominal + +1: exit by console command 'qqq' + +8: erratic, reserved by Java \ No newline at end of file