gson test in progress

This commit is contained in:
minjaesong
2019-02-22 04:26:19 +09:00
parent f24ddb5c82
commit 53737bd746
46 changed files with 379 additions and 3061 deletions

View File

@@ -153,7 +153,7 @@ open class ActorHumanoid(
get() = if (Terrarum.ingame == null) false else this == Terrarum.ingame!!.actorNowPlaying
private val nullItem = object : GameItem() {
@Transient private val nullItem = object : GameItem() {
override var dynamicID: Int = 0
override val originalID = dynamicID
override val isUnique: Boolean = false

View File

@@ -20,14 +20,16 @@ import java.util.concurrent.locks.ReentrantLock
* Created by minjaesong on 2016-03-15.
*/
class ActorInventory(val actor: Pocketed, var maxCapacity: Int, var capacityMode: Int) {
class ActorInventory(@Transient val actor: Pocketed, var maxCapacity: Int, var capacityMode: Int) {
companion object {
@Transient val CAPACITY_MODE_NO_ENCUMBER = 0
@Transient val CAPACITY_MODE_COUNT = 1
@Transient val CAPACITY_MODE_WEIGHT = 2
val CAPACITY_MODE_NO_ENCUMBER = 0
val CAPACITY_MODE_COUNT = 1
val CAPACITY_MODE_WEIGHT = 2
}
// FIXME unless absolutely necessary, don't store full item object; only store its dynamicID
/**
* List of all equipped items (tools, armours, rings, necklaces, etc.)
*/
@@ -265,8 +267,8 @@ class ActorInventory(val actor: Pocketed, var maxCapacity: Int, var capacityMode
arr[j + 1] = x
}
}
private val STATIC_ID = 41324534
private val DYNAMIC_ID = 181643953
@Transient private val STATIC_ID = 41324534
@Transient private val DYNAMIC_ID = 181643953
private fun ArrayList<InventoryPair>.binarySearch(ID: ItemID, searchBy: Int): Int {
// code from collections/Collections.kt
var low = 0

View File

@@ -31,8 +31,8 @@ open class ParticleBase(renderOrder: Actor.RenderOrder, val despawnUponCollision
private val lifetimeMax = maxLifeTime ?: 5f
private var lifetimeCounter = 0f
open val velocity = Vector2(0.0, 0.0)
open val hitbox = Hitbox(0.0, 0.0, 0.0, 0.0)
val velocity = Vector2(0.0, 0.0)
val hitbox = Hitbox(0.0, 0.0, 0.0, 0.0)
open lateinit var body: TextureRegion // you might want to use SpriteAnimation
open var glow: TextureRegion? = null
@@ -61,7 +61,7 @@ open class ParticleBase(renderOrder: Actor.RenderOrder, val despawnUponCollision
// gravity, winds, etc. (external forces)
if (!isNoSubjectToGrav) {
velocity += (Terrarum.ingame!!.world).gravitation / dragCoefficient
velocity.plusAssign((Terrarum.ingame!!.world).gravitation / dragCoefficient)
}

View File

@@ -1,7 +1,5 @@
package net.torvald.terrarum.modulebasegame.gameactors
import net.torvald.terrarum.gameactors.Controllable
/**
* A wrapper to support instant player changing (or possessing other NPCs maybe)
*
@@ -9,7 +7,7 @@ import net.torvald.terrarum.gameactors.Controllable
* Created by minjaesong on 2016-10-23.
*/
@Deprecated("The ingame should discriminate 'theRealGamer' and 'actorNowPlaying'")
class PlayableActorDelegate(val actor: ActorHumanoid) {
class PlayableActorDelegate(@Transient val actor: ActorHumanoid) {
/*init {
if (actor !is Controllable)

View File

@@ -9,7 +9,7 @@ import net.torvald.terrarum.Terrarum
class ThreadActorUpdate(val startIndex: Int, val endIndex: Int) : Runnable {
override fun run() {
for (i in startIndex..endIndex) {
val it = Terrarum.ingame!!.actorContainer[i]
val it = Terrarum.ingame!!.actorContainerActive[i]
it.update(AppLoader.UPDATE_RATE.toFloat())
if (it is Pocketed) {

View File

@@ -39,7 +39,7 @@ object CollisionSolver {
collCandidateY.clear()
// mark list x
(Terrarum.ingame!! as Ingame).actorContainer.forEach { it ->
(Terrarum.ingame!! as Ingame).actorContainerActive.forEach { it ->
if (it is ActorWBMovable) {
collListX.add(CollisionMarkings(it.hitbox.hitboxStart.x, STARTPOINT, it))
collListX.add(CollisionMarkings(it.hitbox.hitboxEnd.x, ENDPOINT, it))
@@ -72,7 +72,7 @@ object CollisionSolver {
collCandidateStack.clear()
// mark list y
(Terrarum.ingame!! as Ingame).actorContainer.forEach { it ->
(Terrarum.ingame!! as Ingame).actorContainerActive.forEach { it ->
if (it is ActorWBMovable) {
collListY.add(CollisionMarkings(it.hitbox.hitboxStart.y, STARTPOINT, it))
collListY.add(CollisionMarkings(it.hitbox.hitboxEnd.y, ENDPOINT, it))