mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 04:54:05 +09:00
replacing min/max usage with kotlin's
This commit is contained in:
@@ -545,7 +545,7 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
|
||||
|
||||
if (hasPlatformOnTheFeet) {
|
||||
// equation copied verbatim from the ActorWthBody.forEachFeetTile
|
||||
val y = hitbox.endY.plus(1.0).div(TerrarumAppConfiguration.TILE_SIZE).floorInt()
|
||||
val y = hitbox.endY.plus(1.0).div(TerrarumAppConfiguration.TILE_SIZE).floorToInt()
|
||||
var wxStart = hIntTilewiseHitbox.startX.toInt()
|
||||
var wxEnd = wxStart
|
||||
// scan to the left
|
||||
|
||||
@@ -69,8 +69,8 @@ internal class FixtureTapestry : FixtureBase {
|
||||
Pixmap(ModMgr.getGdxFilesFromEveryMod("tapestries/common/canvas.tga").last().second)
|
||||
} as Pixmap
|
||||
|
||||
tilewiseHitboxWidth = pixmap.width.div(TILE_SIZEF).ceilInt()
|
||||
tilewiseHitboxHeight = pixmap.height.div(TILE_SIZEF).ceilInt()
|
||||
tilewiseHitboxWidth = pixmap.width.div(TILE_SIZEF).ceilToInt()
|
||||
tilewiseHitboxHeight = pixmap.height.div(TILE_SIZEF).ceilToInt()
|
||||
|
||||
// blend canvas texture
|
||||
for (y in 0 until pixmap.height) { for (x in 0 until pixmap.width) {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors.physicssolver
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.abs
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.sqr
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -202,9 +204,6 @@ object CollisionSolver {
|
||||
return (t_ax.sqr() + t_ay.sqr()) < actor_dist_t_sqr
|
||||
}
|
||||
|
||||
fun Double.abs() = if (this < 0) -this else this
|
||||
fun Double.sqr() = this * this
|
||||
|
||||
data class CollisionMarkings(
|
||||
val pos: Double,
|
||||
val kind: Int,
|
||||
|
||||
Reference in New Issue
Block a user