mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
Make package names comply with the naming conventions, new player tester "Cynthia", creature-making factories now use CreatureRawInjector to create their ActorValues.
Former-commit-id: f924467637c8e34ecc9b2ffd00b343253c40aaf7 Former-commit-id: 7779de4420c27e06ee17e8576b643c366d434ef8
This commit is contained in:
1
.idea/compiler.xml
generated
1
.idea/compiler.xml
generated
@@ -18,5 +18,6 @@
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel target="1.8" />
|
||||
</component>
|
||||
</project>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 16 KiB |
BIN
res/graphics/sprites/test_player_2.png
Normal file
BIN
res/graphics/sprites/test_player_2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
14
res/locales/helpOnTheFly.csv
Normal file
14
res/locales/helpOnTheFly.csv
Normal file
@@ -0,0 +1,14 @@
|
||||
"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"
|
||||
|
||||
"HELP_OTF_MAIN_TEXT_1";;"Type “help slow” for the ways to make the game run faster.";;;;;;;;;;;;;;;;;;;"게임이 느리게 돌아간다면 “help slow”를 입력해 보세요."
|
||||
"HELP_OTF_MAIN_TEXT_2";;"Press PageUp/PageDown to scroll the messages.";;;;;;;;;;;;;;;;;;;"PageUp/PageDown 키를 사용해 메시지를 스크롤할 수 있습니다."
|
||||
"HELP_OTF_MAIN_TEXT_3";;"Utility keys:";;;;;;;;;;;;;;;;;;;"기능 키:"
|
||||
"HELP_OTF_MAIN_TEXT_4";;"• F3: basic information";;;;;;;;;;;;;;;;;;;"• F3: 기본 정보"
|
||||
"HELP_OTF_MAIN_TEXT_5";;"• F7: (debug only) toggle light blending";;;;;;;;;;;;;;;;;;;"• F7: (디버그용) 광원 블렌딩 켜고 끄기"
|
||||
"HELP_OTF_MAIN_TEXT_6";;"• F8: toggle smooth lighting";;;;;;;;;;;;;;;;;;;"• F8: 부드러운 광원 켜고 끄기"
|
||||
|
||||
"HELP_OTF_SLOW_TEXT_1";;"To make your game run faster:";;;;;;;;;;;;;;;;;;;"게임을 빠르게 하려면"
|
||||
"HELP_OTF_SLOW_TEXT_2";;"• Reset screen zoom to 1.";;;;;;;;;;;;;;;;;;;"• 화면 줌을 1로 돌려주세요. "
|
||||
"HELP_OTF_SLOW_TEXT_3";;"• Turn off basic information window using F3.";;;;;;;;;;;;;;;;;;;"• F3을 눌러 기본 정보 창을 꺼 주세요."
|
||||
"HELP_OTF_SLOW_TEXT_4";;"• Turn off smooth lighting. You can do it now by pressing F8.";;;;;;;;;;;;;;;;;;;"• 부드러운 광원 효과를 꺼 주세요. F8을 사용할 수 있습니다."
|
||||
|
||||
|
@@ -155,7 +155,7 @@
|
||||
"NAMESET_SCAN_M_150";"Thomas";"토마스";
|
||||
"NAMESET_SCAN_M_151";"Tim";"팀";
|
||||
"NAMESET_SCAN_M_152";"Tobias";"토비아스";
|
||||
"NAMESET_SCAN_M_153";"Tor";"토드";
|
||||
"NAMESET_SCAN_M_153";"Tor";"토르";
|
||||
"NAMESET_SCAN_M_154";"Truls";"트룰스";
|
||||
"NAMESET_SCAN_M_155";"Ulrik";"울프릭";
|
||||
"NAMESET_SCAN_M_156";"Valdemar";"발데마르";
|
||||
|
||||
|
@@ -397,7 +397,7 @@
|
||||
"MENU_LABEL_MORE";"";"More";"Plus";"Más";"Mehr";"Altro";"Mais";"Mais";"Ещё";"Περισσότερα";"Daha Fazla";"Mere";"Mer";"Mer";"Meer";"Więcej";"Lisää";"詳細";"更多";"更多";"다른";"Více";"Több";"Mai multe";"แสดงมากขึ้น";"Още";"עוד"
|
||||
"MENU_LABEL_MUSIC";"";"Music";"Musique";"Música";"Musik";"Musica";"Música";"Música";"Музыка";"Μουσική";"Müzik";"Musik";"Musikk";"Musik";"Muziek";"Muzyka";"Musiikki";"音楽";"音乐";"音樂";"음악";"Hudba";"Zene";"Muzică";"เพลง";"Музика";"מוזיקה"
|
||||
"MENU_LABEL_MUSIC_PLAYER";"";"Music Player";"Lecteur de musique";"Reproductor de música";"Musikspieler";"Lettore musicale";"Reprodutor de Música";"Leitor de Música";"Музыкальный плеер";"Music Player";"Müzik Oynatıcı";"Musikafspiller";"Musikkspiller";"Musikspelare";"Muziekspeler";"Odtwarzacz Muzyki";"Musiikinsoitin";"音楽プレーヤー";"音乐播放器";"音樂播放器";"음악 재생기";"Hudební přehrávač";"Zene lejátszó";"Player muzical";"เครื่องมือเล่นเพลง";"Музикален плейър";"נגן מוזיקה"
|
||||
"MENU_LABEL_NEW_GAME";"";"New Game";"Nouvelle partie";"Juego nuevo";"Neues Spiel";"Nuova partita";"Novo Jogo";"Novo Jogo";"Новая игра";"Νέο παιχνίδι";"Yeni Oyun";"Nyt Spil";"Nytt Spill";"Nytt spel";"Nieuw spel";"Nowa Gra";"Uusi peli";"新しいゲーム";"新游戏";"新游戲";"새 게임";"Nová hra";"Új játék";"Joc nou";"เริ่มเกมใหม่";"Нова игра";"משחק חדש"
|
||||
"MENU_LABEL_NEW_GAME";"";"New Game";"Nouvelle partie";"Juego nuevo";"Neues Spiel";"Nuova partita";"Novo Jogo";"Novo Jogo";"Новая игра";"Νέο παιχνίδι";"Yeni Oyun";"Nyt Spil";"Nytt Spill";"Nytt spel";"Nieuw spel";"Nowa Gra";"Uusi peli";"新しいゲーム";"新游戏";"新游戲";"새 게임";"Nová hra";"Új játék";"Joc nou";"เริ่มเกมใหม่";"Нова игра";"משחק חדש";"あたらしいゲーム";Nýr leikur"
|
||||
"MENU_LABEL_NEXT";"";"Next";"Suivant";"Siguiente";"Weiter";"Avanti";"Próximo";"Próximo";"След.";"Επόμενο";"Sonraki";"Næste";"Neste";"Nästa";"Volgende";"Dalej";"Seuraava";"次へ";"下一个";"下一個";"다음";"Další";"Következő";"Următorul";"ต่อไป";"Нататък";"הבא"
|
||||
"MENU_LABEL_NEXT_TRACK";"Next music track/song";"Next track";"Piste suivante";"Siguiente canción";"Nächster Titel";"Traccia successiva";"Próxima música";"Próxima música";"След. трек";"Επόμενο κομμάτι";"Sonraki parça";"Næste nummer";"Neste spor";"Nästa låt";"Volgend nummer";"Nastepny utwór";"Seuraava kappale";"次の曲";"下一个曲目";"下一個曲目";"다음 곡";"Další skladba";"Következő dal";"Melodia următoare";"เพลงต่อไป";"Следваща песен";"שיר הבא"
|
||||
"MENU_LABEL_NO";"";"No";"Non";"No";"Nein";"No";"Não";"Não";"Нет";"Όχι";"Hayır";"Nej";"Nei";"Nej";"Nee";"Nie";"Ei";"いいえ";"否";"否";"아니요";"Ne";"Nem";"Nu";"ไม่ใช่่";"Не";"לא";"いいえ";"Nei"
|
||||
@@ -433,7 +433,7 @@
|
||||
"MENU_LABEL_VOICES";"";"Voices";"Voix";"Voces";"Stimmen";"Voci";"Vozes";"Vozes";"Голоса";"Ομιλία";"Konuşmalar";"Stemmer";"Stemmer";"Röster";"Stemmen";"Mowa";"Äänet";"ボイス";"声音";"聲音";"음성";"Hlasy";"Párbeszédek";"Voce";"เสียงพูด";"Говор";"קולות"
|
||||
"MENU_LABEL_WARNING";"";"Warning";"Avertissement";"Aviso";"Warnung";"Attenzione";"Aviso";"Aviso";"Внимание!";"Προειδοποίηση";"Uyarı";"Advarsel";"Advarsel";"Varning";"Waarschuwing";"Uwaga";"Varoitus";"警告";"注意";"注意";"경고";"Upozornění";"Figyelem!";"Atenție!";"คำเตือน";"Внимание";"אזהרה"
|
||||
"MENU_LABEL_WELCOME";"";"Welcome";"Bienvenue";"Bienvenido";"Willkommen";"Benvenuto";"Bem vindo";"Bem-vindo";"Добро пожаловать";"Καλωσήρθατε";"Hoşgeldiniz";"Velkommen";"Velkommen";"Välkommen";"Welkom";"Witaj";"Tervetuloa";"ようこそ";"欢迎";"歡迎";"환영합니다";"Vítejte";"Üdvözölünk";"Bine ai venit";"ยินดีต้อนรับ";"Привет";"שלום"
|
||||
"MENU_LABEL_WORLD";"";"World";"Monde";"Mundo";"Welt";"Mondo";"Mundo";"Mundo";"Мир";"Κόσμος";"Dünya";"Verden";"Verden";"Värld";"Wereld";"Świat";"Maailma";"ワールド";"世界";"世界";"세계";"Svět";"Világ";"Lume";"โลก";"Свят";"עולם"
|
||||
"MENU_LABEL_WORLD";"";"World";"Monde";"Mundo";"Welt";"Mondo";"Mundo";"Mundo";"Мир";"Κόσμος";"Dünya";"Verden";"Verden";"Värld";"Wereld";"Świat";"Maailma";"ワールド";"世界";"世界";"세계";"Svět";"Világ";"Lume";"โลก";"Свят";"עולם";"せかい";"Heimur"
|
||||
"MENU_LABEL_YEAH";"A more casual 'yes'";"Yeah";"Ouais";"Seh";"Jo";"Si";"Uhum";"Sim";"Ага";"Ναι";"Hee";"Jah";"Ja";"Japp";"Jup";"Tak";"Joo";"いいよ";"好的";"好的";"응";"Jistě";"Ja";"Dap";"ใช่";"Аха";"בסדר"
|
||||
"MENU_LABEL_YES";"";"Yes";"Oui";"Sí";"Ja";"Sì";"Sim";"Sim";"Да";"Ναι";"Evet";"Ja";"Ja";"Ja";"Ja";"Tak";"Kyllä";"はい";"是";"是";"예";"Ano";"Igen";"Da";"ใช่";"Да";"כן";"はい";"Já"
|
||||
"MENU_LABEL_YES_CAPS";"";"YES";"OUI";"SÍ";"JA";"SI";"SIM";"SIM";"ДА";"ΝΑΙ";"EVET";"JA";"JA";"JA";"JA";"TAK";"KYLLÄ";"はい";"是";"是";"예";"ANO";"IGEN";"DA";"ใช่";"ДА";"כן";"はい";"JÁ"
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 191 and column 97.
|
@@ -1,4 +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 þú spilar."
|
||||
"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_MSG";;"All rights reserved.";"Tous les droits sont réservés.";;;;;;;;;;;;;;;"全著作権所有。";;;"모든 권리 보유.";;;;;;;"ぜん ちょさくけん しょゆう。";"Allur réttur á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"
|
||||
|
||||
|
@@ -5,20 +5,18 @@
|
||||
"basemass" : 60.0,
|
||||
|
||||
"strength" : 1000,
|
||||
"strengthvariable" : [100,100,100,100,100,100,100],
|
||||
"strengthmult" : [100,100,100,100,100,100,100],
|
||||
|
||||
"accel" : 0.32,
|
||||
|
||||
"speed" : 3.0,
|
||||
"speedvariable" : [100,100,100,100,100,100,100],
|
||||
"speedmult" : [100,100,100,100,100,100,100],
|
||||
|
||||
"jumppower" : 5,
|
||||
"jumppowervariable" : [100,100,100,100,100,100,100],
|
||||
"jumppowermult" : [100,100,100,100,100,100,100],
|
||||
|
||||
"scale" : 1,
|
||||
"scalevariable" : [100,100,100,100,100,100,100],
|
||||
|
||||
"physiquemult" : [100,100,100,100,100,100,100],
|
||||
"scalemult" : [100,100,100,100,100,100,100],
|
||||
|
||||
"encumbrance" : 1000,
|
||||
"basedefence" : "work in progress",
|
||||
|
||||
@@ -15,9 +15,7 @@ speed : walk speed. [px / TARGET_FPS]
|
||||
jumppower : self-explanatory. [-px / TARGET_FPS^2]
|
||||
scale : creature body scale. Mass/strength/accel/etc. will be changed accordingly, hence the prefix “base” for some raw tokens.
|
||||
|
||||
-variable : variability factor. [array of percentiles]
|
||||
|
||||
physiquemult : variable scale. Used for wild creatures ONLY.
|
||||
-mass : variability factor. [array of percentiles]
|
||||
|
||||
encumbrance : capacity of carrying. [kg]
|
||||
basedefence : base defence value of body. Sterner body material == higher value
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald
|
||||
package com.torvald
|
||||
|
||||
import org.apache.commons.csv.CSVFormat
|
||||
import org.apache.commons.csv.CSVParser
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.ColourUtil
|
||||
package com.torvald.colourutil
|
||||
|
||||
import org.newdawn.slick.Color
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.ColourUtil
|
||||
package com.torvald.colourutil
|
||||
|
||||
import org.newdawn.slick.Color
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.ColourUtil
|
||||
package com.torvald.colourutil
|
||||
|
||||
import org.newdawn.slick.Color
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.ColourUtil
|
||||
package com.torvald.colourutil
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-10.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.ColourUtil
|
||||
package com.torvald.colourutil
|
||||
|
||||
import com.jme3.math.FastMath
|
||||
import org.newdawn.slick.Color
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.ColourUtil
|
||||
package com.torvald.colourutil
|
||||
|
||||
import org.newdawn.slick.Color
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.Torvald.ImageFont
|
||||
package com.torvald.imagefont
|
||||
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.torvald.terrarum.Terrarum
|
||||
import org.lwjgl.opengl.GL11
|
||||
import org.newdawn.slick.*
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.Torvald.ImageFont
|
||||
package com.torvald.imagefont
|
||||
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.torvald.terrarum.Terrarum
|
||||
import org.newdawn.slick.*
|
||||
|
||||
/**
|
||||
@@ -29,7 +29,7 @@ constructor() : GameFontBase() {
|
||||
"./res/graphics/fonts/cjkpunct.png", GameFontBase.W_CJK, GameFontBase.H_KANA)
|
||||
/*uniHan = new SpriteSheet(
|
||||
"./res/graphics/fonts/unifont_unihan"
|
||||
+ ((!Terrarum.gameLocale.contains("zh"))
|
||||
+ ((!terrarum.gameLocale.contains("zh"))
|
||||
? "_ja" : "")
|
||||
+".png"
|
||||
, W_UNIHAN, H_UNIHAN
|
||||
@@ -70,7 +70,7 @@ constructor() : GameFontBase() {
|
||||
override fun reloadUnihan() {
|
||||
/*uniHan = new SpriteSheet(
|
||||
"./res/graphics/fonts/unifont_unihan"
|
||||
+ ((!Terrarum.gameLocale.contains("zh"))
|
||||
+ ((!terrarum.gameLocale.contains("zh"))
|
||||
? "_ja" : "")
|
||||
+".png"
|
||||
, W_UNIHAN, H_UNIHAN
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald
|
||||
package com.torvald
|
||||
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.JsonParser
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald
|
||||
package com.torvald
|
||||
|
||||
import com.google.gson.Gson
|
||||
import com.google.gson.JsonElement
|
||||
@@ -13,7 +13,7 @@ import java.io.IOException
|
||||
object JsonWriter {
|
||||
|
||||
/**
|
||||
* Serialise a class to the file as JSON, using Google GSON.
|
||||
* serialise a class to the file as JSON, using Google GSON.
|
||||
*
|
||||
* @param c: a class
|
||||
* @param path: path to write a file
|
||||
@@ -28,7 +28,7 @@ object JsonWriter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialise JsonObject to the file as JSON, using Google GSON.
|
||||
* serialise JsonObject to the file as JSON, using Google GSON.
|
||||
*
|
||||
* @param jsonObject
|
||||
* @param path: path to write a file
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Point
|
||||
package com.torvald.point
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-15.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.Torvald
|
||||
package com.torvald
|
||||
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.torvald.terrarum.Terrarum
|
||||
|
||||
import javax.imageio.ImageIO
|
||||
import java.awt.*
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.Torvald.Serialise
|
||||
package com.torvald.serialise
|
||||
|
||||
import com.Torvald.CSVFetcher
|
||||
import com.Torvald.Terrarum.ItemProperties.ItemPropCodex
|
||||
import com.Torvald.Terrarum.ItemProperties.MaterialPropCodex
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.Torvald.Terrarum.TileProperties.TilePropCodex
|
||||
import com.torvald.CSVFetcher
|
||||
import com.torvald.terrarum.itemproperties.ItemPropCodex
|
||||
import com.torvald.terrarum.itemproperties.MaterialPropCodex
|
||||
import com.torvald.terrarum.Terrarum
|
||||
import com.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import java.io.IOException
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.Torvald.Serialise
|
||||
package com.torvald.serialise
|
||||
|
||||
import com.Torvald.Terrarum.GameMap.GameMap
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.torvald.terrarum.gamemap.GameMap
|
||||
import com.torvald.terrarum.Terrarum
|
||||
import java.io.IOException
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.Torvald.Serialise
|
||||
package com.torvald.serialise
|
||||
|
||||
import com.Torvald.Terrarum.MapGenerator.MapGenerator
|
||||
import com.Torvald.Terrarum.MapGenerator.RoguelikeRandomiser
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.Torvald.Terrarum.TileProperties.TilePropCodex
|
||||
import com.torvald.terrarum.mapgenerator.MapGenerator
|
||||
import com.torvald.terrarum.mapgenerator.RoguelikeRandomiser
|
||||
import com.torvald.terrarum.Terrarum
|
||||
import com.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import org.apache.commons.codec.digest.DigestUtils
|
||||
import java.io.FileInputStream
|
||||
import java.io.File
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.SimpleCipher
|
||||
package com.torvald.simplecipher
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-20.
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import org.newdawn.slick.GameContainer;
|
||||
import org.newdawn.slick.Graphics;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 15-12-31.
|
||||
*/
|
||||
public interface Actor {
|
||||
|
||||
void update(GameContainer gc, int delta_t);
|
||||
|
||||
/**
|
||||
* Valid RefID is equal to or greater than 32768.
|
||||
* @return Reference ID. (32768-0x7FFF_FFFF_FFFF_FFFF)
|
||||
*/
|
||||
long getRefID();
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import com.Torvald.Terrarum.GameItem.InventoryItem;
|
||||
import com.Torvald.Terrarum.GameItem.ItemCodex;
|
||||
import com.Torvald.Terrarum.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-15.
|
||||
*/
|
||||
public class ActorInventory {
|
||||
|
||||
private @Nullable int capacityByCount;
|
||||
private @Nullable int capacityByWeight;
|
||||
private int capacityMode;
|
||||
|
||||
/**
|
||||
* <ReferenceID, Amounts>
|
||||
*/
|
||||
private HashMap<Long, Integer> itemList;
|
||||
|
||||
public transient final int CAPACITY_MODE_COUNT = 1;
|
||||
public transient final int CAPACITY_MODE_WEIGHT = 2;
|
||||
|
||||
/**
|
||||
* Construct new inventory with specified capacity.
|
||||
* @param capacity if is_weight is true, killogramme value is required, counts of items otherwise.
|
||||
* @param is_weight whether encumbrance should be calculated upon the weight of the inventory. False to use item counts.
|
||||
*/
|
||||
public ActorInventory(int capacity, boolean is_weight) {
|
||||
if (is_weight) {
|
||||
capacityByWeight = capacity;
|
||||
capacityMode = CAPACITY_MODE_WEIGHT;
|
||||
}
|
||||
else{
|
||||
capacityByCount = capacity;
|
||||
capacityMode = CAPACITY_MODE_COUNT;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get capacity of inventory
|
||||
* @return
|
||||
*/
|
||||
public int getCapacity() {
|
||||
if (capacityMode == CAPACITY_MODE_WEIGHT) {
|
||||
return capacityByWeight;
|
||||
}
|
||||
else {
|
||||
return capacityByCount;
|
||||
}
|
||||
}
|
||||
|
||||
public int getCapacityMode() {
|
||||
return capacityMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get reference to the itemList
|
||||
* @return
|
||||
*/
|
||||
public Map<Long, Integer> getItemList() {
|
||||
return itemList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get clone of the itemList
|
||||
* @return
|
||||
*/
|
||||
public Map getCopyOfItemList() {
|
||||
return (Map) (itemList.clone());
|
||||
}
|
||||
|
||||
public float getTotalWeight() {
|
||||
float weight = 0;
|
||||
|
||||
for (Map.Entry<Long, Integer> item : itemList.entrySet()) {
|
||||
weight += ItemCodex.getItem(item.getKey()).getWeight()
|
||||
* item.getValue();
|
||||
}
|
||||
|
||||
return weight;
|
||||
}
|
||||
|
||||
public int getTotalCount() {
|
||||
int count = 0;
|
||||
|
||||
for (Map.Entry<Long, Integer> item : itemList.entrySet()) {
|
||||
count += item.getValue();
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public int getTotalUniqueCount() {
|
||||
return itemList.entrySet().size();
|
||||
}
|
||||
|
||||
public void appendToPocket(InventoryItem item) {
|
||||
appendToPocket(item, 1);
|
||||
}
|
||||
|
||||
public void appendToPocket(InventoryItem item, int count) {
|
||||
long key = item.getItemID();
|
||||
|
||||
// if (key == Player.PLAYER_REF_ID)
|
||||
// throw new IllegalArgumentException("Attempted to put player into the inventory.");
|
||||
|
||||
if (itemList.containsKey(key))
|
||||
// increment amount if it already has specified item
|
||||
itemList.put(key, itemList.get(key) + count);
|
||||
else
|
||||
// add new entry if it does not have specified item
|
||||
itemList.put(key, count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the itemList contains too many items
|
||||
* @return
|
||||
*/
|
||||
public boolean isEncumbered() {
|
||||
if (getCapacityMode() == CAPACITY_MODE_WEIGHT) {
|
||||
return (capacityByWeight < getTotalWeight());
|
||||
}
|
||||
else if (getCapacityMode() == CAPACITY_MODE_COUNT) {
|
||||
return (capacityByCount < getTotalWeight());
|
||||
}
|
||||
else {
|
||||
throw new UnsupportedOperationException("capacity mode not valid.");
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,20 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import com.Torvald.Terrarum.GameItem.InventoryItem;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-31.
|
||||
*/
|
||||
public interface CanBeStoredAsItem {
|
||||
|
||||
void attachItemData();
|
||||
|
||||
float getItemWeight();
|
||||
|
||||
void stopUpdateAndDraw();
|
||||
|
||||
void resumeUpdateAndDraw();
|
||||
|
||||
InventoryItem getItemData();
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import com.Torvald.spriteAnimation.SpriteAnimation;
|
||||
import org.newdawn.slick.GameContainer;
|
||||
import org.newdawn.slick.Graphics;
|
||||
import org.newdawn.slick.Input;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 15-12-31.
|
||||
*/
|
||||
public interface Controllable {
|
||||
|
||||
void processInput(Input input);
|
||||
|
||||
void keyPressed(int key, char c);
|
||||
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import com.Torvald.JsonFetcher;
|
||||
import com.Torvald.Rand.Fudge3;
|
||||
import com.Torvald.Rand.HQRNG;
|
||||
import com.Torvald.Terrarum.LangPack.Lang;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.newdawn.slick.SlickException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-02-05.
|
||||
*/
|
||||
public class CreatureFactory {
|
||||
|
||||
private static final String JSONPATH = "./res/raw/";
|
||||
|
||||
public ActorWithBody build(String jsonFileName) throws IOException, SlickException {
|
||||
JsonObject jsonObj = JsonFetcher.readJson(JSONPATH + jsonFileName);
|
||||
ActorWithBody actor = new ActorWithBody();
|
||||
|
||||
|
||||
String[] elementsString = {
|
||||
"racename"
|
||||
, "racenameplural"
|
||||
};
|
||||
|
||||
String[] elementsFloat = {
|
||||
"baseheight"
|
||||
, "basemass"
|
||||
, "accel"
|
||||
, "toolsize"
|
||||
, "encumbrance"
|
||||
};
|
||||
|
||||
String[] elementsFloatVariable = {
|
||||
"strength"
|
||||
, "speed"
|
||||
, "jumppower"
|
||||
, "scale"
|
||||
, "speed"
|
||||
};
|
||||
|
||||
String[] elementsBoolean = {
|
||||
"intelligent"
|
||||
};
|
||||
|
||||
String[] elementsMultiplyFromOne = {
|
||||
"physiquemult"
|
||||
};
|
||||
|
||||
|
||||
setAVStrings(actor, elementsString, jsonObj);
|
||||
setAVFloats(actor, elementsFloat, jsonObj);
|
||||
setAVFloatsVariable(actor, elementsFloatVariable, jsonObj);
|
||||
setAVMultiplyFromOne(actor, elementsMultiplyFromOne, jsonObj);
|
||||
setAVBooleans(actor, elementsBoolean, jsonObj);
|
||||
|
||||
actor.actorValue.set("accel", Player.WALK_ACCEL_BASE);
|
||||
actor.actorValue.set("accelmult", 1f);
|
||||
|
||||
actor.inventory = new ActorInventory((int) actor.actorValue.get("encumberance"), true);
|
||||
|
||||
return actor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and set actor values that have 'variable' appended. E.g. strength
|
||||
* @param p
|
||||
* @param elemSet
|
||||
* @param jsonObject
|
||||
*/
|
||||
private void setAVFloatsVariable(ActorWithBody p, String[] elemSet, JsonObject jsonObject) {
|
||||
for (String s : elemSet) {
|
||||
float baseValue = jsonObject.get(s).getAsFloat();
|
||||
// roll fudge dice and get value [-3, 3] as [0, 6]
|
||||
int varSelected = new Fudge3(new HQRNG()).rollForArray();
|
||||
// get multiplier from json. Assuming percentile
|
||||
int multiplier = jsonObject.get(s + "variable").getAsJsonArray().get(varSelected).getAsInt();
|
||||
float realValue = baseValue * multiplier / 100f;
|
||||
|
||||
p.actorValue.set(s, realValue);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and set string actor values
|
||||
* @param p
|
||||
* @param elemSet
|
||||
* @param jsonObject
|
||||
*/
|
||||
private void setAVStrings(ActorWithBody p, String[] elemSet, JsonObject jsonObject) {
|
||||
for (String s : elemSet) {
|
||||
String key = jsonObject.get(s).getAsString();
|
||||
p.actorValue.set(s, Lang.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and set float actor values
|
||||
* @param p
|
||||
* @param elemSet
|
||||
* @param jsonObject
|
||||
*/
|
||||
private void setAVFloats(ActorWithBody p, String[] elemSet, JsonObject jsonObject) {
|
||||
for (String s : elemSet) {
|
||||
p.actorValue.set(s, jsonObject.get(s).getAsFloat());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and set actor values that should multiplier be applied to the base value of 1.
|
||||
* E.g. physiquemult
|
||||
* @param p
|
||||
* @param elemSet
|
||||
* @param jsonObject
|
||||
*/
|
||||
private void setAVMultiplyFromOne(ActorWithBody p, String[] elemSet, JsonObject jsonObject) {
|
||||
for (String s : elemSet) {
|
||||
float baseValue = 1f;
|
||||
// roll fudge dice and get value [-3, 3] as [0, 6]
|
||||
int varSelected = new Fudge3(new HQRNG()).rollForArray();
|
||||
// get multiplier from json. Assuming percentile
|
||||
int multiplier = jsonObject.get(s).getAsJsonArray().get(varSelected).getAsInt();
|
||||
float realValue = baseValue * multiplier / 100f;
|
||||
|
||||
p.actorValue.set(s, realValue);
|
||||
}
|
||||
}
|
||||
|
||||
private void setAVBooleans(ActorWithBody p, String[] elemSet, JsonObject jsonObject) {
|
||||
for (String s : elemSet) {
|
||||
p.actorValue.set(s, jsonObject.get(s).getAsBoolean());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import com.Torvald.spriteAnimation.SpriteAnimation;
|
||||
import com.sun.istack.internal.NotNull;
|
||||
import org.newdawn.slick.GameContainer;
|
||||
import org.newdawn.slick.Graphics;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-03.
|
||||
*/
|
||||
public class ItemTangible extends ActorWithBody {
|
||||
|
||||
@NotNull private float mass;
|
||||
|
||||
public ItemTangible() {
|
||||
super.setVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(GameContainer gc, int delta_t) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBody(GameContainer gc, Graphics g) {
|
||||
super.drawBody(gc, g);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import com.Torvald.Terrarum.Actors.Faction.Faction;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-02-15.
|
||||
*/
|
||||
public interface Factionable {
|
||||
|
||||
void assignFaction(Faction f);
|
||||
void unassignFaction(Faction f);
|
||||
HashSet<Faction> getAssignedFactions();
|
||||
void clearFactionAssigning();
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import org.newdawn.slick.GameContainer;
|
||||
import org.newdawn.slick.Graphics;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-25.
|
||||
*/
|
||||
public interface Glowing {
|
||||
|
||||
void drawGlow(GameContainer gc, Graphics g);
|
||||
|
||||
void updateGlowSprite(GameContainer gc, int delta_t);
|
||||
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-02-20.
|
||||
*/
|
||||
public interface Landholder {
|
||||
|
||||
ArrayList<Integer> getHouseDesignation();
|
||||
void setHouseDesignation(ArrayList<Integer> list);
|
||||
void addHouseTile(int x, int y);
|
||||
void removeHouseTile(int x, int y);
|
||||
void clearHouseDesignation();
|
||||
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-02-19.
|
||||
*/
|
||||
public interface Luminous {
|
||||
|
||||
void setLuminance(char RGB);
|
||||
char getLuminance();
|
||||
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import com.Torvald.Terrarum.Actors.AI.ActorAI;
|
||||
import com.Torvald.Terrarum.Actors.Faction.Faction;
|
||||
import com.Torvald.Terrarum.GameItem.InventoryItem;
|
||||
import com.Torvald.Terrarum.Terrarum;
|
||||
import org.newdawn.slick.GameContainer;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-31.
|
||||
*/
|
||||
public class NPCIntelligentBase extends ActorWithBody implements AIControlled, Pocketed, CanBeStoredAsItem,
|
||||
Factionable, Landholder {
|
||||
|
||||
private InventoryItem itemData; // keep it for extendibility, like Carriers in SC1
|
||||
private transient ActorAI ai;
|
||||
private ActorInventory inventory;
|
||||
|
||||
private HashSet<Faction> factionSet = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Absolute tile index. index(x, y) = y * map.width + x <br />
|
||||
* The arraylist will be saved in JSON format with GSON.
|
||||
*/
|
||||
private ArrayList<Integer> houseTiles = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void assignFaction(Faction f) {
|
||||
factionSet.add(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unassignFaction(Faction f) {
|
||||
factionSet.remove(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<Faction> getAssignedFactions() {
|
||||
return factionSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearFactionAssigning() {
|
||||
factionSet.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachItemData() {
|
||||
itemData = new InventoryItem() {
|
||||
@Override
|
||||
public long getItemID() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void effectWhileInPocket(GameContainer gc, int delta_t) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void effectWhenPickedUp(GameContainer gc, int delta_t) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void primaryUse(GameContainer gc, int delta_t) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void secondaryUse(GameContainer gc, int delta_t) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void effectWhenThrownAway(GameContainer gc, int delta_t) {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getItemWeight() {
|
||||
return super.getMass();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<Integer> getHouseDesignation() {
|
||||
return houseTiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHouseDesignation(ArrayList<Integer> list) {
|
||||
houseTiles = list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addHouseTile(int x, int y) {
|
||||
houseTiles.add(Terrarum.game.map.width * y + x);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeHouseTile(int x, int y) {
|
||||
houseTiles.remove(new Integer(Terrarum.game.map.width * y + x));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearHouseDesignation() {
|
||||
houseTiles.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopUpdateAndDraw() {
|
||||
super.setUpdate(false);
|
||||
super.setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeUpdateAndDraw() {
|
||||
super.setUpdate(true);
|
||||
super.setVisible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryItem getItemData() {
|
||||
return itemData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActorInventory getInventory() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void overwriteInventory(ActorInventory inventory) {
|
||||
this.inventory = inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachAI(ActorAI ai) {
|
||||
this.ai = ai;
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import com.Torvald.JsonFetcher;
|
||||
import com.Torvald.Terrarum.Actors.Faction.Faction;
|
||||
import com.Torvald.Terrarum.Game;
|
||||
import com.Torvald.spriteAnimation.SpriteAnimation;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.lwjgl.Sys;
|
||||
import org.newdawn.slick.SlickException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-02-03.
|
||||
*/
|
||||
public class PFSigrid {
|
||||
|
||||
private static String FACTION_PATH = "./res/raw/";
|
||||
|
||||
public Player build() throws SlickException {
|
||||
Player p = new Player();
|
||||
|
||||
p.sprite = new SpriteAnimation();
|
||||
p.sprite.setDimension(28, 51);
|
||||
p.sprite.setSpriteImage("res/graphics/sprites/test_player.png");
|
||||
p.sprite.setDelay(200);
|
||||
p.sprite.setRowsAndFrames(1, 1);
|
||||
p.sprite.setAsVisible();
|
||||
p.sprite.composeSprite();
|
||||
|
||||
p.spriteGlow = new SpriteAnimation();
|
||||
p.spriteGlow.setDimension(28, 51);
|
||||
p.spriteGlow.setSpriteImage("res/graphics/sprites/test_player_glow.png");
|
||||
p.spriteGlow.setDelay(200);
|
||||
p.spriteGlow.setRowsAndFrames(1, 1);
|
||||
p.spriteGlow.setAsVisible();
|
||||
p.spriteGlow.composeSprite();
|
||||
|
||||
p.actorValue = new ActorValue();
|
||||
p.actorValue.set("scale", 1.0f);
|
||||
p.actorValue.set("speed", 4.0f);
|
||||
p.actorValue.set("speedmult", 1.0f);
|
||||
p.actorValue.set("accel", Player.WALK_ACCEL_BASE);
|
||||
p.actorValue.set("accelmult", 1.0f);
|
||||
|
||||
p.actorValue.set("jumppower", 5f);
|
||||
|
||||
p.actorValue.set("basemass", 80f);
|
||||
|
||||
p.actorValue.set("physiquemult", 1); // Constant 1.0 for player, meant to be used by random mobs
|
||||
/**
|
||||
* fixed value, or 'base value', from creature strength of Dwarf Fortress.
|
||||
* Human race uses 1000. (see CreatureHuman.json)
|
||||
*/
|
||||
p.actorValue.set("strength", 1414);
|
||||
p.actorValue.set("encumbrance", 1000);
|
||||
|
||||
p.actorValue.set("name", "Sigrid");
|
||||
|
||||
p.actorValue.set("intelligent", true);
|
||||
|
||||
p.actorValue.set("luminosity", 22819);
|
||||
|
||||
p.actorValue.set("selectedtile", 16);
|
||||
|
||||
p.setHitboxDimension(18, 46, 8, 0);
|
||||
|
||||
p.setInventory(new ActorInventory(0x7FFFFFFF, true));
|
||||
|
||||
p.setPosition(4096 * 16, 300 * 16);
|
||||
|
||||
p.assignFaction(loadFactioningData("FactionSigrid.json"));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
private Faction loadFactioningData(String filename) {
|
||||
JsonObject jsonObject = null;
|
||||
try {
|
||||
jsonObject = JsonFetcher.readJson(FACTION_PATH + filename);
|
||||
}
|
||||
catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
Faction faction = new Faction(jsonObject.get("factionname").getAsString());
|
||||
|
||||
jsonObject.get("factionamicable").getAsJsonArray().forEach(
|
||||
jobj -> faction.addFactionAmicable(jobj.getAsString())
|
||||
);
|
||||
jsonObject.get("factionneutral").getAsJsonArray().forEach(
|
||||
jobj -> faction.addFactionNeutral(jobj.getAsString())
|
||||
);
|
||||
jsonObject.get("factionhostile").getAsJsonArray().forEach(
|
||||
jobj -> faction.addFactionHostile(jobj.getAsString())
|
||||
);
|
||||
jsonObject.get("factionfearful").getAsJsonArray().forEach(
|
||||
jobj -> faction.addFactionFearful(jobj.getAsString())
|
||||
);
|
||||
|
||||
return faction;
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import org.newdawn.slick.Color;
|
||||
import org.newdawn.slick.GameContainer;
|
||||
import org.newdawn.slick.Graphics;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-05.
|
||||
*/
|
||||
public class PhysTestBall extends ActorWithBody {
|
||||
|
||||
public PhysTestBall() {
|
||||
super();
|
||||
setHitboxDimension(16, 16, 0, 0);
|
||||
setVisible(true);
|
||||
setMass(10f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBody(GameContainer gc, Graphics g) {
|
||||
g.setColor(Color.orange);
|
||||
g.fillOval(
|
||||
getHitbox().getPosX()
|
||||
, getHitbox().getPosY()
|
||||
, getHitbox().getWidth()
|
||||
, getHitbox().getHeight()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,571 +0,0 @@
|
||||
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.MapDrawer;
|
||||
import com.Torvald.Terrarum.Terrarum;
|
||||
import com.Torvald.spriteAnimation.SpriteAnimation;
|
||||
import com.jme3.math.FastMath;
|
||||
import com.sun.istack.internal.NotNull;
|
||||
import com.sun.istack.internal.Nullable;
|
||||
import org.lwjgl.input.Controller;
|
||||
import org.lwjgl.input.Controllers;
|
||||
import org.newdawn.slick.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 15-12-31.
|
||||
*/
|
||||
public class Player extends ActorWithBody implements Controllable, Pocketed, Factionable, Luminous {
|
||||
|
||||
public transient @Nullable Controllable vehicleRiding;
|
||||
|
||||
int jumpCounter = 0;
|
||||
int walkPowerCounter = 0;
|
||||
private transient final int MAX_JUMP_LENGTH = 17; // use 17; in internal frames
|
||||
/**
|
||||
* experimental value.
|
||||
*/
|
||||
// private transient final float JUMP_ACCELERATION_MOD = ???f / 10000f; //quadratic mode
|
||||
private transient final float JUMP_ACCELERATION_MOD = 170f / 10000f; //linear mode
|
||||
private transient final int WALK_FRAMES_TO_MAX_ACCEL = 6;
|
||||
|
||||
public float readonly_totalX = 0, readonly_totalY = 0;
|
||||
|
||||
boolean jumping = false;
|
||||
|
||||
@NotNull int walkHeading;
|
||||
|
||||
private transient final int LEFT = 1;
|
||||
private transient final int RIGHT = 2;
|
||||
|
||||
private transient final int KEY_NULL = -1;
|
||||
private transient int prevHMoveKey = KEY_NULL;
|
||||
private transient int prevVMoveKey = KEY_NULL;
|
||||
|
||||
static transient final float ACCEL_MULT_IN_FLIGHT = 0.48f;
|
||||
static transient final float WALK_STOP_ACCEL = 0.32f;
|
||||
static transient final float WALK_ACCEL_BASE = 0.32f;
|
||||
|
||||
private boolean noClip = false;
|
||||
|
||||
public static transient final long PLAYER_REF_ID = 0x51621D;
|
||||
|
||||
private transient final float AXIS_POSMAX = 1.0f;
|
||||
private transient final int GAMEPAD_JUMP = 5;
|
||||
|
||||
private transient final int TSIZE = MapDrawer.TILE_SIZE;
|
||||
|
||||
private HashSet<Faction> factionSet = new HashSet<>();
|
||||
|
||||
private transient final int BASE_DENSITY = 1020;
|
||||
|
||||
|
||||
/**
|
||||
* Creates new Player instance with empty elements (sprites, actorvalue, etc.). <br />
|
||||
*
|
||||
* <strong>Use PlayerBuildFactory to build player!</strong>
|
||||
*
|
||||
* @throws SlickException
|
||||
*/
|
||||
public Player() throws SlickException {
|
||||
super();
|
||||
referenceID = PLAYER_REF_ID;
|
||||
setVisible(true);
|
||||
super.setDensity(BASE_DENSITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(GameContainer gc, int delta_t) {
|
||||
if (vehicleRiding instanceof Player) throw new RuntimeException("Attempted to 'ride' " +
|
||||
"player object.");
|
||||
|
||||
updatePhysicalInfos();
|
||||
super.update(gc, delta_t);
|
||||
|
||||
updateSprite(delta_t);
|
||||
|
||||
updateMovementControl();
|
||||
|
||||
if (noClip) { super.setGrounded(true); }
|
||||
|
||||
}
|
||||
|
||||
private void updatePhysicalInfos() {
|
||||
super.setScale(actorValue.getAsFloat("scale"));
|
||||
super.setMass(actorValue.getAsFloat("basemass")
|
||||
* FastMath.pow(super.getScale(), 3));
|
||||
if (super.getElasticity() != 0) super.setElasticity(0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param left (even if the game is joypad controlled, you must give valid value)
|
||||
* @param absAxisVal (set AXIS_POSMAX if keyboard controlled)
|
||||
*/
|
||||
private void walkHorizontal(boolean left, float absAxisVal) {
|
||||
//if ((!super.isWalledLeft() && left) || (!super.isWalledRight() && !left)) {
|
||||
readonly_totalX = super.getVeloX()
|
||||
+
|
||||
actorValue.getAsFloat("accel")
|
||||
* actorValue.getAsFloat("accelmult")
|
||||
* FastMath.sqrt(super.getScale())
|
||||
* applyAccelRealism(walkPowerCounter)
|
||||
* (left ? -1 : 1)
|
||||
* absAxisVal;
|
||||
|
||||
super.setVeloX(readonly_totalX);
|
||||
|
||||
if (walkPowerCounter < WALK_FRAMES_TO_MAX_ACCEL) {
|
||||
walkPowerCounter += 1;
|
||||
}
|
||||
|
||||
// Clamp veloX
|
||||
super.setVeloX(
|
||||
absClamp(super.getVeloX()
|
||||
, actorValue.getAsFloat("speed")
|
||||
* actorValue.getAsFloat("speedmult")
|
||||
* FastMath.sqrt(super.getScale())
|
||||
)
|
||||
);
|
||||
|
||||
// Heading flag
|
||||
if (left) walkHeading = LEFT;
|
||||
else walkHeading = RIGHT;
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param up (even if the game is joypad controlled, you must give valid value)
|
||||
* @param absAxisVal (set AXIS_POSMAX if keyboard controlled)
|
||||
*/
|
||||
private void walkVertical(boolean up, float absAxisVal) {
|
||||
readonly_totalY = super.getVeloY()
|
||||
+
|
||||
actorValue.getAsFloat("accel")
|
||||
* actorValue.getAsFloat("accelmult")
|
||||
* FastMath.sqrt(super.getScale())
|
||||
* applyAccelRealism(walkPowerCounter)
|
||||
* (up ? -1 : 1)
|
||||
* absAxisVal;
|
||||
|
||||
super.setVeloY(readonly_totalY);
|
||||
|
||||
if (walkPowerCounter < WALK_FRAMES_TO_MAX_ACCEL) {
|
||||
walkPowerCounter += 1;
|
||||
}
|
||||
|
||||
// Clamp veloX
|
||||
super.setVeloY(
|
||||
absClamp(super.getVeloY()
|
||||
, actorValue.getAsFloat("speed")
|
||||
* actorValue.getAsFloat("speedmult")
|
||||
* FastMath.sqrt(super.getScale())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* For realistic accelerating while walking.
|
||||
*
|
||||
* Naïve 'veloX += 3' is actually like:
|
||||
*
|
||||
* a
|
||||
* | ------------
|
||||
* |
|
||||
* |
|
||||
* 0+------············ t
|
||||
*
|
||||
* which is unrealistic, so this method tries to introduce some realism by doing:
|
||||
*
|
||||
* a
|
||||
* | ------------
|
||||
* | ---
|
||||
* | -
|
||||
* | ---
|
||||
* 0+----··················· t
|
||||
*
|
||||
*
|
||||
* @param x
|
||||
*/
|
||||
private float applyAccelRealism(int x) {
|
||||
return 0.5f + 0.5f * -FastMath.cos(10 * x / (WALK_FRAMES_TO_MAX_ACCEL * FastMath.PI));
|
||||
}
|
||||
|
||||
private void walkHStop() {
|
||||
if (super.getVeloX() > 0) {
|
||||
super.setVeloX(super.getVeloX()
|
||||
-
|
||||
actorValue.getAsFloat("accel")
|
||||
* actorValue.getAsFloat("accelmult")
|
||||
* FastMath.sqrt(super.getScale())
|
||||
);
|
||||
|
||||
// compensate overshoot
|
||||
if (super.getVeloX() < 0)
|
||||
super.setVeloX(0);
|
||||
}
|
||||
else if (super.getVeloX() < 0) {
|
||||
super.setVeloX(super.getVeloX()
|
||||
+
|
||||
actorValue.getAsFloat("accel")
|
||||
* actorValue.getAsFloat("accelmult")
|
||||
* FastMath.sqrt(super.getScale())
|
||||
);
|
||||
|
||||
// compensate overshoot
|
||||
if (super.getVeloX() > 0)
|
||||
super.setVeloX(0);
|
||||
}
|
||||
else {
|
||||
super.setVeloX(0);
|
||||
}
|
||||
|
||||
walkPowerCounter = 0;
|
||||
}
|
||||
|
||||
private void walkVStop() {
|
||||
if (super.getVeloY() > 0) {
|
||||
super.setVeloY(super.getVeloY()
|
||||
-
|
||||
WALK_STOP_ACCEL
|
||||
* actorValue.getAsFloat("accelmult")
|
||||
* FastMath.sqrt(super.getScale())
|
||||
);
|
||||
|
||||
// compensate overshoot
|
||||
if (super.getVeloY() < 0)
|
||||
super.setVeloY(0);
|
||||
}
|
||||
else if (super.getVeloY() < 0) {
|
||||
super.setVeloY(super.getVeloY()
|
||||
+
|
||||
WALK_STOP_ACCEL
|
||||
* actorValue.getAsFloat("accelmult")
|
||||
* FastMath.sqrt(super.getScale())
|
||||
);
|
||||
|
||||
// compensate overshoot
|
||||
if (super.getVeloY() > 0)
|
||||
super.setVeloY(0);
|
||||
}
|
||||
else {
|
||||
super.setVeloY(0);
|
||||
}
|
||||
|
||||
walkPowerCounter = 0;
|
||||
}
|
||||
|
||||
private void updateMovementControl() {
|
||||
if (!noClip) {
|
||||
if (super.isGrounded()) {
|
||||
actorValue.set("accelmult", 1f);
|
||||
} else {
|
||||
actorValue.set("accelmult", ACCEL_MULT_IN_FLIGHT);
|
||||
}
|
||||
}
|
||||
else {
|
||||
actorValue.set("accelmult", 1f);
|
||||
}
|
||||
}
|
||||
|
||||
public void processInput(Input input) {
|
||||
Controller gamepad = null;
|
||||
float axisX = 0, axisY = 0, axisRX = 0, axisRY = 0;
|
||||
if (Terrarum.hasController) {
|
||||
gamepad = Controllers.getController(0);
|
||||
axisX = gamepad.getAxisValue(0);
|
||||
axisY = gamepad.getAxisValue(1);
|
||||
axisRX = gamepad.getAxisValue(2);
|
||||
axisRY = gamepad.getAxisValue(3);
|
||||
|
||||
if (Math.abs(axisX) < Terrarum.CONTROLLER_DEADZONE) axisX = 0;
|
||||
if (Math.abs(axisY) < Terrarum.CONTROLLER_DEADZONE) axisY = 0;
|
||||
if (Math.abs(axisRX) < Terrarum.CONTROLLER_DEADZONE) axisRX = 0;
|
||||
if (Math.abs(axisRY) < Terrarum.CONTROLLER_DEADZONE) axisRY = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* L-R stop
|
||||
*/
|
||||
if (Terrarum.hasController) {
|
||||
if (axisX == 0) {
|
||||
walkHStop();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// ↑F, ↑S
|
||||
if (!isFuncDown(input, EnumKeyFunc.MOVE_LEFT)
|
||||
&& !isFuncDown(input, EnumKeyFunc.MOVE_RIGHT)) {
|
||||
walkHStop();
|
||||
prevHMoveKey = KEY_NULL;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* U-D stop
|
||||
*/
|
||||
if (Terrarum.hasController) {
|
||||
if (axisY == 0) {
|
||||
walkVStop();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// ↑E
|
||||
// ↑D
|
||||
if (isNoClip()
|
||||
&& !isFuncDown(input, EnumKeyFunc.MOVE_UP)
|
||||
&& !isFuncDown(input, EnumKeyFunc.MOVE_DOWN)) {
|
||||
walkVStop();
|
||||
prevVMoveKey = KEY_NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Left/Right movement
|
||||
*/
|
||||
|
||||
if (Terrarum.hasController) {
|
||||
if (axisX != 0) {
|
||||
walkHorizontal(axisX < 0, AXIS_POSMAX);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// ↑F, ↓S
|
||||
if (isFuncDown(input, EnumKeyFunc.MOVE_RIGHT)
|
||||
&& !isFuncDown(input, EnumKeyFunc.MOVE_LEFT)) {
|
||||
walkHorizontal(false, AXIS_POSMAX);
|
||||
prevHMoveKey = KeyMap.getKeyCode(EnumKeyFunc.MOVE_RIGHT);
|
||||
}
|
||||
// ↓F, ↑S
|
||||
else if (isFuncDown(input, EnumKeyFunc.MOVE_LEFT)
|
||||
&& !isFuncDown(input, EnumKeyFunc.MOVE_RIGHT)) {
|
||||
walkHorizontal(true, AXIS_POSMAX);
|
||||
prevHMoveKey = KeyMap.getKeyCode(EnumKeyFunc.MOVE_LEFT);
|
||||
}
|
||||
// ↓F, ↓S
|
||||
else if (isFuncDown(input, EnumKeyFunc.MOVE_LEFT)
|
||||
&& isFuncDown(input, EnumKeyFunc.MOVE_RIGHT)) {
|
||||
if (prevHMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_LEFT)) {
|
||||
walkHorizontal(false, AXIS_POSMAX);
|
||||
prevHMoveKey = KeyMap.getKeyCode(EnumKeyFunc.MOVE_RIGHT);
|
||||
}
|
||||
else if (prevHMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_RIGHT)) {
|
||||
walkHorizontal(true, AXIS_POSMAX);
|
||||
prevHMoveKey = KeyMap.getKeyCode(EnumKeyFunc.MOVE_LEFT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Up/Down movement
|
||||
*/
|
||||
if (noClip) {
|
||||
if (Terrarum.hasController) {
|
||||
if (axisY != 0) {
|
||||
walkVertical(axisY > 0, AXIS_POSMAX);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// ↑E
|
||||
// ↓D
|
||||
if (isFuncDown(input, EnumKeyFunc.MOVE_DOWN)
|
||||
&& !isFuncDown(input, EnumKeyFunc.MOVE_UP)) {
|
||||
walkVertical(false, AXIS_POSMAX);
|
||||
prevVMoveKey = KeyMap.getKeyCode(EnumKeyFunc.MOVE_DOWN);
|
||||
}
|
||||
// ↓E
|
||||
// ↑D
|
||||
else if (isFuncDown(input, EnumKeyFunc.MOVE_UP)
|
||||
&& !isFuncDown(input, EnumKeyFunc.MOVE_DOWN)) {
|
||||
walkVertical(true, AXIS_POSMAX);
|
||||
prevVMoveKey = KeyMap.getKeyCode(EnumKeyFunc.MOVE_UP);
|
||||
}
|
||||
// ↓E
|
||||
// ↓D
|
||||
else if (isFuncDown(input, EnumKeyFunc.MOVE_UP)
|
||||
&& isFuncDown(input, EnumKeyFunc.MOVE_DOWN)) {
|
||||
if (prevVMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_UP)) {
|
||||
walkVertical(false, AXIS_POSMAX);
|
||||
prevVMoveKey = KeyMap.getKeyCode(EnumKeyFunc.MOVE_DOWN);
|
||||
}
|
||||
else if (prevVMoveKey == KeyMap.getKeyCode(EnumKeyFunc.MOVE_DOWN)) {
|
||||
walkVertical(true, AXIS_POSMAX);
|
||||
prevVMoveKey = KeyMap.getKeyCode(EnumKeyFunc.MOVE_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Jump control
|
||||
*/
|
||||
if (isFuncDown(input, EnumKeyFunc.JUMP)
|
||||
|| (Terrarum.hasController && gamepad.isButtonPressed(GAMEPAD_JUMP))) {
|
||||
if (!noClip) {
|
||||
if (super.isGrounded()) {
|
||||
jumping = true;
|
||||
}
|
||||
jump();
|
||||
}
|
||||
else {
|
||||
walkVertical(true, AXIS_POSMAX);
|
||||
}
|
||||
}
|
||||
else {
|
||||
jumping = false;
|
||||
jumpCounter = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void keyPressed(int key, char c) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* See ./work_files/Jump\ power\ by\ pressing\ time.gcx
|
||||
*/
|
||||
private void jump() {
|
||||
if (jumping) {
|
||||
float len = MAX_JUMP_LENGTH;
|
||||
float pwr = actorValue.getAsFloat("jumppower");
|
||||
|
||||
// increment jump counter
|
||||
if (jumpCounter < len) jumpCounter += 1;
|
||||
// quadratic time (convex) mode
|
||||
/*
|
||||
float sumT = (jumpCounter * (jumpCounter + 1)) / 2f;
|
||||
float timedJumpCharge = ((len + 1) / 2f) - (sumT / len);
|
||||
if (timedJumpCharge < 0) timedJumpCharge = 0;
|
||||
|
||||
float jumpAcc = pwr * timedJumpCharge * JUMP_ACCELERATION_MOD;
|
||||
|
||||
super.setVeloY(super.getVeloY()
|
||||
- jumpAcc
|
||||
);
|
||||
*/
|
||||
|
||||
// linear time mode
|
||||
float init = (len + 1) / 2f;
|
||||
float timedJumpCharge = init - (init / len) * jumpCounter;
|
||||
if (timedJumpCharge < 0) timedJumpCharge = 0;
|
||||
|
||||
float jumpAcc = pwr * timedJumpCharge * JUMP_ACCELERATION_MOD
|
||||
* FastMath.sqrt(getScale());
|
||||
|
||||
super.setVeloY(super.getVeloY()
|
||||
- jumpAcc
|
||||
);
|
||||
|
||||
// concave mode?
|
||||
}
|
||||
|
||||
// for mob AI:
|
||||
//super.setVeloY(super.getVeloY()
|
||||
// -
|
||||
// pwr * FastMath.sqrt(super.getScale())
|
||||
//);
|
||||
}
|
||||
|
||||
private float jumpFuncLin(float pwr, float len) {
|
||||
return -(pwr / len) * jumpCounter;
|
||||
}
|
||||
|
||||
private float jumpFuncSqu(float pwr, float len) {
|
||||
return (pwr / (len * len))
|
||||
* (jumpCounter - len)
|
||||
* (jumpCounter - len) // square
|
||||
- pwr;
|
||||
}
|
||||
|
||||
private float jumpFuncExp(float pwr, float len) {
|
||||
float a = FastMath.pow(pwr + 1, 1 / len);
|
||||
return -FastMath.pow(a, len) + 1;
|
||||
}
|
||||
|
||||
private boolean isFuncDown(Input input, EnumKeyFunc fn) {
|
||||
return input.isKeyDown(KeyMap.getKeyCode(fn));
|
||||
}
|
||||
|
||||
private float absClamp(float i, float ceil) {
|
||||
if (i > 0)
|
||||
return (i > ceil) ? ceil : i;
|
||||
else if (i < 0)
|
||||
return (-i > ceil) ? -ceil : i;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void updateSprite(int delta_t) {
|
||||
sprite.update(delta_t);
|
||||
if (spriteGlow != null) {
|
||||
spriteGlow.update(delta_t);
|
||||
}
|
||||
|
||||
if (super.isGrounded()) {
|
||||
if (walkHeading == LEFT) {
|
||||
sprite.flip(true, false);
|
||||
if (spriteGlow != null) {
|
||||
spriteGlow.flip(true, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
sprite.flip(false, false);
|
||||
if (spriteGlow != null) {
|
||||
spriteGlow.flip(false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isNoClip() {
|
||||
return noClip;
|
||||
}
|
||||
|
||||
public void setNoClip(boolean b) {
|
||||
noClip = b;
|
||||
}
|
||||
|
||||
public ActorValue getActorValue() {
|
||||
return actorValue;
|
||||
}
|
||||
|
||||
public SpriteAnimation getSpriteGlow() {
|
||||
return spriteGlow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assignFaction(Faction f) {
|
||||
factionSet.add(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unassignFaction(Faction f) {
|
||||
factionSet.remove(f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HashSet<Faction> getAssignedFactions() {
|
||||
return factionSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearFactionAssigning() {
|
||||
factionSet.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLuminance(char RGB) {
|
||||
actorValue.set("luminosity", (int) RGB);
|
||||
}
|
||||
|
||||
@Override
|
||||
public char getLuminance() {
|
||||
return actorValue.hasKey("luminosity") ?
|
||||
(char) actorValue.getAsInt("luminosity") : 0;
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import com.Torvald.spriteAnimation.SpriteAnimation;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-14.
|
||||
*/
|
||||
public class PlayerDebugger {
|
||||
|
||||
private Actor actor;
|
||||
|
||||
public PlayerDebugger(Actor actor) {
|
||||
this.actor = actor;
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
if (actor instanceof Player) {
|
||||
return (Player) actor;
|
||||
}
|
||||
else {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delegates for Player instances
|
||||
*/
|
||||
|
||||
public float baseHitboxW() { return getPlayer().getBaseHitboxW(); }
|
||||
public float baseHitboxH() { return getPlayer().getBaseHitboxH(); }
|
||||
public float hitboxTranslateX() { return getPlayer().getHitboxTranslateX(); }
|
||||
public float hitboxTranslateY() { return getPlayer().getHitboxTranslateY(); }
|
||||
public float veloX() { return getPlayer().getVeloX(); }
|
||||
public float veloY() { return getPlayer().getVeloY(); }
|
||||
public int baseSpriteWidth() { return getPlayer().baseSpriteWidth; }
|
||||
public int baseSpriteHeight() { return getPlayer().baseSpriteHeight; }
|
||||
public SpriteAnimation sprite() { return getPlayer().sprite; }
|
||||
public float scale() { return getPlayer().getScale(); }
|
||||
public Hitbox hitbox() { return getPlayer().getHitbox(); }
|
||||
public Hitbox nextHitbox() { return getPlayer().getNextHitbox(); }
|
||||
public boolean grounded() { return getPlayer().getGrounded(); }
|
||||
public ActorValue actorValue() { return getPlayer().getActorValue(); }
|
||||
public float mass() { return getPlayer().getMass(); }
|
||||
public boolean noClip() { return getPlayer().isNoClip(); }
|
||||
public int eventMoving() { return getPlayer().eventMoving; }
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
|
||||
import org.newdawn.slick.SlickException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-02-03.
|
||||
*/
|
||||
public class PlayerFactory {
|
||||
|
||||
private static final String JSONPATH = "./res/raw/";
|
||||
private static String jsonString = new String();
|
||||
|
||||
public Player build(String jsonFileName) throws IOException, SlickException {
|
||||
Player p = (Player) (new CreatureFactory().build("CreatureHuman"));
|
||||
|
||||
// attach sprite
|
||||
|
||||
// do etc.
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import org.newdawn.slick.GameContainer;
|
||||
import org.newdawn.slick.Graphics;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-25.
|
||||
*/
|
||||
public interface Visible {
|
||||
|
||||
void drawBody(GameContainer gc, Graphics g);
|
||||
|
||||
void updateBodySprite(GameContainer gc, int delta_t);
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.Torvald.Terrarum.ConsoleCommand
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-22.
|
||||
*/
|
||||
class Help : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
Echo().execute(arrayOf(
|
||||
"echo",
|
||||
"Utility keys:",
|
||||
"F3: Basic debug information",
|
||||
"F7: Toggle lightmap blending",
|
||||
"F8: Toggle smooth lighting"
|
||||
))
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
Echo().execute("Prints some utility functions assigned to function row of the keyboard.")
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum
|
||||
package com.torvald.terrarum
|
||||
|
||||
import com.google.gson.JsonObject
|
||||
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
package com.Torvald.Terrarum
|
||||
package com.torvald.terrarum
|
||||
|
||||
import com.Torvald.Terrarum.Actors.*
|
||||
import com.Torvald.Terrarum.ConsoleCommand.Authenticator
|
||||
import com.Torvald.Terrarum.GameControl.GameController
|
||||
import com.Torvald.Terrarum.GameControl.Key
|
||||
import com.Torvald.Terrarum.GameControl.KeyMap
|
||||
import com.Torvald.Terrarum.GameControl.KeyToggler
|
||||
import com.Torvald.Terrarum.GameMap.GameMap
|
||||
import com.Torvald.Terrarum.GameMap.WorldTime
|
||||
import com.Torvald.Terrarum.MapDrawer.LightmapRenderer
|
||||
import com.Torvald.Terrarum.MapDrawer.MapCamera
|
||||
import com.Torvald.Terrarum.MapDrawer.MapDrawer
|
||||
import com.Torvald.Terrarum.MapGenerator.MapGenerator
|
||||
import com.Torvald.Terrarum.MapGenerator.RoguelikeRandomiser
|
||||
import com.Torvald.Terrarum.TileProperties.TilePropCodex
|
||||
import com.Torvald.Terrarum.TileStat.TileStat
|
||||
import com.Torvald.Terrarum.UserInterface.BasicDebugInfoWindow
|
||||
import com.Torvald.Terrarum.UserInterface.ConsoleWindow
|
||||
import com.Torvald.Terrarum.UserInterface.Notification
|
||||
import com.Torvald.Terrarum.UserInterface.UIHandler
|
||||
import com.torvald.terrarum.gameactors.*
|
||||
import com.torvald.terrarum.console.Authenticator
|
||||
import com.torvald.terrarum.gamecontroller.GameController
|
||||
import com.torvald.terrarum.gamecontroller.Key
|
||||
import com.torvald.terrarum.gamecontroller.KeyMap
|
||||
import com.torvald.terrarum.gamecontroller.KeyToggler
|
||||
import com.torvald.terrarum.gamemap.GameMap
|
||||
import com.torvald.terrarum.gamemap.WorldTime
|
||||
import com.torvald.terrarum.mapdrawer.LightmapRenderer
|
||||
import com.torvald.terrarum.mapdrawer.MapCamera
|
||||
import com.torvald.terrarum.mapdrawer.MapDrawer
|
||||
import com.torvald.terrarum.mapgenerator.MapGenerator
|
||||
import com.torvald.terrarum.mapgenerator.RoguelikeRandomiser
|
||||
import com.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import com.torvald.terrarum.tilestats.TileStat
|
||||
import com.torvald.terrarum.ui.BasicDebugInfoWindow
|
||||
import com.torvald.terrarum.ui.ConsoleWindow
|
||||
import com.torvald.terrarum.ui.Notification
|
||||
import com.torvald.terrarum.ui.UIHandler
|
||||
import com.jme3.math.FastMath
|
||||
import org.lwjgl.opengl.ARBShaderObjects
|
||||
import org.lwjgl.opengl.GL11
|
||||
@@ -101,7 +101,7 @@ constructor() : BasicGameState() {
|
||||
|
||||
MapGenerator.attachMap(map)
|
||||
MapGenerator.setSeed(0x51621D2)
|
||||
//MapGenerator.setSeed(new HQRNG().nextLong());
|
||||
//mapgenerator.setSeed(new HQRNG().nextLong());
|
||||
MapGenerator.generateMap()
|
||||
|
||||
RoguelikeRandomiser.setSeed(0x540198)
|
||||
@@ -109,8 +109,8 @@ constructor() : BasicGameState() {
|
||||
|
||||
|
||||
// add new player and put it to actorContainer
|
||||
//player = new Player();
|
||||
player = PFSigrid.build()
|
||||
//player = PFSigrid.build()
|
||||
player = PFCynthia.create()
|
||||
//player.setNoClip(true);
|
||||
actorContainer.add(player)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum
|
||||
package com.torvald.terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-19.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.GameItem
|
||||
package com.torvald.terrarum.gameitem
|
||||
|
||||
import org.newdawn.slick.GameContainer
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.Torvald.Terrarum.GameItem
|
||||
package com.torvald.terrarum.gameitem
|
||||
|
||||
import com.Torvald.Terrarum.TileProperties.TilePropCodex
|
||||
import com.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import org.newdawn.slick.GameContainer
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* See http://www.gnu.org/licenses/gpl.html for information.
|
||||
*/
|
||||
|
||||
package com.Torvald.Terrarum.GameMap
|
||||
package com.torvald.terrarum.gamemap
|
||||
|
||||
import org.newdawn.slick.SlickException
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.GameMap
|
||||
package com.torvald.terrarum.gamemap
|
||||
|
||||
import java.io.Serializable
|
||||
import java.util.Spliterator
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.Torvald.Terrarum.GameMap
|
||||
package com.torvald.terrarum.gamemap
|
||||
|
||||
import com.Torvald.Point.Point2f
|
||||
import com.torvald.point.Point2f
|
||||
|
||||
import java.io.Serializable
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.GameMap
|
||||
package com.torvald.terrarum.gamemap
|
||||
|
||||
import java.io.Serializable
|
||||
import java.util.Spliterator
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.GameMap
|
||||
package com.torvald.terrarum.gamemap
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-24.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.ItemProperties
|
||||
package com.torvald.terrarum.itemproperties
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-18.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.Torvald.Terrarum.ItemProperties
|
||||
package com.torvald.terrarum.itemproperties
|
||||
|
||||
import com.Torvald.Terrarum.Actors.CanBeStoredAsItem
|
||||
import com.Torvald.Terrarum.GameItem.InventoryItem
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.torvald.terrarum.gameactors.CanBeStoredAsItem
|
||||
import com.torvald.terrarum.gameitem.InventoryItem
|
||||
import com.torvald.terrarum.Terrarum
|
||||
import org.newdawn.slick.GameContainer
|
||||
import java.util.*
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.util.*
|
||||
*/
|
||||
object ItemPropCodex {
|
||||
|
||||
val CSV_PATH = "./src/com/Torvald/Terrarum/ItemProperties/itemprop.csv"
|
||||
val CSV_PATH = "./src/com/torvald/terrarum/itemproperties/itemprop.csv"
|
||||
|
||||
/**
|
||||
* <ItemID or RefID for Actor, TheItem>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.ItemProperties
|
||||
package com.torvald.terrarum.itemproperties
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-18.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.ItemProperties
|
||||
package com.torvald.terrarum.itemproperties
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-19.
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.Torvald.Terrarum.ItemProperties
|
||||
package com.torvald.terrarum.itemproperties
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-18.
|
||||
*/
|
||||
object MaterialPropCodex {
|
||||
val CSV_PATH = "./src/com/Torvald/Terrarum/ItemProperties/materialprop.csv"
|
||||
val CSV_PATH = "./src/com/torvald/terrarum/itemproperties/materialprop.csv"
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum
|
||||
package com.torvald.terrarum
|
||||
|
||||
import com.google.gson.JsonPrimitive
|
||||
import java.util.*
|
||||
@@ -39,7 +39,7 @@ open class KVHashMap {
|
||||
}
|
||||
|
||||
fun getAsInt(key: String): Int? {
|
||||
return get(key) as Int
|
||||
return get(key) as Int?
|
||||
}
|
||||
|
||||
fun getAsFloat(key: String): Float? {
|
||||
@@ -47,19 +47,19 @@ open class KVHashMap {
|
||||
if (value is Int)
|
||||
return value.toFloat()
|
||||
else if (value is JsonPrimitive) return value.asFloat
|
||||
return value as Float
|
||||
return value as Float?
|
||||
}
|
||||
|
||||
fun getAsString(key: String): String? {
|
||||
val value = get(key)
|
||||
if (value is JsonPrimitive) return value.asString
|
||||
return value as String
|
||||
return value as String?
|
||||
}
|
||||
|
||||
fun getAsBoolean(key: String): Boolean? {
|
||||
val value = get(key)
|
||||
if (value is JsonPrimitive) return value.asBoolean
|
||||
return value as Boolean
|
||||
return value as Boolean?
|
||||
}
|
||||
|
||||
fun hasKey(key: String): Boolean {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.Torvald.Terrarum.LangPack
|
||||
package com.torvald.terrarum.langpack
|
||||
|
||||
import com.Torvald.CSVFetcher
|
||||
import com.Torvald.ImageFont.GameFontWhite
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.torvald.CSVFetcher
|
||||
import com.torvald.imagefont.GameFontWhite
|
||||
import com.torvald.terrarum.Terrarum
|
||||
import org.apache.commons.csv.CSVRecord
|
||||
import org.newdawn.slick.SlickException
|
||||
|
||||
@@ -78,12 +78,21 @@ object Lang {
|
||||
}
|
||||
|
||||
operator fun get(key: String): String {
|
||||
fun fallback(): String = lang[key]!!.get(FALLBACK_LANG_CODE)
|
||||
|
||||
var value: String
|
||||
try {
|
||||
value = lang[key]!!.get(Terrarum.gameLocale)
|
||||
// fallback if empty string
|
||||
if (value.length == 0)
|
||||
value = fallback()
|
||||
}
|
||||
catch (e1: kotlin.KotlinNullPointerException) {
|
||||
value = "ERRNULL:$key"
|
||||
}
|
||||
catch (e: IllegalArgumentException) {
|
||||
value = key
|
||||
//value = key
|
||||
value = fallback()
|
||||
}
|
||||
|
||||
return value
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.Torvald.Terrarum.MapDrawer
|
||||
package com.torvald.terrarum.mapdrawer
|
||||
|
||||
import com.Torvald.Terrarum.Actors.ActorWithBody
|
||||
import com.Torvald.Terrarum.Actors.Luminous
|
||||
import com.Torvald.Terrarum.GameMap.WorldTime
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.Torvald.Terrarum.TileProperties.TilePropCodex
|
||||
import com.torvald.terrarum.gameactors.ActorWithBody
|
||||
import com.torvald.terrarum.gameactors.Luminous
|
||||
import com.torvald.terrarum.gamemap.WorldTime
|
||||
import com.torvald.terrarum.Terrarum
|
||||
import com.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import com.jme3.math.FastMath
|
||||
import org.newdawn.slick.Color
|
||||
import org.newdawn.slick.Graphics
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.Torvald.Terrarum.MapDrawer
|
||||
package com.torvald.terrarum.mapdrawer
|
||||
|
||||
import com.Torvald.Terrarum.GameMap.GameMap
|
||||
import com.Torvald.Terrarum.GameMap.PairedMapLayer
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.Torvald.Terrarum.TileProperties.TileNameCode
|
||||
import com.Torvald.Terrarum.TileProperties.TilePropCodex
|
||||
import com.torvald.terrarum.gamemap.GameMap
|
||||
import com.torvald.terrarum.gamemap.PairedMapLayer
|
||||
import com.torvald.terrarum.Terrarum
|
||||
import com.torvald.terrarum.tileproperties.TileNameCode
|
||||
import com.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import com.jme3.math.FastMath
|
||||
import org.lwjgl.opengl.GL11
|
||||
import org.newdawn.slick.GameContainer
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.Torvald.Terrarum.MapDrawer
|
||||
package com.torvald.terrarum.mapdrawer
|
||||
|
||||
import com.Torvald.Terrarum.GameMap.GameMap
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.Torvald.Terrarum.TileProperties.TileNameCode
|
||||
import com.Torvald.Terrarum.TileStat.TileStat
|
||||
import com.torvald.terrarum.gamemap.GameMap
|
||||
import com.torvald.terrarum.Terrarum
|
||||
import com.torvald.terrarum.tileproperties.TileNameCode
|
||||
import com.torvald.terrarum.tilestats.TileStat
|
||||
import com.jme3.math.FastMath
|
||||
import org.newdawn.slick.*
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.Torvald.Terrarum.MapGenerator
|
||||
package com.torvald.terrarum.mapgenerator
|
||||
|
||||
import com.Torvald.Rand.HQRNG
|
||||
import com.torvald.random.HQRNG
|
||||
import com.sun.javaws.exceptions.InvalidArgumentException
|
||||
|
||||
import java.util.Random
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.MapGenerator
|
||||
package com.torvald.terrarum.mapgenerator
|
||||
|
||||
internal object FloatingIslePreset01 {
|
||||
var w = 100
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.MapGenerator
|
||||
package com.torvald.terrarum.mapgenerator
|
||||
|
||||
internal object FloatingIslePreset02 {
|
||||
var w = 80
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.MapGenerator
|
||||
package com.torvald.terrarum.mapgenerator
|
||||
|
||||
internal object FloatingIslePreset03 {
|
||||
var w = 66
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.MapGenerator
|
||||
package com.torvald.terrarum.mapgenerator
|
||||
|
||||
internal object FloatingIslePreset04 {
|
||||
var w = 88
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.MapGenerator
|
||||
package com.torvald.terrarum.mapgenerator
|
||||
|
||||
internal object FloatingIslePreset05 {
|
||||
var w = 74
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.Torvald.Terrarum.MapGenerator
|
||||
package com.torvald.terrarum.mapgenerator
|
||||
|
||||
import com.Torvald.Rand.HQRNG
|
||||
import com.Torvald.Terrarum.GameMap.GameMap
|
||||
import com.Torvald.Terrarum.GameMap.MapLayer
|
||||
import com.Torvald.Terrarum.TileProperties.TileNameCode
|
||||
import com.torvald.random.HQRNG
|
||||
import com.torvald.terrarum.gamemap.GameMap
|
||||
import com.torvald.terrarum.gamemap.MapLayer
|
||||
import com.torvald.terrarum.tileproperties.TileNameCode
|
||||
import com.jme3.math.FastMath
|
||||
import java.util.*
|
||||
|
||||
@@ -12,7 +12,7 @@ object MapGenerator {
|
||||
private lateinit var map: GameMap
|
||||
private lateinit var random: Random
|
||||
//private static float[] noiseArray;
|
||||
private var seed: Long? = null
|
||||
private var seed: Long = 0
|
||||
private var width: Int = 0
|
||||
private var height: Int = 0
|
||||
|
||||
@@ -51,7 +51,7 @@ object MapGenerator {
|
||||
private val CAVEGEN_LARGEST_FEATURE = 256
|
||||
private val CAVEGEN_LARGEST_FEATURE_PERTURB = 128
|
||||
|
||||
private var worldOceanPosition: Int? = null
|
||||
private var worldOceanPosition: Int = -1
|
||||
private val TYPE_OCEAN_LEFT = 0
|
||||
private val TYPE_OCEAN_RIGHT = 1
|
||||
|
||||
@@ -88,7 +88,7 @@ object MapGenerator {
|
||||
@JvmStatic
|
||||
fun generateMap() {
|
||||
random = HQRNG(seed!!)
|
||||
println("[MapGenerator] Seed: " + seed)
|
||||
println("[mapgenerator] Seed: " + seed)
|
||||
|
||||
worldOceanPosition = if (random.nextBoolean()) TYPE_OCEAN_LEFT else TYPE_OCEAN_RIGHT
|
||||
|
||||
@@ -468,7 +468,7 @@ object MapGenerator {
|
||||
}
|
||||
|
||||
private fun placeGlacierMount(heightMap: IntArray) {
|
||||
println("[MapGenerator] Putting glacier...")
|
||||
println("[mapgenerator] Putting glacier...")
|
||||
|
||||
// raise
|
||||
for (i in heightMap.indices) {
|
||||
@@ -498,7 +498,7 @@ object MapGenerator {
|
||||
}
|
||||
|
||||
private fun heightMapToObjectMap(fs: IntArray) {
|
||||
println("[MapGenerator] Shaping world as processed...")
|
||||
println("[mapgenerator] Shaping world as processed...")
|
||||
|
||||
// iterate for heightmap
|
||||
for (x in 0..width - 1) {
|
||||
@@ -586,7 +586,7 @@ object MapGenerator {
|
||||
/* 2. Carve */
|
||||
|
||||
private fun carveCave(noisemap: Array<FloatArray>, tile: Int, message: String) {
|
||||
println("[MapGenerator] " + message)
|
||||
println("[mapgenerator] " + message)
|
||||
|
||||
for (i in 0..height - 1) {
|
||||
for (j in 0..width - 1) {
|
||||
@@ -608,7 +608,7 @@ object MapGenerator {
|
||||
* @param message
|
||||
*/
|
||||
private fun carveByMap(noisemap: Array<FloatArray>, scarcity: Float, tile: Int, message: String) {
|
||||
println("[MapGenerator] " + message)
|
||||
println("[mapgenerator] " + message)
|
||||
|
||||
for (i in 0..height - 1) {
|
||||
for (j in 0..width - 1) {
|
||||
@@ -632,7 +632,7 @@ object MapGenerator {
|
||||
* @param message
|
||||
*/
|
||||
private fun fillByMap(noisemap: Array<FloatArray>, scarcity: Float, replaceFrom: Int, tile: Int, message: String) {
|
||||
println("[MapGenerator] " + message)
|
||||
println("[mapgenerator] " + message)
|
||||
|
||||
for (i in 0..height - 1) {
|
||||
for (j in 0..width - 1) {
|
||||
@@ -656,7 +656,7 @@ object MapGenerator {
|
||||
* @param message
|
||||
*/
|
||||
private fun fillByMapInverseGradFilter(noisemap: Array<FloatArray>, scarcity: Float, replaceFrom: Int, tile: Int, message: String) {
|
||||
println("[MapGenerator] " + message)
|
||||
println("[mapgenerator] " + message)
|
||||
|
||||
for (i in 0..height - 1) {
|
||||
for (j in 0..width - 1) {
|
||||
@@ -684,7 +684,7 @@ object MapGenerator {
|
||||
* @param message
|
||||
*/
|
||||
private fun fillByMapNoFilter(noisemap: Array<FloatArray>, scarcity: Float, replaceFrom: Int, tile: Int, message: String) {
|
||||
println("[MapGenerator] " + message)
|
||||
println("[mapgenerator] " + message)
|
||||
|
||||
for (i in 0..height - 1) {
|
||||
for (j in 0..width - 1) {
|
||||
@@ -696,7 +696,7 @@ object MapGenerator {
|
||||
}
|
||||
|
||||
private fun fillByMapNoFilterUnderground(noisemap: Array<FloatArray>, scarcity: Float, replaceFrom: Int, tile: Int, message: String) {
|
||||
println("[MapGenerator] " + message)
|
||||
println("[mapgenerator] " + message)
|
||||
|
||||
for (i in 0..height - 1) {
|
||||
for (j in 0..width - 1) {
|
||||
@@ -710,7 +710,7 @@ object MapGenerator {
|
||||
}
|
||||
|
||||
private fun fillByMap(noisemap: Array<FloatArray>, scarcity: Float, replaceFrom: Int, tile: IntArray, message: String) {
|
||||
println("[MapGenerator] " + message)
|
||||
println("[mapgenerator] " + message)
|
||||
|
||||
for (i in 0..height - 1) {
|
||||
for (j in 0..width - 1) {
|
||||
@@ -862,7 +862,7 @@ object MapGenerator {
|
||||
}
|
||||
|
||||
private fun generateFloatingIslands() {
|
||||
println("[MapGenerator] Placing floating islands...")
|
||||
println("[mapgenerator] Placing floating islands...")
|
||||
|
||||
val nIslandsMax = Math.round(map.width * 6f / 8192f)
|
||||
val nIslandsMin = Math.max(2, Math.round(map.width * 4f / 8192f))
|
||||
@@ -894,7 +894,7 @@ object MapGenerator {
|
||||
/* Flood */
|
||||
|
||||
private fun floodBottomLava() {
|
||||
println("[MapGenerator] Flooding bottom lava...")
|
||||
println("[mapgenerator] Flooding bottom lava...")
|
||||
for (i in height * 14 / 15..height - 1) {
|
||||
for (j in 0..width - 1) {
|
||||
if (map.terrainArray[i][j].toInt() == 0) {
|
||||
@@ -907,7 +907,7 @@ object MapGenerator {
|
||||
/* Plant */
|
||||
|
||||
private fun plantGrass() {
|
||||
println("[MapGenerator] Planting grass...")
|
||||
println("[mapgenerator] Planting grass...")
|
||||
|
||||
/* TODO composing dirt and stone
|
||||
* over certain level, use background dirt with stone 'peckles'
|
||||
@@ -970,7 +970,7 @@ object MapGenerator {
|
||||
"green"
|
||||
else
|
||||
"white"
|
||||
println("[MapGenerator] Beach sand type: " + thisSandStr)
|
||||
println("[mapgenerator] Beach sand type: " + thisSandStr)
|
||||
|
||||
var ix = 0
|
||||
while (ix < OCEAN_WIDTH * 1.5) {
|
||||
@@ -1030,7 +1030,7 @@ object MapGenerator {
|
||||
|
||||
/**
|
||||
|
||||
* @return width of the frozen area for MapGenerator.freeze
|
||||
* @return width of the frozen area for mapgenerator.freeze
|
||||
*/
|
||||
private fun getFrozenAreaWidth(y: Int): Int {
|
||||
val randDeviation = 7
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.Torvald.Terrarum.MapGenerator
|
||||
package com.torvald.terrarum.mapgenerator
|
||||
|
||||
import com.Torvald.ColourUtil.Col4096
|
||||
import com.Torvald.Rand.HQRNG
|
||||
import com.torvald.colourutil.Col4096
|
||||
import com.torvald.random.HQRNG
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.Torvald.Terrarum.MapGenerator
|
||||
package com.torvald.terrarum.mapgenerator
|
||||
|
||||
import com.Torvald.Rand.HQRNG
|
||||
import com.torvald.random.HQRNG
|
||||
import com.jme3.math.FastMath
|
||||
|
||||
class SimplexNoise
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.MapGenerator
|
||||
package com.torvald.terrarum.mapgenerator
|
||||
|
||||
/*
|
||||
* A speed-improved simplex noise algorithm for 2D, 3D and 4D in Java.
|
||||
@@ -17,7 +17,7 @@ package com.Torvald.Terrarum.MapGenerator
|
||||
*
|
||||
*/
|
||||
|
||||
import com.Torvald.Rand.HQRNG
|
||||
import com.torvald.random.HQRNG
|
||||
|
||||
class SimplexNoise_octave(seed: Int) { // Simplex noise in 2D, 3D and 4D
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.Torvald.Terrarum
|
||||
package com.torvald.terrarum
|
||||
|
||||
import com.Torvald.ImageFont.GameFontWhite
|
||||
import com.Torvald.JsonFetcher
|
||||
import com.Torvald.JsonWriter
|
||||
import com.Torvald.Terrarum.LangPack.Lang
|
||||
import com.torvald.imagefont.GameFontWhite
|
||||
import com.torvald.JsonFetcher
|
||||
import com.torvald.JsonWriter
|
||||
import com.torvald.terrarum.langpack.Lang
|
||||
import org.lwjgl.input.Controllers
|
||||
import org.newdawn.slick.AppGameContainer
|
||||
import org.newdawn.slick.Font
|
||||
@@ -39,7 +39,7 @@ constructor(gamename: String) : StateBasedGame(gamename) {
|
||||
if (gameLocale.length < 4)
|
||||
gameLocale = sysLang
|
||||
|
||||
println("[Terrarum] Locale: " + gameLocale)
|
||||
println("[terrarum] Locale: " + gameLocale)
|
||||
}
|
||||
|
||||
@Throws(SlickException::class)
|
||||
@@ -105,7 +105,7 @@ constructor(gamename: String) : StateBasedGame(gamename) {
|
||||
|
||||
@JvmStatic fun main(args: Array<String>) {
|
||||
try {
|
||||
appgc = AppGameContainer(Terrarum("Terrarum"))
|
||||
appgc = AppGameContainer(Terrarum("terrarum"))
|
||||
appgc.setDisplayMode(WIDTH, HEIGHT, false)
|
||||
|
||||
appgc.setTargetFrameRate(TARGET_INTERNAL_FPS)
|
||||
@@ -131,11 +131,11 @@ constructor(gamename: String) : StateBasedGame(gamename) {
|
||||
val OS = System.getProperty("os.name").toUpperCase()
|
||||
if (OS.contains("WIN")) {
|
||||
OperationSystem = "WINDOWS"
|
||||
defaultDir = System.getenv("APPDATA") + "/Terrarum"
|
||||
defaultDir = System.getenv("APPDATA") + "/terrarum"
|
||||
}
|
||||
else if (OS.contains("OS X")) {
|
||||
OperationSystem = "OSX"
|
||||
defaultDir = System.getProperty("user.home") + "/Library/Application Support/Terrarum"
|
||||
defaultDir = System.getProperty("user.home") + "/Library/Application Support/terrarum"
|
||||
}
|
||||
else if (OS.contains("NUX") || OS.contains("NIX")) {
|
||||
OperationSystem = "LINUX"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.Torvald.Terrarum.TileProperties
|
||||
package com.torvald.terrarum.tileproperties
|
||||
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-02-21.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.TileProperties
|
||||
package com.torvald.terrarum.tileproperties
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-02-16.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.Torvald.Terrarum.TileProperties
|
||||
package com.torvald.terrarum.tileproperties
|
||||
|
||||
import com.Torvald.CSVFetcher
|
||||
import com.Torvald.Terrarum.GameMap.MapLayer
|
||||
import com.Torvald.Terrarum.GameMap.PairedMapLayer
|
||||
import com.torvald.CSVFetcher
|
||||
import com.torvald.terrarum.gamemap.MapLayer
|
||||
import com.torvald.terrarum.gamemap.PairedMapLayer
|
||||
import org.apache.commons.csv.CSVRecord
|
||||
|
||||
import java.io.IOException
|
||||
@@ -42,7 +42,7 @@ class TilePropCodex {
|
||||
|
||||
private lateinit var tileProps: Array<TileProp>
|
||||
|
||||
val CSV_PATH = "./src/com/Torvald/Terrarum/TileProperties/tileprop.csv"
|
||||
val CSV_PATH = "./src/com/torvald/terrarum/tileproperties/tileprop.csv"
|
||||
|
||||
fun getProp(index: Int, damage: Int): TileProp {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import com.Torvald.Terrarum.Actors.AI.ActorAI
|
||||
import com.torvald.terrarum.gameactors.ai.ActorAI
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-14.
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import org.newdawn.slick.GameContainer
|
||||
|
||||
@@ -14,4 +14,6 @@ interface Actor {
|
||||
* @return Reference ID. (32768-0x7FFF_FFFF_FFFF_FFFF)
|
||||
*/
|
||||
var referenceID: Long
|
||||
|
||||
var actorValue: ActorValue
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import com.Torvald.Terrarum.GameItem.InventoryItem
|
||||
import com.Torvald.Terrarum.ItemProperties.ItemPropCodex
|
||||
import com.torvald.terrarum.gameitem.InventoryItem
|
||||
import com.torvald.terrarum.itemproperties.ItemPropCodex
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import com.Torvald.Terrarum.KVHashMap
|
||||
import com.torvald.terrarum.KVHashMap
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-19.
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import com.Torvald.Rand.HQRNG
|
||||
import com.Torvald.Terrarum.*
|
||||
import com.Torvald.Terrarum.GameMap.GameMap
|
||||
import com.Torvald.Terrarum.MapDrawer.MapDrawer
|
||||
import com.Torvald.Terrarum.TileProperties.TilePropCodex
|
||||
import com.Torvald.spriteAnimation.SpriteAnimation
|
||||
import com.torvald.random.HQRNG
|
||||
import com.torvald.terrarum.*
|
||||
import com.torvald.terrarum.gamemap.GameMap
|
||||
import com.torvald.terrarum.mapdrawer.MapDrawer
|
||||
import com.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import com.torvald.spriteanimation.SpriteAnimation
|
||||
import com.jme3.math.FastMath
|
||||
import org.newdawn.slick.GameContainer
|
||||
import org.newdawn.slick.Graphics
|
||||
@@ -15,7 +15,7 @@ import org.newdawn.slick.Graphics
|
||||
*/
|
||||
open class ActorWithBody constructor() : Actor, Visible, Glowing {
|
||||
|
||||
internal var actorValue: ActorValue
|
||||
override var actorValue: ActorValue = ActorValue()
|
||||
|
||||
var hitboxTranslateX: Float = 0.toFloat()// relative to spritePosX
|
||||
var hitboxTranslateY: Float = 0.toFloat()// relative to spritePosY
|
||||
@@ -79,7 +79,7 @@ open class ActorWithBody constructor() : Actor, Visible, Glowing {
|
||||
private var density = 1000f
|
||||
|
||||
/**
|
||||
* Gravitational Constant G. Load from GameMap.
|
||||
* Gravitational Constant G. Load from gamemap.
|
||||
* [m / s^2]
|
||||
* s^2 = 1/FPS = 1/60 if FPS is targeted to 60
|
||||
* meter to pixel : 24/FPS
|
||||
@@ -134,7 +134,6 @@ open class ActorWithBody constructor() : Actor, Visible, Glowing {
|
||||
|
||||
init {
|
||||
// referenceID = HQRNG().nextLong() // renew ID just in case
|
||||
actorValue = ActorValue()
|
||||
map = Terrarum.game.map
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import com.Torvald.Terrarum.GameItem.InventoryItem
|
||||
import com.torvald.terrarum.gameitem.InventoryItem
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-14.
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import org.newdawn.slick.Input
|
||||
|
||||
27
src/com/Torvald/Terrarum/gameactors/CreatureFactory.kt
Normal file
27
src/com/Torvald/Terrarum/gameactors/CreatureFactory.kt
Normal file
@@ -0,0 +1,27 @@
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import com.torvald.JsonFetcher
|
||||
import com.torvald.random.Fudge3
|
||||
import com.torvald.random.HQRNG
|
||||
import com.torvald.terrarum.langpack.Lang
|
||||
import com.google.gson.JsonObject
|
||||
import org.newdawn.slick.SlickException
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-14.
|
||||
*/
|
||||
|
||||
object CreatureFactory {
|
||||
|
||||
/**
|
||||
* @Param jsonFileName with extension
|
||||
*/
|
||||
@Throws(IOException::class, SlickException::class)
|
||||
fun create(jsonFileName: String): ActorWithBody {
|
||||
val actor = ActorWithBody()
|
||||
CreatureRawInjector.inject(actor.actorValue, jsonFileName)
|
||||
|
||||
return actor
|
||||
}
|
||||
}
|
||||
@@ -1,111 +1,107 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import com.Torvald.JsonFetcher
|
||||
import com.Torvald.Rand.Fudge3
|
||||
import com.Torvald.Rand.HQRNG
|
||||
import com.Torvald.Terrarum.LangPack.Lang
|
||||
import com.torvald.JsonFetcher
|
||||
import com.torvald.random.Fudge3
|
||||
import com.torvald.random.HQRNG
|
||||
import com.torvald.terrarum.langpack.Lang
|
||||
import com.google.gson.JsonObject
|
||||
import org.newdawn.slick.SlickException
|
||||
import java.io.IOException
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-14.
|
||||
* Created by minjaesong on 16-03-25.
|
||||
*/
|
||||
object CreatureRawInjector {
|
||||
|
||||
object CreatureFactory {
|
||||
const val JSONPATH = "./res/raw/"
|
||||
private const val MULTIPLIER_RAW_ELEM_SUFFIX = "mult"
|
||||
|
||||
private val JSONPATH = "./res/raw/"
|
||||
|
||||
@JvmStatic
|
||||
/**
|
||||
* 'Injects' creature raw ActorValue to the ActorValue reference provided.
|
||||
*
|
||||
* @param actorValueRef ActorValue object to be injected.
|
||||
*/
|
||||
@Throws(IOException::class, SlickException::class)
|
||||
fun build(jsonFileName: String): ActorWithBody {
|
||||
fun inject(actorValueRef: ActorValue, jsonFileName: String) {
|
||||
val jsonObj = JsonFetcher.readJson(JSONPATH + jsonFileName)
|
||||
val actor = ActorWithBody()
|
||||
|
||||
|
||||
val elementsString = arrayOf("racename", "racenameplural")
|
||||
|
||||
val elementsFloat = arrayOf("baseheight", "basemass", "accel", "toolsize", "encumbrance")
|
||||
|
||||
val elementsFloatVariable = arrayOf("strength", "speed", "jumppower", "scale", "speed")
|
||||
|
||||
val elementsBoolean = arrayOf("intelligent")
|
||||
// val elementsMultiplyFromOne = arrayOf()
|
||||
|
||||
val elementsMultiplyFromOne = arrayOf("physiquemult")
|
||||
setAVStrings(actorValueRef, elementsString, jsonObj)
|
||||
setAVFloats(actorValueRef, elementsFloat, jsonObj)
|
||||
setAVFloatsVariable(actorValueRef, elementsFloatVariable, jsonObj)
|
||||
// setAVMultiplyFromOne(actorValueRef, elementsMultiplyFromOne, jsonObj)
|
||||
setAVBooleans(actorValueRef, elementsBoolean, jsonObj)
|
||||
|
||||
|
||||
setAVStrings(actor, elementsString, jsonObj)
|
||||
setAVFloats(actor, elementsFloat, jsonObj)
|
||||
setAVFloatsVariable(actor, elementsFloatVariable, jsonObj)
|
||||
setAVMultiplyFromOne(actor, elementsMultiplyFromOne, jsonObj)
|
||||
setAVBooleans(actor, elementsBoolean, jsonObj)
|
||||
|
||||
actor.actorValue.set("accel", Player.WALK_ACCEL_BASE)
|
||||
actor.actorValue.set("accelmult", 1f)
|
||||
|
||||
return actor
|
||||
actorValueRef["accel"] = Player.WALK_ACCEL_BASE
|
||||
actorValueRef["accelmult"] = 1f
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and set actor values that have 'variable' appended. E.g. strength
|
||||
* @param p
|
||||
* @param avRef
|
||||
* *
|
||||
* @param elemSet
|
||||
* *
|
||||
* @param jsonObject
|
||||
*/
|
||||
private fun setAVFloatsVariable(p: ActorWithBody, elemSet: Array<String>, jsonObject: JsonObject) {
|
||||
private fun setAVFloatsVariable(avRef: ActorValue, elemSet: Array<String>, jsonObject: JsonObject) {
|
||||
for (s in elemSet) {
|
||||
val baseValue = jsonObject.get(s).asFloat
|
||||
// roll fudge dice and get value [-3, 3] as [0, 6]
|
||||
val varSelected = Fudge3(HQRNG()).rollForArray()
|
||||
// get multiplier from json. Assuming percentile
|
||||
val multiplier = jsonObject.get(s + "variable").asJsonArray.get(varSelected).asInt
|
||||
val multiplier = jsonObject.get(s + MULTIPLIER_RAW_ELEM_SUFFIX).asJsonArray.get(varSelected).asInt
|
||||
val realValue = baseValue * multiplier / 100f
|
||||
|
||||
p.actorValue.set(s, realValue)
|
||||
avRef[s] = realValue
|
||||
avRef[s + MULTIPLIER_RAW_ELEM_SUFFIX] = 1.0f // use multiplied value as 'base' for all sort of things
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and set string actor values
|
||||
* @param p
|
||||
* @param avRef
|
||||
* *
|
||||
* @param elemSet
|
||||
* *
|
||||
* @param jsonObject
|
||||
*/
|
||||
private fun setAVStrings(p: ActorWithBody, elemSet: Array<String>, jsonObject: JsonObject) {
|
||||
private fun setAVStrings(avRef: ActorValue, elemSet: Array<String>, jsonObject: JsonObject) {
|
||||
for (s in elemSet) {
|
||||
val key = jsonObject.get(s).asString
|
||||
p.actorValue.set(s, Lang.get(key))
|
||||
avRef[s] = Lang[key]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and set float actor values
|
||||
* @param p
|
||||
* @param avRef
|
||||
* *
|
||||
* @param elemSet
|
||||
* *
|
||||
* @param jsonObject
|
||||
*/
|
||||
private fun setAVFloats(p: ActorWithBody, elemSet: Array<String>, jsonObject: JsonObject) {
|
||||
private fun setAVFloats(avRef: ActorValue, elemSet: Array<String>, jsonObject: JsonObject) {
|
||||
for (s in elemSet) {
|
||||
p.actorValue.set(s, jsonObject.get(s).asFloat)
|
||||
avRef[s] = jsonObject.get(s).asFloat
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch and set actor values that should multiplier be applied to the base value of 1.
|
||||
* E.g. physiquemult
|
||||
* @param p
|
||||
* @param avRef
|
||||
* *
|
||||
* @param elemSet
|
||||
* *
|
||||
* @param jsonObject
|
||||
*/
|
||||
private fun setAVMultiplyFromOne(p: ActorWithBody, elemSet: Array<String>, jsonObject: JsonObject) {
|
||||
private fun setAVMultiplyFromOne(avRef: ActorValue, elemSet: Array<String>, jsonObject: JsonObject) {
|
||||
for (s in elemSet) {
|
||||
val baseValue = 1f
|
||||
// roll fudge dice and get value [-3, 3] as [0, 6]
|
||||
@@ -114,13 +110,13 @@ object CreatureFactory {
|
||||
val multiplier = jsonObject.get(s).asJsonArray.get(varSelected).asInt
|
||||
val realValue = baseValue * multiplier / 100f
|
||||
|
||||
p.actorValue.set(s, realValue)
|
||||
avRef[s] = realValue
|
||||
}
|
||||
}
|
||||
|
||||
private fun setAVBooleans(p: ActorWithBody, elemSet: Array<String>, jsonObject: JsonObject) {
|
||||
private fun setAVBooleans(avRef: ActorValue, elemSet: Array<String>, jsonObject: JsonObject) {
|
||||
for (s in elemSet) {
|
||||
p.actorValue.set(s, jsonObject.get(s).asBoolean)
|
||||
avRef[s] = jsonObject.get(s).asBoolean
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import org.newdawn.slick.GameContainer
|
||||
import org.newdawn.slick.Graphics
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import com.Torvald.Terrarum.Actors.Faction.Faction
|
||||
import com.torvald.terrarum.gameactors.faction.Faction
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import org.newdawn.slick.GameContainer
|
||||
import org.newdawn.slick.Graphics
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import com.Torvald.Point.Point2f
|
||||
import com.torvald.point.Point2f
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-15.
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import java.util.*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-14.
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import com.Torvald.Rand.HQRNG
|
||||
import com.Torvald.Terrarum.Actors.AI.ActorAI
|
||||
import com.Torvald.Terrarum.Actors.Faction.Faction
|
||||
import com.Torvald.Terrarum.GameItem.InventoryItem
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.torvald.random.HQRNG
|
||||
import com.torvald.terrarum.gameactors.ai.ActorAI
|
||||
import com.torvald.terrarum.gameactors.faction.Faction
|
||||
import com.torvald.terrarum.gameitem.InventoryItem
|
||||
import com.torvald.terrarum.Terrarum
|
||||
import org.newdawn.slick.GameContainer
|
||||
import java.util.*
|
||||
|
||||
30
src/com/Torvald/Terrarum/gameactors/PFCynthia.kt
Normal file
30
src/com/Torvald/Terrarum/gameactors/PFCynthia.kt
Normal file
@@ -0,0 +1,30 @@
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import com.torvald.spriteanimation.SpriteAnimation
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-25.
|
||||
*/
|
||||
object PFCynthia {
|
||||
|
||||
fun create(): Player {
|
||||
val p: Player = Player()
|
||||
CreatureRawInjector.inject(p.actorValue, "CreatureHuman.json")
|
||||
|
||||
p.actorValue["selectedtile"] = 16
|
||||
|
||||
p.sprite = SpriteAnimation()
|
||||
p.sprite!!.setDimension(26, 42)
|
||||
p.sprite!!.setSpriteImage("res/graphics/sprites/test_player_2.png")
|
||||
p.sprite!!.setDelay(200)
|
||||
p.sprite!!.setRowsAndFrames(1, 1)
|
||||
p.sprite!!.setAsVisible()
|
||||
|
||||
p.setHitboxDimension(15, 40, 9, 0)
|
||||
|
||||
p.setPosition((4096 * 16).toFloat(), (300 * 16).toFloat())
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import com.Torvald.JsonFetcher
|
||||
import com.Torvald.Terrarum.Actors.Faction.Faction
|
||||
import com.Torvald.spriteAnimation.SpriteAnimation
|
||||
import com.torvald.JsonFetcher
|
||||
import com.torvald.terrarum.gameactors.faction.Faction
|
||||
import com.torvald.spriteanimation.SpriteAnimation
|
||||
import com.google.gson.JsonObject
|
||||
import org.newdawn.slick.SlickException
|
||||
import java.io.IOException
|
||||
@@ -15,9 +15,7 @@ object PFSigrid {
|
||||
|
||||
private val FACTION_PATH = "./res/raw/"
|
||||
|
||||
@JvmStatic
|
||||
@Throws(SlickException::class)
|
||||
fun build(): Player {
|
||||
fun create(): Player {
|
||||
val p = Player()
|
||||
|
||||
p.sprite = SpriteAnimation()
|
||||
@@ -35,33 +33,34 @@ object PFSigrid {
|
||||
p.spriteGlow!!.setAsVisible()
|
||||
|
||||
p.actorValue = ActorValue()
|
||||
p.actorValue.set("scale", 1.0f)
|
||||
p.actorValue.set("speed", 4.0f)
|
||||
p.actorValue.set("speedmult", 1.0f)
|
||||
p.actorValue.set("accel", Player.WALK_ACCEL_BASE)
|
||||
p.actorValue.set("accelmult", 1.0f)
|
||||
p.actorValue["scale"] = 1.0f
|
||||
p.actorValue["speed"] = 4.0f
|
||||
p.actorValue["speedmult"] = 1.0f
|
||||
p.actorValue["accel"] = Player.WALK_ACCEL_BASE
|
||||
p.actorValue["accelmult"] = 1.0f
|
||||
|
||||
p.actorValue.set("jumppower", 5f)
|
||||
p.actorValue["jumppower"] = 5f
|
||||
|
||||
p.actorValue.set("basemass", 80f)
|
||||
p.actorValue["basemass"] = 80f
|
||||
|
||||
p.actorValue.set("physiquemult", 1) // Constant 1.0 for player, meant to be used by random mobs
|
||||
p.actorValue["physiquemult"] = 1 // Constant 1.0 for player, meant to be used by random mobs
|
||||
/**
|
||||
* fixed value, or 'base value', from creature strength of Dwarf Fortress.
|
||||
* Human race uses 1000. (see CreatureHuman.json)
|
||||
*/
|
||||
p.actorValue.set("strength", 1414)
|
||||
p.actorValue.set("encumbrance", 1000)
|
||||
p.actorValue["strength"] = 1414
|
||||
p.actorValue["encumbrance"] = 1000
|
||||
|
||||
p.actorValue.set("name", "Sigrid")
|
||||
p.actorValue["name"] = "Sigrid"
|
||||
|
||||
p.actorValue.set("intelligent", true)
|
||||
p.actorValue["intelligent"] = true
|
||||
|
||||
p.actorValue.set("luminosity", 5980540)
|
||||
p.actorValue["luminosity"] = 5980540
|
||||
|
||||
p.actorValue.set("selectedtile", 16)
|
||||
p.actorValue["selectedtile"] = 16
|
||||
|
||||
p.setHitboxDimension(18, 46, 8, 0)
|
||||
//p.setHitboxDimension(18, 46, 8, 0)
|
||||
p.setHitboxDimension(15, 46, 10, 0)
|
||||
|
||||
p.inventory = ActorInventory(0x7FFFFFFF, true)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import org.newdawn.slick.Color
|
||||
import org.newdawn.slick.GameContainer
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import com.Torvald.Terrarum.Actors.Faction.Faction
|
||||
import com.Torvald.Terrarum.GameControl.EnumKeyFunc
|
||||
import com.Torvald.Terrarum.GameControl.KeyMap
|
||||
import com.Torvald.Terrarum.MapDrawer.MapDrawer
|
||||
import com.Torvald.Terrarum.Terrarum
|
||||
import com.Torvald.spriteAnimation.SpriteAnimation
|
||||
import com.torvald.terrarum.gameactors.faction.Faction
|
||||
import com.torvald.terrarum.gamecontroller.EnumKeyFunc
|
||||
import com.torvald.terrarum.gamecontroller.KeyMap
|
||||
import com.torvald.terrarum.mapdrawer.MapDrawer
|
||||
import com.torvald.terrarum.Terrarum
|
||||
import com.torvald.spriteanimation.SpriteAnimation
|
||||
import com.jme3.math.FastMath
|
||||
import org.lwjgl.input.Controller
|
||||
import org.lwjgl.input.Controllers
|
||||
@@ -71,7 +71,7 @@ class Player : ActorWithBody, Controllable, Pocketed, Factionable, Luminous, Lan
|
||||
override var luminosity: Int
|
||||
get() = actorValue.getAsInt("luminosity") ?: 0
|
||||
set(value) {
|
||||
actorValue.set("luminosity", value)
|
||||
actorValue["luminosity"] = value
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -422,7 +422,7 @@ class Player : ActorWithBody, Controllable, Pocketed, Factionable, Luminous, Lan
|
||||
// try concave mode?
|
||||
}
|
||||
|
||||
// for mob AI:
|
||||
// for mob ai:
|
||||
//super.setVeloY(veloY
|
||||
// -
|
||||
// pwr * FastMath.sqrt(scale)
|
||||
@@ -484,10 +484,6 @@ class Player : ActorWithBody, Controllable, Pocketed, Factionable, Luminous, Lan
|
||||
noClip = b
|
||||
}
|
||||
|
||||
fun getActorValue(): ActorValue {
|
||||
return actorValue
|
||||
}
|
||||
|
||||
override fun addHouseTile(x: Int, y: Int) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.Torvald.Terrarum.Actors
|
||||
package com.torvald.terrarum.gameactors
|
||||
|
||||
import org.newdawn.slick.SlickException
|
||||
import java.io.IOException
|
||||
@@ -10,10 +10,10 @@ object PlayerFactory {
|
||||
private val JSONPATH = "./res/raw/"
|
||||
private val jsonString = String()
|
||||
|
||||
@JvmStatic
|
||||
@Throws(IOException::class, SlickException::class)
|
||||
fun build(jsonFileName: String): Player {
|
||||
var p: Player = CreatureFactory.build("CreatureHuman") as Player
|
||||
fun create(): Player {
|
||||
val p: Player = Player()
|
||||
CreatureRawInjector.inject(p.actorValue, "CreatureHuman.json")
|
||||
|
||||
// attach sprite
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user