mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
reducing down HistoricalFigure to nothing
It doesn't seem like a good idea
This commit is contained in:
@@ -10,9 +10,9 @@ uniform sampler2D u_texture;
|
||||
|
||||
|
||||
// "steps" of R, G and B. Must be integer && equal or greater than 2
|
||||
uniform float rcount = 64.0;
|
||||
uniform float gcount = 64.0;
|
||||
uniform float bcount = 64.0;
|
||||
uniform float rcount = 32.0;
|
||||
uniform float gcount = 32.0;
|
||||
uniform float bcount = 32.0;
|
||||
uniform float acount = 1.0;
|
||||
|
||||
int bayer[14 * 14] = int[](131,187,8,78,50,18,134,89,155,102,29,95,184,73,22,86,113,171,142,105,34,166,9,60,151,128,40,110,168,137,45,28,64,188,82,54,124,189,80,13,156,56,7,61,186,121,154,6,108,177,24,100,38,176,93,123,83,148,96,17,88,133,44,145,69,161,139,72,30,181,115,27,163,47,178,65,164,14,120,48,5,127,153,52,190,58,126,81,116,21,106,77,173,92,191,63,99,12,76,144,4,185,37,149,192,39,135,23,117,31,170,132,35,172,103,66,129,79,3,97,57,159,70,141,53,94,114,20,49,158,19,146,169,122,183,11,104,180,2,165,152,87,182,118,91,42,67,25,84,147,43,85,125,68,16,136,71,10,193,112,160,138,51,111,162,26,194,46,174,107,41,143,33,74,1,101,195,15,75,140,109,90,32,62,157,98,167,119,179,59,36,130,175,55,0,150);
|
||||
@@ -110,7 +110,9 @@ public class AppLoader implements ApplicationListener {
|
||||
|
||||
|
||||
private static ShaderProgram shaderBayerSkyboxFill;
|
||||
public static ShaderProgram shader18Bit;
|
||||
public static ShaderProgram shaderHicolour;
|
||||
public static ShaderProgram shaderColLUT;
|
||||
|
||||
public static Mesh fullscreenQuad;
|
||||
private OrthographicCamera camera;
|
||||
private SpriteBatch logoBatch;
|
||||
@@ -147,8 +149,8 @@ public class AppLoader implements ApplicationListener {
|
||||
|
||||
|
||||
shaderBayerSkyboxFill = new ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/4096_bayer_skyboxfill.frag"));
|
||||
|
||||
shader18Bit = new ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/18BitColour.frag"));
|
||||
shaderHicolour = new ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/hicolour.frag"));
|
||||
shaderColLUT = new ShaderProgram(Gdx.files.internal("assets/4096.vert"), Gdx.files.internal("assets/passthru.frag"));
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package net.torvald.terrarum
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.GL20
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
@@ -49,7 +48,7 @@ object PostProcessor {
|
||||
Gdx.gl.glEnable(GL20.GL_BLEND)
|
||||
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA)
|
||||
|
||||
val shader = AppLoader.shader18Bit
|
||||
val shader = AppLoader.shaderHicolour
|
||||
|
||||
// no-screen screen renders but the game don't? wtf?
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ class TitleScreen(val batch: SpriteBatch) : Screen {
|
||||
})
|
||||
|
||||
|
||||
cameraPlayer = object : HumanoidNPC(demoWorld, cameraAI, GameDate(1, 1), usePhysics = false, forceAssignRefID = Player.PLAYER_REF_ID) {
|
||||
cameraPlayer = object : HumanoidNPC(demoWorld, cameraAI, born = 0, usePhysics = false, forceAssignRefID = Player.PLAYER_REF_ID) {
|
||||
init {
|
||||
setHitboxDimension(2, 2, 0, 0)
|
||||
hitbox.setPosition(
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.itemproperties.GameItem
|
||||
import net.torvald.terrarum.itemproperties.Material
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
import net.torvald.terrarum.modulebasegame.gameworld.time_t
|
||||
import net.torvald.terrarum.realestate.LandUtil
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull
|
||||
import net.torvald.terrarum.worlddrawer.LightmapRenderer
|
||||
@@ -28,10 +29,10 @@ import java.util.*
|
||||
*/
|
||||
open class ActorHumanoid(
|
||||
world: GameWorld,
|
||||
birth: GameDate,
|
||||
death: GameDate? = null,
|
||||
birth: time_t,
|
||||
death: time_t? = null,
|
||||
usePhysics: Boolean = true
|
||||
) : HistoricalFigure(world, birth, death, usePhysics = usePhysics), Controllable, Pocketed, Factionable, Luminous, LandHolder {
|
||||
) : ActorWithPhysics(world, RenderOrder.MIDDLE, usePhysics = usePhysics), Controllable, Pocketed, Factionable, Luminous, LandHolder, HistoricalFigure {
|
||||
|
||||
|
||||
|
||||
@@ -165,6 +166,11 @@ open class ActorHumanoid(
|
||||
override val material = Material(0,0,0,0,0,0,0,0,0,0.0)
|
||||
}
|
||||
|
||||
init {
|
||||
actorValue[AVKey.__HISTORICAL_BORNTIME] = birth
|
||||
death?.let { actorValue[AVKey.__HISTORICAL_DEADTIME] = death }
|
||||
}
|
||||
|
||||
override fun update(delta: Float) {
|
||||
super.update(delta)
|
||||
|
||||
|
||||
@@ -1,12 +1,5 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
import net.torvald.terrarum.modulebasegame.gameworld.WorldTime
|
||||
|
||||
typealias AnyPlayer = HistoricalFigure
|
||||
|
||||
/**
|
||||
* An actor (NPC) which has life and death,
|
||||
@@ -16,68 +9,9 @@ typealias AnyPlayer = HistoricalFigure
|
||||
*
|
||||
* Created by minjaesong on 2016-10-10.
|
||||
*/
|
||||
open class HistoricalFigure(
|
||||
world: GameWorld,
|
||||
val born: GameDate,
|
||||
val dead: GameDate? = null,
|
||||
realAirFriction: Boolean = false,
|
||||
usePhysics: Boolean = true
|
||||
) : ActorWithPhysics(world, RenderOrder.MIDDLE, realAirFriction, usePhysics) {
|
||||
|
||||
var historicalFigureIdentifier: Int = generateHistoricalFigureIdentifier()
|
||||
internal set
|
||||
|
||||
private fun generateHistoricalFigureIdentifier(): Int {
|
||||
fun hasCollision(value: Int) =
|
||||
try {
|
||||
(Terrarum.ingame!! as Ingame).historicalFigureIDBucket.contains(value)
|
||||
}
|
||||
catch (gameNotInitialisedException: KotlinNullPointerException) {
|
||||
false
|
||||
}
|
||||
|
||||
var ret: Int
|
||||
do {
|
||||
ret = HQRNG().nextInt() // set new ID
|
||||
} while (hasCollision(ret)) // check for collision
|
||||
return ret
|
||||
}
|
||||
interface HistoricalFigure {
|
||||
|
||||
|
||||
init {
|
||||
this.actorValue["_bornyear"] = born.year
|
||||
this.actorValue["_borndays"] = born.yearlyDay
|
||||
|
||||
if (dead != null) {
|
||||
this.actorValue["_deadyear"] = dead.year
|
||||
this.actorValue["_deaddays"] = dead.yearlyDay
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
data class GameDate(val year: Int, val yearlyDay: Int) {
|
||||
operator fun plus(other: GameDate): GameDate {
|
||||
var newyd = this.yearlyDay + other.yearlyDay
|
||||
var newy = this.year + other.year
|
||||
|
||||
if (newyd > WorldTime.YEAR_DAYS) {
|
||||
newyd -= WorldTime.YEAR_DAYS
|
||||
newy += 1
|
||||
}
|
||||
|
||||
return GameDate(newy, newyd)
|
||||
}
|
||||
|
||||
operator fun minus(other: GameDate): GameDate {
|
||||
var newyd = this.yearlyDay - other.yearlyDay
|
||||
var newy = this.year - other.year
|
||||
|
||||
if (newyd < 0) {
|
||||
newyd += WorldTime.YEAR_DAYS
|
||||
newy -= 1
|
||||
}
|
||||
|
||||
return GameDate(newy, newyd)
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,8 @@ import net.torvald.terrarum.gameactors.ai.ActorAI
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.itemproperties.GameItem
|
||||
import net.torvald.terrarum.itemproperties.Material
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorWithPhysics.Companion.COLLISION_DYNAMIC
|
||||
import net.torvald.terrarum.modulebasegame.gameworld.time_t
|
||||
|
||||
/**
|
||||
* @param ai AI class. Use LuaAIWrapper for Lua script
|
||||
@@ -15,7 +17,7 @@ import net.torvald.terrarum.itemproperties.Material
|
||||
open class HumanoidNPC(
|
||||
world: GameWorld,
|
||||
override val ai: ActorAI, // it's there for written-in-Kotlin, "hard-wired" AIs
|
||||
born: GameDate,
|
||||
born: time_t,
|
||||
usePhysics: Boolean = true,
|
||||
forceAssignRefID: Int? = null
|
||||
) : ActorHumanoid(world, born, usePhysics = usePhysics), AIControlled, CanBeAnItem {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.modulebasegame.gameworld.time_t
|
||||
|
||||
|
||||
/**
|
||||
@@ -9,7 +10,7 @@ import net.torvald.terrarum.gameworld.GameWorld
|
||||
* Created by minjaesong on 2015-12-31.
|
||||
*/
|
||||
|
||||
class Player(world: GameWorld, born: GameDate) : ActorHumanoid(world, born) {
|
||||
class Player(world: GameWorld, born: time_t) : ActorHumanoid(world, born) {
|
||||
|
||||
companion object {
|
||||
@Transient const val PLAYER_REF_ID: Int = 0x91A7E2
|
||||
|
||||
@@ -10,7 +10,7 @@ import net.torvald.terrarum.modulebasegame.Ingame
|
||||
object PlayerBuilder {
|
||||
|
||||
operator fun invoke(): Actor {
|
||||
val p: Actor = Player((Terrarum.ingame!! as Ingame).world, (Terrarum.ingame!! as Ingame).world.time.currentTimeAsGameDate)
|
||||
val p: Actor = Player((Terrarum.ingame!! as Ingame).world, (Terrarum.ingame!! as Ingame).world.time.TIME_T)
|
||||
InjectCreatureRaw(p.actorValue, "basegame", "CreatureHuman.json")
|
||||
|
||||
// attach sprite
|
||||
|
||||
@@ -17,7 +17,7 @@ object PlayerBuilderCynthia {
|
||||
val p: HumanoidNPC = HumanoidNPC(
|
||||
(Terrarum.ingame!! as Ingame).world,
|
||||
NullAI(),
|
||||
GameDate(100, 143)) // random value thrown
|
||||
-589141658L) // random value thrown
|
||||
InjectCreatureRaw(p.actorValue, "basegame", "CreatureHuman.json")
|
||||
|
||||
|
||||
|
||||
@@ -15,10 +15,9 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
object PlayerBuilderSigrid {
|
||||
|
||||
operator fun invoke(): Player {
|
||||
val p = Player((Terrarum.ingame!! as Ingame).world, GameDate(-2147483648, 0)) // XD
|
||||
val p = Player((Terrarum.ingame!! as Ingame).world, -9223372036854775807L) // XD
|
||||
|
||||
p.referenceID = 0x51621D // the only constant of this procedural universe
|
||||
p.historicalFigureIdentifier = 0x51621D // the only constant of this procedural universe
|
||||
|
||||
|
||||
p.makeNewSprite(TextureRegionPack(ModMgr.getGdxFile("basegame", "sprites/test_player.tga"), 28, 51))
|
||||
|
||||
@@ -11,7 +11,7 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
*/
|
||||
object PlayerBuilderTestSubject1 {
|
||||
operator fun invoke(): Player {
|
||||
val p: Player = Player((Terrarum.ingame!! as Ingame).world, GameDate(100, 143)) // random value thrown
|
||||
val p: Player = Player((Terrarum.ingame!! as Ingame).world, -589141658L) // random value thrown
|
||||
InjectCreatureRaw(p.actorValue, "basegame", "CreatureHuman.json")
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package net.torvald.terrarum.modulebasegame.gameworld
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.AnyPlayer
|
||||
import net.torvald.terrarum.roundInt
|
||||
import net.torvald.terrarum.worlddrawer.BlocksDrawer
|
||||
import net.torvald.terrarum.worlddrawer.FeaturesDrawer
|
||||
@@ -12,6 +11,7 @@ import net.torvald.terrarum.blockproperties.BlockCodex
|
||||
import net.torvald.terrarum.gameworld.FluidCodex
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.modulebasegame.Ingame
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorHumanoid
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-08-03.
|
||||
@@ -40,7 +40,7 @@ object WorldSimulator {
|
||||
|
||||
private val world = (Terrarum.ingame!! as Ingame).world
|
||||
|
||||
operator fun invoke(p: AnyPlayer?, delta: Float) {
|
||||
operator fun invoke(p: ActorHumanoid?, delta: Float) {
|
||||
if (p != null) {
|
||||
updateXFrom = p.hitbox.centeredX.div(FeaturesDrawer.TILE_SIZE).minus(FLUID_UPDATING_SQUARE_RADIUS).roundInt()
|
||||
updateYFrom = p.hitbox.centeredY.div(FeaturesDrawer.TILE_SIZE).minus(FLUID_UPDATING_SQUARE_RADIUS).roundInt()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameworld
|
||||
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.GameDate
|
||||
|
||||
typealias time_t = Long
|
||||
|
||||
/**
|
||||
* The World Calendar implementation of Dwarven Calendar, except:
|
||||
@@ -108,9 +109,6 @@ class WorldTime(initTime: Long = 0L) {
|
||||
val MONTH_NAMES_SHORT = arrayOf("Opal", "Obsi", "Gran", "Slat", "Fels", "Hema",
|
||||
"Mala", "Gale", "Lime", "Sand", "Timb", "Moon")
|
||||
|
||||
inline val currentTimeAsGameDate: GameDate
|
||||
get() = GameDate(years, yearlyDays)
|
||||
|
||||
companion object {
|
||||
/** Each day is 22-hour long */
|
||||
val DAY_LENGTH = 79200 //must be the multiple of 3600
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameworld
|
||||
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.GameDate
|
||||
|
||||
/**
|
||||
* The World Calendar implementation of Dwarven Calendar (we're talking about DF!)
|
||||
*
|
||||
@@ -49,8 +47,6 @@ class YeOldeWorldTime {
|
||||
val MONTH_NAMES_SHORT = arrayOf("Opal", "Obsi", "Gran", "Slat", "Fels", "Hema",
|
||||
"Mala", "Gale", "Lime", "Sand", "Timb", "Moon")
|
||||
|
||||
val currentTimeAsGameDate: GameDate
|
||||
get() = GameDate(years, yearlyDays)
|
||||
|
||||
@Transient val REAL_SEC_IN_MILLI = 1000
|
||||
|
||||
|
||||
Reference in New Issue
Block a user