mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
update on Kotlin lib, master sprite (psd) is now Lab 16 bits/px
Former-commit-id: 0c344b7472e4935c1c55f35a718623cdbe1ec993 Former-commit-id: 63e163245cab2037de3efbfc72c3d307402c2b46
This commit is contained in:
3
.idea/codeStyleSettings.xml
generated
3
.idea/codeStyleSettings.xml
generated
@@ -7,6 +7,9 @@
|
|||||||
<JetCodeStyleSettings>
|
<JetCodeStyleSettings>
|
||||||
<option name="ALIGN_IN_COLUMNS_CASE_BRANCH" value="true" />
|
<option name="ALIGN_IN_COLUMNS_CASE_BRANCH" value="true" />
|
||||||
</JetCodeStyleSettings>
|
</JetCodeStyleSettings>
|
||||||
|
<MultiMarkdownCodeStyleSettings>
|
||||||
|
<option name="RIGHT_MARGIN" value="72" />
|
||||||
|
</MultiMarkdownCodeStyleSettings>
|
||||||
<XML>
|
<XML>
|
||||||
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
|
||||||
</XML>
|
</XML>
|
||||||
|
|||||||
@@ -6,13 +6,12 @@ This project mainly uses Kotlin and Java, Python/Lua/etc. for tools.
|
|||||||
|
|
||||||
Documentations and resources for work (such as .psd) are also included in the repo. You will need Mac computer to read and edit documentations in .gcx and .numbers.
|
Documentations and resources for work (such as .psd) are also included in the repo. You will need Mac computer to read and edit documentations in .gcx and .numbers.
|
||||||
|
|
||||||
Any contribution in this project is sorely in English, so be sure to use English in codes, comments, etc.
|
Any contribution in this project must be made sorely in English, so be sure to use English in codes, comments, etc.
|
||||||
|
|
||||||
## Setup ##
|
## Setup ##
|
||||||
* Configuration
|
* Configuration
|
||||||
Just make sure you have Java version 8 or higher
|
Just make sure you have JDK 8 or higher
|
||||||
* Dependencies
|
* Required libraries are included in the repository.
|
||||||
JRE 1.8
|
|
||||||
|
|
||||||
|
|
||||||
## Contribution guidelines ##
|
## Contribution guidelines ##
|
||||||
|
|||||||
@@ -4,10 +4,11 @@
|
|||||||
<exclude-output />
|
<exclude-output />
|
||||||
<content url="file://$MODULE_DIR$">
|
<content url="file://$MODULE_DIR$">
|
||||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||||
|
<sourceFolder url="file://$MODULE_DIR$/res" type="java-resource" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" name="ibxm" level="project" />
|
|
||||||
<orderEntry type="library" name="lib" level="project" />
|
<orderEntry type="library" name="lib" level="project" />
|
||||||
|
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 728 B |
BIN
res/graphics/sky_colour.png
Normal file
BIN
res/graphics/sky_colour.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 110 KiB After Width: | Height: | Size: 110 KiB |
43
src/com/Torvald/Serialise/WriteMeta.kt
Normal file
43
src/com/Torvald/Serialise/WriteMeta.kt
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package com.Torvald.Serialise
|
||||||
|
|
||||||
|
import com.Torvald.Terrarum.MapGenerator.MapGenerator
|
||||||
|
import com.Torvald.Terrarum.MapGenerator.RoguelikeRandomiser
|
||||||
|
import com.Torvald.Terrarum.TileProperties.TilePropCodex
|
||||||
|
import org.apache.commons.codec.digest.DigestUtils
|
||||||
|
import java.io.FileInputStream
|
||||||
|
import java.io.File
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 16-03-15.
|
||||||
|
*/
|
||||||
|
object WriteMeta {
|
||||||
|
|
||||||
|
val MAGIC: Array<Byte> = arrayOf(
|
||||||
|
'T'.toByte()
|
||||||
|
, 'E'.toByte()
|
||||||
|
, 'S'.toByte()
|
||||||
|
, 'V'.toByte()
|
||||||
|
)
|
||||||
|
|
||||||
|
val terraseed: Long = MapGenerator.getGeneratorSeed()
|
||||||
|
val rogueseed: Long = RoguelikeRandomiser.getGeneratorSeed()
|
||||||
|
|
||||||
|
fun write() {
|
||||||
|
var hashArray: ArrayList<ByteArray> = ArrayList()
|
||||||
|
|
||||||
|
val fileArray: Array<File> = arrayOf(
|
||||||
|
File(TilePropCodex.CSV_PATH)
|
||||||
|
//, File(ItemPropCodex.CSV_PATH)
|
||||||
|
//, File(MaterialPropCodex.CSV_PATH)
|
||||||
|
//,
|
||||||
|
)
|
||||||
|
|
||||||
|
for (file in fileArray) {
|
||||||
|
val inputStream = FileInputStream(file)
|
||||||
|
val hash = DigestUtils.sha256(inputStream)
|
||||||
|
|
||||||
|
hashArray.add(hash)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -13,5 +13,5 @@ interface Actor {
|
|||||||
* Valid RefID is equal to or greater than 32768.
|
* Valid RefID is equal to or greater than 32768.
|
||||||
* @return Reference ID. (32768-0x7FFF_FFFF_FFFF_FFFF)
|
* @return Reference ID. (32768-0x7FFF_FFFF_FFFF_FFFF)
|
||||||
*/
|
*/
|
||||||
var referenceID: Long?
|
var referenceID: Long
|
||||||
}
|
}
|
||||||
@@ -1,20 +1,21 @@
|
|||||||
package com.Torvald.Terrarum.Actors
|
package com.Torvald.Terrarum.Actors
|
||||||
|
|
||||||
import com.Torvald.Terrarum.GameItem.InventoryItem
|
import com.Torvald.Terrarum.GameItem.InventoryItem
|
||||||
import com.Torvald.Terrarum.GameItem.ItemCodex
|
import com.Torvald.Terrarum.GameItem.ItemPropCodex
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by minjaesong on 16-03-15.
|
* Created by minjaesong on 16-03-15.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Transient const val CAPACITY_MAX = 0x7FFFFFFF
|
|
||||||
@Transient const val CAPACITY_MODE_NO_ENCUMBER = 0
|
|
||||||
@Transient const val CAPACITY_MODE_COUNT = 1
|
|
||||||
@Transient const val CAPACITY_MODE_WEIGHT = 2
|
|
||||||
|
|
||||||
class ActorInventory {
|
class ActorInventory {
|
||||||
|
|
||||||
|
@Transient val CAPACITY_MAX = 0x7FFFFFFF
|
||||||
|
@Transient val CAPACITY_MODE_NO_ENCUMBER = 0
|
||||||
|
@Transient val CAPACITY_MODE_COUNT = 1
|
||||||
|
@Transient val CAPACITY_MODE_WEIGHT = 2
|
||||||
|
|
||||||
|
|
||||||
private var capacityByCount: Int = 0
|
private var capacityByCount: Int = 0
|
||||||
private var capacityByWeight: Int = 0
|
private var capacityByWeight: Int = 0
|
||||||
private var capacityMode: Int = 0
|
private var capacityMode: Int = 0
|
||||||
@@ -80,7 +81,7 @@ class ActorInventory {
|
|||||||
var weight = 0f
|
var weight = 0f
|
||||||
|
|
||||||
for (item in itemList.entries) {
|
for (item in itemList.entries) {
|
||||||
weight += ItemCodex.getItem(item.key).weight * item.value
|
weight += ItemPropCodex.getItem(item.key).weight * item.value
|
||||||
}
|
}
|
||||||
|
|
||||||
return weight
|
return weight
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ open class ActorWithBody constructor() : Actor, Visible, Glowing {
|
|||||||
internal var baseSpriteWidth: Int = 0
|
internal var baseSpriteWidth: Int = 0
|
||||||
internal var baseSpriteHeight: Int = 0
|
internal var baseSpriteHeight: Int = 0
|
||||||
|
|
||||||
override var referenceID: Long? = null
|
override var referenceID: Long = HQRNG().nextLong()
|
||||||
/**
|
/**
|
||||||
* Positions: top-left point
|
* Positions: top-left point
|
||||||
*/
|
*/
|
||||||
@@ -133,7 +133,7 @@ open class ActorWithBody constructor() : Actor, Visible, Glowing {
|
|||||||
@Transient private val map: GameMap
|
@Transient private val map: GameMap
|
||||||
|
|
||||||
init {
|
init {
|
||||||
referenceID = HQRNG().nextLong()
|
// referenceID = HQRNG().nextLong() // renew ID just in case
|
||||||
actorValue = ActorValue()
|
actorValue = ActorValue()
|
||||||
map = Terrarum.game.map
|
map = Terrarum.game.map
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ interface CanBeStoredAsItem {
|
|||||||
|
|
||||||
fun resumeUpdateAndDraw()
|
fun resumeUpdateAndDraw()
|
||||||
|
|
||||||
var itemData: InventoryItem?
|
var itemData: InventoryItem
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -12,10 +12,10 @@ import java.io.IOException
|
|||||||
* Created by minjaesong on 16-03-14.
|
* Created by minjaesong on 16-03-14.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private const val JSONPATH = "./res/raw/"
|
|
||||||
|
|
||||||
object CreatureFactory {
|
object CreatureFactory {
|
||||||
|
|
||||||
|
private val JSONPATH = "./res/raw/"
|
||||||
|
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@Throws(IOException::class, SlickException::class)
|
@Throws(IOException::class, SlickException::class)
|
||||||
fun build(jsonFileName: String): ActorWithBody {
|
fun build(jsonFileName: String): ActorWithBody {
|
||||||
|
|||||||
@@ -14,14 +14,38 @@ import java.util.*
|
|||||||
open class NPCIntelligentBase : ActorWithBody()
|
open class NPCIntelligentBase : ActorWithBody()
|
||||||
, AIControlled, Pocketed, CanBeStoredAsItem, Factionable, LandHolder {
|
, AIControlled, Pocketed, CanBeStoredAsItem, Factionable, LandHolder {
|
||||||
|
|
||||||
override var itemData: InventoryItem? = null
|
override var itemData: InventoryItem = object : InventoryItem {
|
||||||
|
override var itemID = HQRNG().nextLong()
|
||||||
|
|
||||||
|
override var weight = 0f
|
||||||
|
|
||||||
|
override fun effectWhileInPocket(gc: GameContainer, delta_t: Int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun effectWhenPickedUp(gc: GameContainer, delta_t: Int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun primaryUse(gc: GameContainer, delta_t: Int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun secondaryUse(gc: GameContainer, delta_t: Int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun effectWhenThrownAway(gc: GameContainer, delta_t: Int) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Transient private var ai: ActorAI? = null
|
@Transient private var ai: ActorAI? = null
|
||||||
override var inventory: ActorInventory? = null
|
override var inventory: ActorInventory? = null
|
||||||
|
|
||||||
private val factionSet = HashSet<Faction>()
|
private val factionSet = HashSet<Faction>()
|
||||||
|
|
||||||
override var referenceID: Long? = null
|
override var referenceID: Long = HQRNG().nextLong()
|
||||||
|
|
||||||
override var faction: HashSet<Faction>? = null
|
override var faction: HashSet<Faction>? = null
|
||||||
|
|
||||||
@@ -41,33 +65,7 @@ open class NPCIntelligentBase : ActorWithBody()
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun attachItemData() {
|
override fun attachItemData() {
|
||||||
val random: Random = HQRNG()
|
|
||||||
|
|
||||||
itemData = object : InventoryItem {
|
|
||||||
override var itemID = random.nextLong()
|
|
||||||
|
|
||||||
override var weight = 0f
|
|
||||||
|
|
||||||
override fun effectWhileInPocket(gc: GameContainer, delta_t: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun effectWhenPickedUp(gc: GameContainer, delta_t: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun primaryUse(gc: GameContainer, delta_t: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun secondaryUse(gc: GameContainer, delta_t: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun effectWhenThrownAway(gc: GameContainer, delta_t: Int) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemWeight(): Float {
|
override fun getItemWeight(): Float {
|
||||||
|
|||||||
@@ -18,20 +18,21 @@ import java.util.*
|
|||||||
* Created by minjaesong on 16-03-14.
|
* Created by minjaesong on 16-03-14.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* empirical value.
|
|
||||||
*/
|
|
||||||
// private transient final float JUMP_ACCELERATION_MOD = ???f / 10000f; //quadratic mode
|
|
||||||
@Transient private const val JUMP_ACCELERATION_MOD = 170f / 10000f //linear mode
|
|
||||||
@Transient private const val WALK_FRAMES_TO_MAX_ACCEL = 6
|
|
||||||
|
|
||||||
@Transient private const val LEFT = 1
|
|
||||||
@Transient private const val RIGHT = 2
|
|
||||||
|
|
||||||
@Transient private const val KEY_NULL = -1
|
|
||||||
|
|
||||||
class Player : ActorWithBody, Controllable, Pocketed, Factionable, Luminous, LandHolder {
|
class Player : ActorWithBody, Controllable, Pocketed, Factionable, Luminous, LandHolder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* empirical value.
|
||||||
|
*/
|
||||||
|
// private transient final float JUMP_ACCELERATION_MOD = ???f / 10000f; //quadratic mode
|
||||||
|
@Transient private val JUMP_ACCELERATION_MOD = 170f / 10000f //linear mode
|
||||||
|
@Transient private val WALK_FRAMES_TO_MAX_ACCEL = 6
|
||||||
|
|
||||||
|
@Transient private val LEFT = 1
|
||||||
|
@Transient private val RIGHT = 2
|
||||||
|
|
||||||
|
@Transient private val KEY_NULL = -1
|
||||||
|
|
||||||
|
|
||||||
var vehicleRiding: Controllable? = null
|
var vehicleRiding: Controllable? = null
|
||||||
|
|
||||||
internal var jumpCounter = 0
|
internal var jumpCounter = 0
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.Torvald.Terrarum;
|
package com.Torvald.Terrarum;
|
||||||
|
|
||||||
|
import com.Torvald.Rand.HQRNG;
|
||||||
import com.Torvald.Terrarum.Actors.*;
|
import com.Torvald.Terrarum.Actors.*;
|
||||||
import com.Torvald.Terrarum.ConsoleCommand.Authenticator;
|
import com.Torvald.Terrarum.ConsoleCommand.Authenticator;
|
||||||
import com.Torvald.Terrarum.ConsoleCommand.CommandDict;
|
import com.Torvald.Terrarum.ConsoleCommand.CommandDict;
|
||||||
@@ -11,9 +12,11 @@ import com.Torvald.Terrarum.MapDrawer.LightmapRenderer;
|
|||||||
import com.Torvald.Terrarum.MapDrawer.MapCamera;
|
import com.Torvald.Terrarum.MapDrawer.MapCamera;
|
||||||
import com.Torvald.Terrarum.MapDrawer.MapDrawer;
|
import com.Torvald.Terrarum.MapDrawer.MapDrawer;
|
||||||
import com.Torvald.Terrarum.MapGenerator.MapGenerator;
|
import com.Torvald.Terrarum.MapGenerator.MapGenerator;
|
||||||
|
import com.Torvald.Terrarum.MapGenerator.RoguelikeRandomiser;
|
||||||
import com.Torvald.Terrarum.TileProperties.TilePropCodex;
|
import com.Torvald.Terrarum.TileProperties.TilePropCodex;
|
||||||
import com.Torvald.Terrarum.TileStat.TileStat;
|
import com.Torvald.Terrarum.TileStat.TileStat;
|
||||||
import com.Torvald.Terrarum.UserInterface.*;
|
import com.Torvald.Terrarum.UserInterface.*;
|
||||||
|
import com.jme3.math.FastMath;
|
||||||
import org.lwjgl.opengl.ARBShaderObjects;
|
import org.lwjgl.opengl.ARBShaderObjects;
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
import org.newdawn.slick.*;
|
import org.newdawn.slick.*;
|
||||||
@@ -70,6 +73,10 @@ public class Game extends BasicGameState {
|
|||||||
private int shaderProgram = 0;
|
private int shaderProgram = 0;
|
||||||
|
|
||||||
|
|
||||||
|
private final int ENV_COLTEMP_SUNRISE = 2500;
|
||||||
|
private final int ENV_SUNLIGHT_DELTA = MapDrawer.getENV_COLTEMP_NOON() - ENV_COLTEMP_SUNRISE;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws
|
public void init(GameContainer gameContainer, StateBasedGame stateBasedGame) throws
|
||||||
SlickException {
|
SlickException {
|
||||||
@@ -83,11 +90,12 @@ public class Game extends BasicGameState {
|
|||||||
shaderBlurV = Shader.makeShader("./res/blurV.vrt", "./res/blur.frg");
|
shaderBlurV = Shader.makeShader("./res/blurV.vrt", "./res/blur.frg");
|
||||||
|
|
||||||
|
|
||||||
GRADIENT_IMAGE = new Image("res/graphics/backgroundGradientColour.png");
|
GRADIENT_IMAGE = new Image("res/graphics/sky_colour.png");
|
||||||
skyBox = new Rectangle(0, 0, Terrarum.WIDTH, Terrarum.HEIGHT);
|
skyBox = new Rectangle(0, 0, Terrarum.WIDTH, Terrarum.HEIGHT);
|
||||||
|
|
||||||
new WorldTime();
|
new WorldTime();
|
||||||
new TilePropCodex();
|
new TilePropCodex();
|
||||||
|
// new ItemPropCodex() -- This is kotlin object and already initialised.
|
||||||
|
|
||||||
map = new GameMap(8192, 2048);
|
map = new GameMap(8192, 2048);
|
||||||
map.setGravitation(9.8f);
|
map.setGravitation(9.8f);
|
||||||
@@ -97,6 +105,10 @@ public class Game extends BasicGameState {
|
|||||||
//MapGenerator.setSeed(new HQRNG().nextLong());
|
//MapGenerator.setSeed(new HQRNG().nextLong());
|
||||||
MapGenerator.generateMap();
|
MapGenerator.generateMap();
|
||||||
|
|
||||||
|
RoguelikeRandomiser.setSeed(0x540198);
|
||||||
|
//RoguelikeRandomiser.setSeed(new HQRNG().nextLong());
|
||||||
|
|
||||||
|
|
||||||
new CommandDict();
|
new CommandDict();
|
||||||
|
|
||||||
// add new player and put it to actorContainer
|
// add new player and put it to actorContainer
|
||||||
@@ -128,6 +140,9 @@ public class Game extends BasicGameState {
|
|||||||
public void update(GameContainer gc, StateBasedGame sbg, int delta_t) {
|
public void update(GameContainer gc, StateBasedGame sbg, int delta_t) {
|
||||||
setAppTitle();
|
setAppTitle();
|
||||||
|
|
||||||
|
// GL at after_sunrise-noon_before_sunset
|
||||||
|
//map.setGlobalLight();
|
||||||
|
|
||||||
GameController.processInput(gc.getInput());
|
GameController.processInput(gc.getInput());
|
||||||
|
|
||||||
TileStat.update();
|
TileStat.update();
|
||||||
@@ -376,4 +391,13 @@ public class Game extends BasicGameState {
|
|||||||
public long getTotalVMMem() {
|
public long getTotalVMMem() {
|
||||||
return totalVMMem;
|
return totalVMMem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getSunlightColtemp() {
|
||||||
|
int half_today = WorldTime.DAY_LENGTH / 2;
|
||||||
|
int timeToday = WorldTime.elapsedSeconds();
|
||||||
|
float sunAlt = (timeToday < half_today) ?
|
||||||
|
timeToday / half_today * FastMath.PI
|
||||||
|
: 0f;
|
||||||
|
return Math.round(ENV_COLTEMP_SUNRISE + (ENV_SUNLIGHT_DELTA * FastMath.sin(sunAlt)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.Torvald.Terrarum.GameItem
|
|
||||||
|
|
||||||
import java.util.*
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by minjaesong on 16-03-15.
|
|
||||||
*/
|
|
||||||
object ItemCodex {
|
|
||||||
/**
|
|
||||||
* <ItemID or RefID for Actor, TheItem>
|
|
||||||
* Will return corresponding Actor if ID >= 32768
|
|
||||||
*/
|
|
||||||
private val itemCodex: HashMap<Long, InventoryItem> = HashMap(
|
|
||||||
// hashmap init here
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
fun getItem(code: Long): InventoryItem {
|
|
||||||
return itemCodex[code]!!
|
|
||||||
}
|
|
||||||
}
|
|
||||||
43
src/com/Torvald/Terrarum/GameItem/ItemPropCodex.kt
Normal file
43
src/com/Torvald/Terrarum/GameItem/ItemPropCodex.kt
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
package com.Torvald.Terrarum.GameItem
|
||||||
|
|
||||||
|
import com.Torvald.Terrarum.Actors.CanBeStoredAsItem
|
||||||
|
import com.Torvald.Terrarum.Terrarum
|
||||||
|
import org.newdawn.slick.GameContainer
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 16-03-15.
|
||||||
|
*/
|
||||||
|
object ItemPropCodex {
|
||||||
|
|
||||||
|
val CSV_PATH = "./src/com/Torvald/Terrarum/ItemProperties/itemprop.csv"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <ItemID or RefID for Actor, TheItem>
|
||||||
|
* Will return corresponding Actor if ID >= 32768
|
||||||
|
*/
|
||||||
|
private lateinit var itemCodex: Array<InventoryItem>
|
||||||
|
|
||||||
|
@JvmStatic val ITEM_UNIQUE_MAX = 32768
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun buildItemProp() {
|
||||||
|
itemCodex = arrayOf<InventoryItem>()
|
||||||
|
|
||||||
|
// read prop in csv
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getItem(code: Long): InventoryItem {
|
||||||
|
if (code < ITEM_UNIQUE_MAX)
|
||||||
|
return itemCodex[code as Int]!!
|
||||||
|
else {
|
||||||
|
for (actor in Terrarum.game.actorContainer) {
|
||||||
|
if (actor is CanBeStoredAsItem && actor.referenceID!!.equals(code))
|
||||||
|
return actor.itemData
|
||||||
|
}
|
||||||
|
|
||||||
|
throw NullPointerException()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
38
src/com/Torvald/Terrarum/GameItem/TileAsItem.kt
Normal file
38
src/com/Torvald/Terrarum/GameItem/TileAsItem.kt
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
package com.Torvald.Terrarum.GameItem
|
||||||
|
|
||||||
|
import com.Torvald.Terrarum.TileProperties.TilePropCodex
|
||||||
|
import org.newdawn.slick.GameContainer
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 16-03-15.
|
||||||
|
*/
|
||||||
|
class TileAsItem(tileNum: Int) : InventoryItem {
|
||||||
|
|
||||||
|
override var itemID: Long = -1
|
||||||
|
override var weight: Float = 0f
|
||||||
|
|
||||||
|
init {
|
||||||
|
itemID = tileNum as Long
|
||||||
|
weight = TilePropCodex.getProp(tileNum).density / 1000f
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun effectWhileInPocket(gc: GameContainer, delta_t: Int) {
|
||||||
|
throw UnsupportedOperationException()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun effectWhenPickedUp(gc: GameContainer, delta_t: Int) {
|
||||||
|
throw UnsupportedOperationException()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun primaryUse(gc: GameContainer, delta_t: Int) {
|
||||||
|
throw UnsupportedOperationException()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun secondaryUse(gc: GameContainer, delta_t: Int) {
|
||||||
|
throw UnsupportedOperationException()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun effectWhenThrownAway(gc: GameContainer, delta_t: Int) {
|
||||||
|
throw UnsupportedOperationException()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,25 +7,28 @@ import java.io.Serializable;
|
|||||||
*/
|
*/
|
||||||
public class WorldTime {
|
public class WorldTime {
|
||||||
|
|
||||||
private int seconds = 0;
|
private static int seconds = 0;
|
||||||
private int minutes = 0;
|
private static int minutes = 0;
|
||||||
private int hours = 0;
|
private static int hours = 0;
|
||||||
|
|
||||||
private int daysCount = 0; //NOT a calendar day
|
private static int daysCount = 0; //NOT a calendar day
|
||||||
|
|
||||||
private int days = 1;
|
private static int days = 1;
|
||||||
private int months = 1;
|
private static int months = 1;
|
||||||
private int years = 1;
|
private static int years = 1;
|
||||||
|
|
||||||
private int dayOfWeek = 0; //0: Mondag-The first day of weekday
|
private static int dayOfWeek = 0; //0: Mondag-The first day of weekday
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 22h
|
||||||
|
*/
|
||||||
public static transient final int DAY_LENGTH = 79200; //must be the multiple of 3600
|
public static transient final int DAY_LENGTH = 79200; //must be the multiple of 3600
|
||||||
private int timeDelta = 1;
|
private static int timeDelta = 1;
|
||||||
|
|
||||||
private static transient final int HOUR_SEC = 3600;
|
private static transient final int HOUR_SEC = 3600;
|
||||||
private static transient final int MINUTE_SEC = 60;
|
private static transient final int MINUTE_SEC = 60;
|
||||||
|
|
||||||
public final String[] DAYNAMES = { //daynames are taken from Nynorsk (å -> o)
|
public static final String[] DAYNAMES = { //daynames are taken from Nynorsk (å -> o)
|
||||||
"Mondag"
|
"Mondag"
|
||||||
,"Tysdag"
|
,"Tysdag"
|
||||||
,"Midtedag" //From Islenska Miðvikudagur
|
,"Midtedag" //From Islenska Miðvikudagur
|
||||||
@@ -35,7 +38,7 @@ public class WorldTime {
|
|||||||
,"Sundag"
|
,"Sundag"
|
||||||
,"Verdag" //From Norsk word 'verd'
|
,"Verdag" //From Norsk word 'verd'
|
||||||
};
|
};
|
||||||
public final String[] DAYNAMES_SHORT = {
|
public static final String[] DAYNAMES_SHORT = {
|
||||||
"Mon"
|
"Mon"
|
||||||
,"Tys"
|
,"Tys"
|
||||||
,"Mid"
|
,"Mid"
|
||||||
@@ -52,7 +55,7 @@ public class WorldTime {
|
|||||||
/**
|
/**
|
||||||
* Note: Target FPS must be 60.
|
* Note: Target FPS must be 60.
|
||||||
*/
|
*/
|
||||||
public void update(){
|
public static void update(){
|
||||||
//time
|
//time
|
||||||
seconds += timeDelta;
|
seconds += timeDelta;
|
||||||
|
|
||||||
@@ -87,10 +90,11 @@ public class WorldTime {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How much time has passed today, in seconds.
|
* How much time has passed today, in seconds. <br />
|
||||||
|
* 0 == 6 AM
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int elapsedSeconds(){
|
public static int elapsedSeconds(){
|
||||||
return (HOUR_SEC * hours + MINUTE_SEC * minutes + seconds) % DAY_LENGTH;
|
return (HOUR_SEC * hours + MINUTE_SEC * minutes + seconds) % DAY_LENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,34 +102,34 @@ public class WorldTime {
|
|||||||
* How much time has passed since the beginning, in seconds.
|
* How much time has passed since the beginning, in seconds.
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public long totalSeconds(){
|
public static long totalSeconds(){
|
||||||
return (long)(DAY_LENGTH) * daysCount + HOUR_SEC * hours + MINUTE_SEC * minutes + seconds;
|
return (long)(DAY_LENGTH) * daysCount + HOUR_SEC * hours + MINUTE_SEC * minutes + seconds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLeapYear(){
|
public static boolean isLeapYear(){
|
||||||
return ((years % 4 == 0) && (years % 100 != 0)) || (years % 400 == 0);
|
return ((years % 4 == 0) && (years % 100 != 0)) || (years % 400 == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(int t){
|
public static void setTime(int t){
|
||||||
days += t / DAY_LENGTH;
|
days += t / DAY_LENGTH;
|
||||||
hours = t / HOUR_SEC;
|
hours = t / HOUR_SEC;
|
||||||
minutes = (t - HOUR_SEC * hours) / MINUTE_SEC;
|
minutes = (t - HOUR_SEC * hours) / MINUTE_SEC;
|
||||||
seconds = t - minutes * MINUTE_SEC;
|
seconds = t - minutes * MINUTE_SEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTime(int t){
|
public static void addTime(int t){
|
||||||
setTime(elapsedSeconds() + t);
|
setTime(elapsedSeconds() + t);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTimeDelta(int d){
|
public static void setTimeDelta(int d){
|
||||||
timeDelta = (d == 0) ? 1 : d;
|
timeDelta = (d == 0) ? 1 : d;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDayName(){
|
public static String getDayName(){
|
||||||
return DAYNAMES[dayOfWeek];
|
return DAYNAMES[dayOfWeek];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void kickVariables() {
|
private static void kickVariables() {
|
||||||
if (seconds >= 60){
|
if (seconds >= 60){
|
||||||
seconds = 0;
|
seconds = 0;
|
||||||
minutes++;
|
minutes++;
|
||||||
|
|||||||
6
src/com/Torvald/Terrarum/MapDrawer/LightmapLantern.kt
Normal file
6
src/com/Torvald/Terrarum/MapDrawer/LightmapLantern.kt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
package com.Torvald.Terrarum.MapDrawer
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 16-03-15.
|
||||||
|
*/
|
||||||
|
internal data class LightmapLantern(var x: Int, var y: Int, var intensity: Char)
|
||||||
@@ -3,6 +3,7 @@ package com.Torvald.Terrarum.MapDrawer
|
|||||||
import com.Torvald.ColourUtil.Col40
|
import com.Torvald.ColourUtil.Col40
|
||||||
import com.Torvald.Terrarum.Actors.ActorWithBody
|
import com.Torvald.Terrarum.Actors.ActorWithBody
|
||||||
import com.Torvald.Terrarum.Actors.Luminous
|
import com.Torvald.Terrarum.Actors.Luminous
|
||||||
|
import com.Torvald.Terrarum.GameMap.WorldTime
|
||||||
import com.Torvald.Terrarum.Terrarum
|
import com.Torvald.Terrarum.Terrarum
|
||||||
import com.Torvald.Terrarum.TileProperties.TilePropCodex
|
import com.Torvald.Terrarum.TileProperties.TilePropCodex
|
||||||
import com.jme3.math.FastMath
|
import com.jme3.math.FastMath
|
||||||
@@ -714,5 +715,3 @@ object LightmapRenderer {
|
|||||||
return Col40().createSlickColor(raw.toInt())
|
return Col40().createSlickColor(raw.toInt())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal data class LightmapLantern(var x: Int, var y: Int, var intensity: Char)
|
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ object MapDrawer {
|
|||||||
@JvmStatic private val ENV_COLTEMP_LOWEST = 5500
|
@JvmStatic private val ENV_COLTEMP_LOWEST = 5500
|
||||||
@JvmStatic private val ENV_COLTEMP_HIGHEST = 7500
|
@JvmStatic private val ENV_COLTEMP_HIGHEST = 7500
|
||||||
|
|
||||||
@JvmStatic private val ENV_COLTEMP_GOLDEN_HOUR = 5000
|
@JvmStatic val ENV_COLTEMP_NOON = 6500
|
||||||
@JvmStatic private val ENV_COLTEMP_NOON = 6500
|
|
||||||
|
|
||||||
private var colTemp: Int = 0
|
private var colTemp: Int = 0
|
||||||
|
|
||||||
@@ -54,9 +53,8 @@ object MapDrawer {
|
|||||||
val zoom = Terrarum.game.screenZoom
|
val zoom = Terrarum.game.screenZoom
|
||||||
|
|
||||||
g.color = getColourFromMap(colTemp)
|
g.color = getColourFromMap(colTemp)
|
||||||
|
//g.color = getColourFromMap(3022)
|
||||||
g.fillRect(MapCamera.getCameraX() * zoom, MapCamera.getCameraY() * zoom, Terrarum.WIDTH * if (zoom < 1) 1f / zoom else zoom, Terrarum.HEIGHT * if (zoom < 1) 1f / zoom else zoom)
|
g.fillRect(MapCamera.getCameraX() * zoom, MapCamera.getCameraY() * zoom, Terrarum.WIDTH * if (zoom < 1) 1f / zoom else zoom, Terrarum.HEIGHT * if (zoom < 1) 1f / zoom else zoom)
|
||||||
|
|
||||||
// TODO colour overlay by sun position (5000-morning -> 6500-noon -> 5000-twilight)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -71,7 +69,8 @@ object MapDrawer {
|
|||||||
return Math.round((ENV_COLTEMP_HIGHEST - ENV_COLTEMP_LOWEST) / 2 * FastMath.clamp(x, -1f, 1f) + colTempMedian)
|
return Math.round((ENV_COLTEMP_HIGHEST - ENV_COLTEMP_LOWEST) / 2 * FastMath.clamp(x, -1f, 1f) + colTempMedian)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getColourFromMap(K: Int): Color {
|
@JvmStatic
|
||||||
|
fun getColourFromMap(K: Int): Color {
|
||||||
return envOverlayColourmap.getColor(colTempToImagePos(K), 0)
|
return envOverlayColourmap.getColor(colTempToImagePos(K), 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ object MapGenerator {
|
|||||||
private lateinit var map: GameMap
|
private lateinit var map: GameMap
|
||||||
private lateinit var random: Random
|
private lateinit var random: Random
|
||||||
//private static float[] noiseArray;
|
//private static float[] noiseArray;
|
||||||
private var seed: Long = 0
|
private var seed: Long? = null
|
||||||
private var width: Int = 0
|
private var width: Int = 0
|
||||||
private var height: Int = 0
|
private var height: Int = 0
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ object MapGenerator {
|
|||||||
*/
|
*/
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
fun generateMap() {
|
fun generateMap() {
|
||||||
random = HQRNG(seed)
|
random = HQRNG(seed!!)
|
||||||
println("[MapGenerator] Seed: " + seed)
|
println("[MapGenerator] Seed: " + seed)
|
||||||
|
|
||||||
worldOceanPosition = if (random.nextBoolean()) TYPE_OCEAN_LEFT else TYPE_OCEAN_RIGHT
|
worldOceanPosition = if (random.nextBoolean()) TYPE_OCEAN_LEFT else TYPE_OCEAN_RIGHT
|
||||||
@@ -216,8 +216,8 @@ object MapGenerator {
|
|||||||
private fun caveGen(xStretch: Float, yStretch: Float): Array<FloatArray> {
|
private fun caveGen(xStretch: Float, yStretch: Float): Array<FloatArray> {
|
||||||
val noiseMap = Array(height) { FloatArray(width) }
|
val noiseMap = Array(height) { FloatArray(width) }
|
||||||
|
|
||||||
val simplexNoise = SimplexNoise(CAVEGEN_LARGEST_FEATURE, CAVEGEN_PERTURB_RATE, seed)
|
val simplexNoise = SimplexNoise(CAVEGEN_LARGEST_FEATURE, CAVEGEN_PERTURB_RATE, seed!!)
|
||||||
val simplexNoisePerturbMap = SimplexNoise(CAVEGEN_LARGEST_FEATURE_PERTURB, 0.5f, seed xor random.nextLong())
|
val simplexNoisePerturbMap = SimplexNoise(CAVEGEN_LARGEST_FEATURE_PERTURB, 0.5f, seed!! xor random.nextLong())
|
||||||
|
|
||||||
val xEnd = width * yStretch
|
val xEnd = width * yStretch
|
||||||
val yEnd = height * xStretch
|
val yEnd = height * xStretch
|
||||||
@@ -283,7 +283,7 @@ object MapGenerator {
|
|||||||
* @return matrix in ![x][y]!
|
* @return matrix in ![x][y]!
|
||||||
*/
|
*/
|
||||||
private fun generate2DSimplexNoise(sizeX: Int, sizeY: Int, xStretch: Float, yStretch: Float): Array<FloatArray> {
|
private fun generate2DSimplexNoise(sizeX: Int, sizeY: Int, xStretch: Float, yStretch: Float): Array<FloatArray> {
|
||||||
val simplexNoise = SimplexNoise(CAVE_LARGEST_FEATURE, 0.1f, seed xor random.nextLong())
|
val simplexNoise = SimplexNoise(CAVE_LARGEST_FEATURE, 0.1f, seed!! xor random.nextLong())
|
||||||
|
|
||||||
val xStart = 0f
|
val xStart = 0f
|
||||||
val yStart = 0f
|
val yStart = 0f
|
||||||
@@ -524,7 +524,7 @@ object MapGenerator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun perturbTerrain() {
|
private fun perturbTerrain() {
|
||||||
val perturbGen = SimplexNoise(TERRAIN_PERTURB_LARGESTFEATURE, TERRAIN_PERTURB_RATE, seed xor random.nextLong())
|
val perturbGen = SimplexNoise(TERRAIN_PERTURB_LARGESTFEATURE, TERRAIN_PERTURB_RATE, seed!! xor random.nextLong())
|
||||||
|
|
||||||
val perturbMap = Array(height) { FloatArray(width) }
|
val perturbMap = Array(height) { FloatArray(width) }
|
||||||
|
|
||||||
@@ -960,7 +960,7 @@ object MapGenerator {
|
|||||||
|
|
||||||
private fun fillOcean() {
|
private fun fillOcean() {
|
||||||
val thisSandList = intArrayOf(TileNameCode.SAND_BEACH, TileNameCode.SAND_BLACK, TileNameCode.SAND_GREEN, TileNameCode.SAND_BEACH, TileNameCode.SAND_BEACH, TileNameCode.SAND_BLACK)
|
val thisSandList = intArrayOf(TileNameCode.SAND_BEACH, TileNameCode.SAND_BLACK, TileNameCode.SAND_GREEN, TileNameCode.SAND_BEACH, TileNameCode.SAND_BEACH, TileNameCode.SAND_BLACK)
|
||||||
val thisRand = HQRNG(seed xor random.nextLong())
|
val thisRand = HQRNG(seed!! xor random.nextLong())
|
||||||
val thisSand = thisSandList[thisRand.nextInt(thisSandList.size)]
|
val thisSand = thisSandList[thisRand.nextInt(thisSandList.size)]
|
||||||
|
|
||||||
val thisSandStr = if (thisSand == TileNameCode.SAND_BLACK)
|
val thisSandStr = if (thisSand == TileNameCode.SAND_BLACK)
|
||||||
@@ -1063,6 +1063,11 @@ object MapGenerator {
|
|||||||
return TERRAIN_AVERAGE_HEIGHT - heightMap!![x]
|
return TERRAIN_AVERAGE_HEIGHT - heightMap!![x]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun getGeneratorSeed(): Long {
|
||||||
|
return seed!!
|
||||||
|
}
|
||||||
|
|
||||||
/* Utility */
|
/* Utility */
|
||||||
|
|
||||||
private fun clampN(clampNumber: Int, num: Int): Int {
|
private fun clampN(clampNumber: Int, num: Int): Int {
|
||||||
|
|||||||
44
src/com/Torvald/Terrarum/MapGenerator/RoguelikeRandomiser.kt
Normal file
44
src/com/Torvald/Terrarum/MapGenerator/RoguelikeRandomiser.kt
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
package com.Torvald.Terrarum.MapGenerator
|
||||||
|
|
||||||
|
import com.Torvald.ColourUtil.Col4096
|
||||||
|
import com.Torvald.Rand.HQRNG
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 16-03-15.
|
||||||
|
*/
|
||||||
|
object RoguelikeRandomiser {
|
||||||
|
|
||||||
|
private val POTION_PRIMARY_COLSET = intArrayOf(15, 15, 7, 7, 0, 0)
|
||||||
|
|
||||||
|
private var potionColours: HashMap<Int, Col4096> = HashMap()
|
||||||
|
private var coloursDiscovered: HashMap<Col4096, Boolean> = HashMap()
|
||||||
|
|
||||||
|
val coloursTaken: ArrayList<Col4096> = ArrayList()
|
||||||
|
|
||||||
|
private var seed: Long? = null
|
||||||
|
private val random: Random = HQRNG()
|
||||||
|
|
||||||
|
private val POTION_HEAL_TIER1 = 0x00
|
||||||
|
private val POTION_HEAL_TIRE2 = 0x01
|
||||||
|
|
||||||
|
private val POTION_MAGIC_REGEN_TIER1 = 0x10
|
||||||
|
|
||||||
|
private val POTION_BERSERK_TIER1 = 0x20
|
||||||
|
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun setSeed(seed: Long) {
|
||||||
|
this.seed = seed
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun setupColours() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun getGeneratorSeed(): Long {
|
||||||
|
return seed!!
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.Torvald.Terrarum;
|
|
||||||
|
|
||||||
import com.Torvald.ColourUtil.Col4096;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by minjaesong on 16-02-23.
|
|
||||||
*/
|
|
||||||
public class RoguelikeRandomiser {
|
|
||||||
|
|
||||||
private static transient final int[] POTION_PRIMARY_COLSET = {15, 15, 8, 8, 0, 0};
|
|
||||||
|
|
||||||
private static HashMap<Integer, Col4096> potionColours;
|
|
||||||
private static HashMap<Col4096, Boolean> coloursDiscovered;
|
|
||||||
|
|
||||||
private static ArrayList<Col4096> coloursTaken;
|
|
||||||
|
|
||||||
|
|
||||||
private static transient final int POTION_HEAL_TIER1 = 0x00;
|
|
||||||
private static transient final int POTION_HEAL_TIRE2 = 0x01;
|
|
||||||
|
|
||||||
private static transient final int POTION_MAGIC_REGEN_TIER1 = 0x10;
|
|
||||||
|
|
||||||
private static transient final int POTION_BERSERK_TIER1 = 0x20;
|
|
||||||
|
|
||||||
public RoguelikeRandomiser() {
|
|
||||||
potionColours = new HashMap<>();
|
|
||||||
coloursTaken = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -6,12 +6,13 @@
|
|||||||
|
|
||||||
Byte[4] TESV Magic
|
Byte[4] TESV Magic
|
||||||
Byte[n] name Savegame name, UTF-8
|
Byte[n] name Savegame name, UTF-8
|
||||||
Byte null String terminator
|
Byte NULL String terminator
|
||||||
Byte[8] terraseed Terrain seed
|
Byte[8] terraseed Terrain seed
|
||||||
Byte[8] rogueseed Randomiser seed
|
Byte[8] rogueseed Randomiser seed
|
||||||
Byte[32] hash1 SHA-256 hash of worldinfo1 being stored
|
Byte[32] hash1 SHA-256 hash of worldinfo1 being stored
|
||||||
Byte[32] hash2 SHA-256 hash of worldinfo2 being stored
|
Byte[32] hash2 SHA-256 hash of worldinfo2 being stored
|
||||||
Byte[32] hash4 SHA-256 hash of worldinfo3 beihg stored (TEMD data) [32, 214, 42, 3, 76, ...]
|
Byte[32] hash3 SHA-256 hash of worldinfo3 being stored
|
||||||
|
Byte[32] hash4 SHA-256 hash of worldinfo4 being stored (TEMD data) [32, 214, 42, 3, 76, ...]
|
||||||
|
|
||||||
|
|
||||||
* Actor data
|
* Actor data
|
||||||
@@ -22,7 +23,9 @@
|
|||||||
* Prop data
|
* Prop data
|
||||||
- GZip'd CSV
|
- GZip'd CSV
|
||||||
- Filename : worldinfo1 -- tileprop.csv
|
- Filename : worldinfo1 -- tileprop.csv
|
||||||
worldinfo2 -- itemprop.csv (with no extension)
|
worldinfo2 -- itemprop.csv
|
||||||
|
worldinfo3 -- materialprop.csv
|
||||||
|
(with no extension)
|
||||||
|
|
||||||
|
|
||||||
* Roguelike randomiser data
|
* Roguelike randomiser data
|
||||||
@@ -33,6 +36,7 @@
|
|||||||
* Human-readable
|
* Human-readable
|
||||||
- Tiles_list.txt -- list of tiles in csv
|
- Tiles_list.txt -- list of tiles in csv
|
||||||
- Items_list.txt -- list of items in csv
|
- Items_list.txt -- list of items in csv
|
||||||
|
- Materials_list.txt -- list of materials in csv
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -50,4 +54,5 @@
|
|||||||
--- world save meta
|
--- world save meta
|
||||||
--- worldinfo1 tileprop
|
--- worldinfo1 tileprop
|
||||||
--- worldinfo2 itemprop
|
--- worldinfo2 itemprop
|
||||||
--- worldinfo3 TEMD binary
|
--- worldinfo3 materialprop
|
||||||
|
--- worldinfo4 TEMD binary
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ public class TilePropCodex {
|
|||||||
|
|
||||||
private static TileProp[] tileProps;
|
private static TileProp[] tileProps;
|
||||||
|
|
||||||
|
public static final String CSV_PATH = "./src/com/Torvald/Terrarum/TileProperties/tileprop.csv";
|
||||||
|
|
||||||
public TilePropCodex() {
|
public TilePropCodex() {
|
||||||
tileProps = new TileProp[MapLayer.RANGE * (PairedMapLayer.RANGE)];
|
tileProps = new TileProp[MapLayer.RANGE * (PairedMapLayer.RANGE)];
|
||||||
|
|
||||||
@@ -24,8 +26,7 @@ public class TilePropCodex {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// todo verify CSV using pre-calculated SHA256 hash
|
// todo verify CSV using pre-calculated SHA256 hash
|
||||||
List<CSVRecord> records = CSVFetcher.readCSV("" +
|
List<CSVRecord> records = CSVFetcher.readCSV(CSV_PATH);
|
||||||
"./src/com/Torvald/Terrarum/TileProperties/tileprop.csv");
|
|
||||||
|
|
||||||
System.out.println("[TilePropCodex] Building tile properties table");
|
System.out.println("[TilePropCodex] Building tile properties table");
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
package com.Torvald.Terrarum.UserInterface;
|
|
||||||
|
|
||||||
import org.newdawn.slick.GameContainer;
|
|
||||||
import org.newdawn.slick.Graphics;
|
|
||||||
import org.newdawn.slick.Input;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by minjaesong on 15-12-31. <br>
|
|
||||||
*/
|
|
||||||
public interface UICanvas {
|
|
||||||
|
|
||||||
int getWidth();
|
|
||||||
|
|
||||||
int getHeight();
|
|
||||||
|
|
||||||
void update(GameContainer gc, int delta_t);
|
|
||||||
|
|
||||||
void render(GameContainer gc, Graphics g);
|
|
||||||
|
|
||||||
void processInput(Input input);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
package com.Torvald.Terrarum.UserInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by minjaesong on 16-03-06.
|
|
||||||
*/
|
|
||||||
public interface UIClickable {
|
|
||||||
|
|
||||||
void mouseMoved(int oldx, int oldy, int newx, int newy);
|
|
||||||
|
|
||||||
void mouseDragged(int oldx, int oldy, int newx, int newy);
|
|
||||||
|
|
||||||
void mousePressed(int button, int x, int y);
|
|
||||||
|
|
||||||
void mouseReleased(int button, int x, int y);
|
|
||||||
|
|
||||||
void mouseWheelMoved(int change);
|
|
||||||
|
|
||||||
void controllerButtonPressed(int controller, int button);
|
|
||||||
|
|
||||||
void controllerButtonReleased(int controller, int button);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.Torvald.Terrarum.UserInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by minjaesong on 16-03-06.
|
|
||||||
*/
|
|
||||||
public interface UITypable {
|
|
||||||
|
|
||||||
void keyPressed(int key, char c);
|
|
||||||
|
|
||||||
void keyReleased(int key, char c);
|
|
||||||
|
|
||||||
}
|
|
||||||
BIN
work_files/sky colour.numbers
Normal file
BIN
work_files/sky colour.numbers
Normal file
Binary file not shown.
Reference in New Issue
Block a user