multiple lightboxes for luminous actors

Former-commit-id: 7ee7d962a9da07d6b1a7936ee19a7458f390bbbc
Former-commit-id: c5c83ec33ecaade54a73bcc211318ecd4a473182
This commit is contained in:
Song Minjae
2016-07-05 02:21:15 +09:00
parent 2e46df67a8
commit 76453c82c2
15 changed files with 22 additions and 30 deletions

View File

@@ -3,6 +3,7 @@ package net.torvald.terrarum.gameactors
import net.torvald.spriteanimation.SpriteAnimation import net.torvald.spriteanimation.SpriteAnimation
import net.torvald.terrarum.tileproperties.TileNameCode import net.torvald.terrarum.tileproperties.TileNameCode
import net.torvald.terrarum.tileproperties.TilePropCodex import net.torvald.terrarum.tileproperties.TilePropCodex
import java.util.*
/** /**
* Created by minjaesong on 16-06-17. * Created by minjaesong on 16-06-17.
@@ -14,7 +15,7 @@ class FixturesTikiTorch : FixturesBase(), Luminous {
set(value) { set(value) {
throw UnsupportedOperationException() throw UnsupportedOperationException()
} }
override val lightBox: Hitbox = Hitbox(3.0, 0.0, 4.0, 3.0) override val lightBoxList: ArrayList<Hitbox>
init { init {
isVisible = true isVisible = true
@@ -22,6 +23,9 @@ class FixturesTikiTorch : FixturesBase(), Luminous {
setHitboxDimension(10, 24, 0, 0) setHitboxDimension(10, 24, 0, 0)
lightBoxList = ArrayList(1)
lightBoxList.add(Hitbox(3.0, 0.0, 4.0, 3.0))
sprite = SpriteAnimation() sprite = SpriteAnimation()
sprite!!.setDimension(10, 27) sprite!!.setDimension(10, 27)
sprite!!.setSpriteImage("res/graphics/sprites/fixtures/tiki_torch.png") sprite!!.setSpriteImage("res/graphics/sprites/fixtures/tiki_torch.png")

View File

@@ -1,5 +1,7 @@
package net.torvald.terrarum.gameactors package net.torvald.terrarum.gameactors
import java.util.*
/** /**
* Created by minjaesong on 16-03-14. * Created by minjaesong on 16-03-14.
*/ */
@@ -20,6 +22,7 @@ interface Luminous {
* Arguments: * Arguments:
* *
* Hitbox(x-offset, y-offset, width, height) * Hitbox(x-offset, y-offset, width, height)
* (Use ArrayList for normal circumstances)
*/ */
val lightBox: Hitbox val lightBoxList: List<Hitbox>
} }

View File

@@ -71,8 +71,8 @@ class Player : ActorWithBody(), Controllable, Pocketed, Factionable, Luminous, L
set(value) { set(value) {
actorValue[AVKey.LUMINOSITY] = value actorValue[AVKey.LUMINOSITY] = value
} }
override val lightBox: Hitbox override val lightBoxList: List<Hitbox>
get() = Hitbox(0.0, 0.0, hitbox.width, hitbox.height) // use getter; dimension of the player may change by time. get() = arrayOf(Hitbox(0.0, 0.0, hitbox.width, hitbox.height)).toList() // use getter; dimension of the player may change by time.
companion object { companion object {
@Transient internal const val ACCEL_MULT_IN_FLIGHT: Double = 0.21 @Transient internal const val ACCEL_MULT_IN_FLIGHT: Double = 0.21

View File

@@ -174,16 +174,17 @@ object LightmapRenderer {
Terrarum.game.actorContainer.forEach { it -> Terrarum.game.actorContainer.forEach { it ->
if (it is Luminous && it is Visible) { if (it is Luminous && it is Visible) {
// put lanterns to the area the luminantBox is occupying // put lanterns to the area the luminantBox is occupying
val lightBox = it.lightBox for (lightBox in it.lightBoxList) {
val lightBoxX = it.hitbox.posX + lightBox.posX val lightBoxX = it.hitbox.posX + lightBox.posX
val lightBoxY = it.hitbox.posY + lightBox.posY val lightBoxY = it.hitbox.posY + lightBox.posY
val lightBoxW = lightBox.width val lightBoxW = lightBox.width
val lightBoxH = lightBox.height val lightBoxH = lightBox.height
for (y in lightBoxY.div(TSIZE).floorInt() for (y in lightBoxY.div(TSIZE).floorInt()
..lightBoxY.plus(lightBoxH).div(TSIZE).floorInt()) ..lightBoxY.plus(lightBoxH).div(TSIZE).floorInt())
for (x in lightBoxX.div(TSIZE).floorInt() for (x in lightBoxX.div(TSIZE).floorInt()
..lightBoxX.plus(lightBoxW).div(TSIZE).floorInt()) ..lightBoxX.plus(lightBoxW).div(TSIZE).floorInt())
lanternMap.add(Lantern(x, y, it.luminosity)) lanternMap.add(Lantern(x, y, it.luminosity))
}
} }
} }

Binary file not shown.

BIN
work_files/Controls.pdf Normal file

Binary file not shown.

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>numbers-trunk-20080702_1</string>
<string>numbers-trunk-20080731_1</string>
<string>numbers-trunk-20080801_2</string>
<string>numbers-trunk-20080909_1</string>
<string>numbers-trunk-20080911_1</string>
<string>numbers-trunk-20080926_1</string>
<string>numbers-trunk-20081016_1</string>
<string>local build-Oct 16 2012</string>
<string>M3.0.1-1483-1</string>
</array>
</plist>

View File

@@ -1 +0,0 @@
54874EF4-5D25-4B52-8A3E-84AFFFAC77D3

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Binary file not shown.