glow/emissive for held items, even if the actor has no glow/emissive sprites

This commit is contained in:
minjaesong
2024-01-27 03:21:26 +09:00
parent b02f4d7703
commit b1ca1a9351
26 changed files with 345 additions and 106 deletions

View File

@@ -16,7 +16,7 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
abstract class SpriteAnimation(@Transient val parentActor: ActorWithBody) : Disposable {
protected abstract val currentDelay: Second
abstract fun update(delta: Float)
abstract fun render(frameDelta: Float, batch: SpriteBatch, posX: Float, posY: Float, scale: Float = 1f)
abstract fun render(frameDelta: Float, batch: SpriteBatch, posX: Float, posY: Float, scale: Float = 1f, mode: Int = 0, forcedColourFilter: Color? = null)
var flipHorizontal = false
var flipVertical = false
@@ -143,14 +143,14 @@ class SheetSpriteAnimation(parentActor: ActorWithBody) : SpriteAnimation(parentA
* *
* @param scale
*/
override fun render(frameDelta: Float, batch: SpriteBatch, posX: Float, posY: Float, scale: Float) {
override fun render(frameDelta: Float, batch: SpriteBatch, posX: Float, posY: Float, scale: Float, mode: Int, forcedColourFilter: Color?) {
assert(cellWidth > 0 || cellHeight > 0) {
"Sprite width or height is set to zero! ($cellWidth, $cellHeight); master: $parentActor"
}
if (visible) {
val region = textureRegion.get(currentFrame, currentRow)
batch.color = colourFilter
batch.color = forcedColourFilter ?: colourFilter
val tx = (parentActor.hitboxTranslateX) * scale
val txF = (parentActor.hitboxTranslateX + parentActor.baseHitboxW) * scale