From 01e475814baba6f4899897aadf97cd930f7cfadc Mon Sep 17 00:00:00 2001 From: minjaesong Date: Sat, 6 Jul 2019 20:44:15 +0900 Subject: [PATCH] blocks csv fixed wrong opacity value --- assets/mods/basegame/blocks/blocks.csv | 18 +- .../gameactors/ActorHumanoid.kt | 7 +- .../terrarum/worlddrawer/BlocksDrawerNew.kt | 141 +- terrarum.iml | 2 +- .../graphics/colourmap/pal64_master_ryb.tga | 2 +- .../colourmap/pal64_master_ryb_685RGB.tga | 3 + work_files/tracker_plaintext_description.ebnf | 27 + .../tracker_plaintext_format_example.txt | 2150 +++++++++++++++++ 8 files changed, 2265 insertions(+), 85 deletions(-) create mode 100644 work_files/graphics/colourmap/pal64_master_ryb_685RGB.tga create mode 100644 work_files/tracker_plaintext_description.ebnf create mode 100644 work_files/tracker_plaintext_format_example.txt diff --git a/assets/mods/basegame/blocks/blocks.csv b/assets/mods/basegame/blocks/blocks.csv index 8b5a74d46..d4f8b48b6 100644 --- a/assets/mods/basegame/blocks/blocks.csv +++ b/assets/mods/basegame/blocks/blocks.csv @@ -98,15 +98,15 @@ "256";"256";"BLOCK_LANTERN_IRON_REGULAR";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"FXTR";"0";"0";"0";"N/A";"0";"0";"16";"1.0000";"0.6372";"0.0000";"0.0000";"N/A";"N/A" "257";"257";"BLOCK_SUNSTONE";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"ROCK";"1";"0";"0";"N/A";"2";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" "258";"258";"BLOCK_DAYLIGHT_CAPACITOR";"0.1252";"0.1252";"0.1252";"0.1252";"1";"N/A";"GLAS";"1";"0";"0";"N/A";"3";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" -"272";"272";"BLOCK_SCAFFOLDING_NORMAL";"0.0";"0.0";"0.0";"0.0";"1";"N/A";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" -"273";"273";"BLOCK_SCAFFOLDING_EBONY";"0.0";"0.0";"0.0";"0.0";"1";"N/A";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"" -"274";"274";"BLOCK_SCAFFOLDING_BIRCH";"0.0";"0.0";"0.0";"0.0";"1";"N/A";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"" -"275";"275";"BLOCK_SCAFFOLDING_BLOODROSE";"0.0";"0.0";"0.0";"0.0";"1";"N/A";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"" -"4091";"0";"ACTORBLOCK_NO_COLLISION";"0.0";"0.0";"0.0";"0.0";"1";"1";"NULL";"0";"0";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" -"4092";"0";"ACTORBLOCK_FULL_COLLISION";"0.0";"0.0";"0.0";"0.0";"1";"1";"NULL";"0";"0";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" -"4093";"0";"ACTORBLOCK_ALLOW_MOVE_DOWN";"0.0";"0.0";"0.0";"0.0";"1";"1";"NULL";"0";"1";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" -"4094";"0";"ACTORBLOCK_NO_PASS_RIGHT";"0.0";"0.0";"0.0";"0.0";"1";"1";"NULL";"0";"0";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" -"4095";"0";"ACTORBLOCK_NO_PASS_LEFT";"0.0";"0.0";"0.0";"0.0";"1";"1";"NULL";"0";"0";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" +"272";"272";"BLOCK_SCAFFOLDING_NORMAL";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" +"273";"273";"BLOCK_SCAFFOLDING_EBONY";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"" +"274";"274";"BLOCK_SCAFFOLDING_BIRCH";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"" +"275";"275";"BLOCK_SCAFFOLDING_BLOODROSE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"N/A";"WOOD";"0";"1";"0";"6";"0";"0";"16";"0.0";"0.0";"0.0";"0.0";"N/A";"" +"4091";"0";"ACTORBLOCK_NO_COLLISION";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"0";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" +"4092";"0";"ACTORBLOCK_FULL_COLLISION";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"0";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" +"4093";"0";"ACTORBLOCK_ALLOW_MOVE_DOWN";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"1";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" +"4094";"0";"ACTORBLOCK_NO_PASS_RIGHT";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"0";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" +"4095";"0";"ACTORBLOCK_NO_PASS_LEFT";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"0";"0";"N/A";"0";"0";"0";"0.0";"0.0";"0.0";"0.0";"N/A";"N/A" "4096";"0";"BLOCK_WATER";"0.1016";"0.0744";"0.0508";"0.0826";"100";"1000";"WATR";"0";"0";"0";"0";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"005599A6";"16" "4097";"0";"BLOCK_LAVA";"0.9696";"0.9696";"0.9696";"0.9696";"100";"2600";"ROCK";"0";"0";"0";"0";"0";"0";"16";"0.7664";"0.2032";"0.0000";"0.0000";"FF4600E6";"32" "-1";"0";"BLOCK_NULL";"4.0000";"4.0000";"4.0000";"4.0000";"-1";"2600";"NULL";"0";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt index 923070401..20424a4d0 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/ActorHumanoid.kt @@ -115,8 +115,8 @@ open class ActorHumanoid( var axisRY = 0f; protected set /** empirical value. */ - @Transient private val JUMP_ACCELERATION_MOD = 51.0 / 10000.0 // (170 * (17/MAX_JUMP_LENGTH)^2) / 10000.0 - @Transient private val WALK_FRAMES_TO_MAX_ACCEL = 6 + @Transient private val JUMP_ACCELERATION_MOD = 51.0 / 10000.0 // (170 * (17/MAX_JUMP_LENGTH)^2) / 10000.0 // bigger value = higher jump + @Transient private val WALK_FRAMES_TO_MAX_ACCEL = 5 // how many frames it takes to reach maximum walking speed @Transient private val LEFT = 1 @Transient private val RIGHT = 2 @@ -248,6 +248,9 @@ open class ActorHumanoid( private fun processInput(delta: Float) { + // Good control is simple: it move as the player meant: if I push the stick forward, it goes forward, rather than + // the way your character is looking. Think of the SM64 + /** * L-R stop */ diff --git a/src/net/torvald/terrarum/worlddrawer/BlocksDrawerNew.kt b/src/net/torvald/terrarum/worlddrawer/BlocksDrawerNew.kt index a28b80bd9..1f7e8f4ab 100644 --- a/src/net/torvald/terrarum/worlddrawer/BlocksDrawerNew.kt +++ b/src/net/torvald/terrarum/worlddrawer/BlocksDrawerNew.kt @@ -316,79 +316,76 @@ internal object BlocksDrawer { // draw a tile - if (thisTile != null) try { - val nearbyTilesInfo = if (mode == FLUID) { - getNearbyTilesInfoFluids(x, y) - } - else if (mode == WIRE) { - getNearbyWiringInfo(x, y, thisTile) - } - else if (isPlatform(thisTile)) { - getNearbyTilesInfoPlatform(x, y) - } - else if (isWallSticker(thisTile)) { - getNearbyTilesInfoWallSticker(x, y) - } - else if (isConnectMutual(thisTile)) { - getNearbyTilesInfoConMutual(x, y, mode) - } - else if (isConnectSelf(thisTile)) { - getNearbyTilesInfoConSelf(x, y, mode, thisTile) - } - else { - 0 - } - - val renderTag = CreateTileAtlas.getRenderTag(thisTile) - val tileNumberBase = - if (mode == FLUID) - CreateTileAtlas.fluidToTileNumber(world.getFluid(x, y)) - else if (mode == WIRE) - thisTile - else - renderTag.tileNumber - val tileNumber = if (mode != WIRE && thisTile == 0) 0 - // special case: fluids - else if (mode == FLUID) tileNumberBase + connectLut47[nearbyTilesInfo] - // special case: wires - else if (mode == WIRE) tileNumberBase + connectLut16[nearbyTilesInfo] - // rest of the cases: terrain and walls - else tileNumberBase + when (renderTag.maskType) { - CreateTileAtlas.RenderTag.MASK_NA -> 0 - CreateTileAtlas.RenderTag.MASK_16 -> connectLut16[nearbyTilesInfo] - CreateTileAtlas.RenderTag.MASK_47 -> connectLut47[nearbyTilesInfo] - CreateTileAtlas.RenderTag.MASK_TORCH, CreateTileAtlas.RenderTag.MASK_PLATFORM -> nearbyTilesInfo - else -> throw IllegalArgumentException("Unknown mask type: ${renderTag.maskType}") - } - - var thisTileX = tileNumber % TILES_IN_X - var thisTileY = tileNumber / TILES_IN_X - - if (mode == FLUID && thisTileX == 22 && thisTileY == 3) { - //println("tileNumberBase = $tileNumberBase, tileNumber = $tileNumber, fluid = ${world.getFluid(x, y)}") - } - - val breakage = if (mode == TERRAIN) world.getTerrainDamage(x, y) else world.getWallDamage(x, y) - val maxHealth = BlockCodex[world.getTileFromTerrain(x, y)].strength - val breakingStage = (breakage / maxHealth).times(BREAKAGE_STEPS).roundInt() - - - - // draw a tile - - if (mode == WIRE && thisTile < 0) { - // no wire here, draw block id 255 (bottom right) - writeToBuffer(mode, bufferX, bufferY, 15, 15, 0) - } - else if (mode == FLUID || mode == WIRE) { - writeToBuffer(mode, bufferX, bufferY, thisTileX, thisTileY, 0) - } - else { - writeToBuffer(mode, bufferX, bufferY, thisTileX, thisTileY, breakingStage) - } - } catch (e: NullPointerException) { - // do nothing. WARNING: This exception handling may hide erratic behaviour completely. + val nearbyTilesInfo = if (mode == FLUID) { + getNearbyTilesInfoFluids(x, y) } + else if (mode == WIRE) { + getNearbyWiringInfo(x, y, thisTile) + } + else if (isPlatform(thisTile)) { + getNearbyTilesInfoPlatform(x, y) + } + else if (isWallSticker(thisTile)) { + getNearbyTilesInfoWallSticker(x, y) + } + else if (isConnectMutual(thisTile)) { + getNearbyTilesInfoConMutual(x, y, mode) + } + else if (isConnectSelf(thisTile)) { + getNearbyTilesInfoConSelf(x, y, mode, thisTile) + } + else { + 0 + } + + val renderTag = CreateTileAtlas.getRenderTag(thisTile) + val tileNumberBase = + if (mode == FLUID) + CreateTileAtlas.fluidToTileNumber(world.getFluid(x, y)) + else if (mode == WIRE) + thisTile + else + renderTag.tileNumber + val tileNumber = if (mode != WIRE && thisTile == 0) 0 + // special case: fluids + else if (mode == FLUID) tileNumberBase + connectLut47[nearbyTilesInfo] + // special case: wires + else if (mode == WIRE) tileNumberBase + connectLut16[nearbyTilesInfo] + // rest of the cases: terrain and walls + else tileNumberBase + when (renderTag.maskType) { + CreateTileAtlas.RenderTag.MASK_NA -> 0 + CreateTileAtlas.RenderTag.MASK_16 -> connectLut16[nearbyTilesInfo] + CreateTileAtlas.RenderTag.MASK_47 -> connectLut47[nearbyTilesInfo] + CreateTileAtlas.RenderTag.MASK_TORCH, CreateTileAtlas.RenderTag.MASK_PLATFORM -> nearbyTilesInfo + else -> throw IllegalArgumentException("Unknown mask type: ${renderTag.maskType}") + } + + var thisTileX = tileNumber % TILES_IN_X + var thisTileY = tileNumber / TILES_IN_X + + if (mode == FLUID && thisTileX == 22 && thisTileY == 3) { + //println("tileNumberBase = $tileNumberBase, tileNumber = $tileNumber, fluid = ${world.getFluid(x, y)}") + } + + val breakage = if (mode == TERRAIN) world.getTerrainDamage(x, y) else world.getWallDamage(x, y) + val maxHealth = BlockCodex[world.getTileFromTerrain(x, y)].strength + val breakingStage = (breakage / maxHealth).times(BREAKAGE_STEPS).roundInt() + + + + // draw a tile + + if (mode == WIRE && thisTile < 0) { + // no wire here, draw block id 255 (bottom right) + writeToBuffer(mode, bufferX, bufferY, 15, 15, 0) + } + else if (mode == FLUID || mode == WIRE) { + writeToBuffer(mode, bufferX, bufferY, thisTileX, thisTileY, 0) + } + else { + writeToBuffer(mode, bufferX, bufferY, thisTileX, thisTileY, breakingStage) + } + } } } diff --git a/terrarum.iml b/terrarum.iml index 619e2a2aa..a3a0cb329 100644 --- a/terrarum.iml +++ b/terrarum.iml @@ -2,7 +2,7 @@ - +