establishing the concept of creature defence AV, some function name changing

Former-commit-id: 309f15be553b2bb0d391f89dab457748b6e3f063
Former-commit-id: 537edfa27245453cd2c37feed8d21861286425e5
This commit is contained in:
Song Minjae
2016-04-07 22:51:56 +09:00
parent 062abfff36
commit 7ab937d5fc
9 changed files with 39 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
{
"racename" : "CONTEXT_RACE_HUMAN",
"racenameplural" : "CONTEXT_RACE_HUMAN_PLURAL",
"racename" : "RACE_HUMAN",
"racenameplural" : "RACE_HUMAN_PLURAL",
"baseheight" : 40,
"basemass" : 60.0,
@@ -19,7 +19,7 @@
"scalemult" : [100,100,100,100,100,100,100],
"encumbrance" : 1000,
"basedefence" : "work in progress",
"basedefence" : 100,
"toolsize" : 15,

View File

@@ -161,6 +161,10 @@ constructor() : Font {
}
override fun drawString(x: Float, y: Float, s: String, color: Color) {
GL11.glEnable(GL11.GL_BLEND)
GL11.glColorMask(true, true, true, true)
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA)
// hangul fonts first
//hangulSheet.startUse() // disabling texture binding to make the font coloured
// JOHAB
@@ -376,6 +380,8 @@ constructor() : Font {
if (prevInstance != -1) {
//sheetKey[prevInstance].endUse()
}
GL11.glEnd()
}
private fun getSheetType(c: Char): Int {

View File

@@ -175,7 +175,7 @@ constructor() : BasicGameState() {
}
override fun render(gc: GameContainer, sbg: StateBasedGame, g: Graphics) {
setBlendModeNormal()
setBlendNormal()
Terrarum.gameConfig["smoothlighting"] = KeyToggler.isOn(KEY_LIGHTMAP_SMOOTH)
@@ -203,16 +203,16 @@ constructor() : BasicGameState() {
MapDrawer.render(gc, g)
setBlendModeMul()
setBlendMul()
MapDrawer.drawEnvOverlay(g)
if (!KeyToggler.isOn(KEY_LIGHTMAP_RENDER)) setBlendModeMul()
else setBlendModeNormal()
if (!KeyToggler.isOn(KEY_LIGHTMAP_RENDER)) setBlendMul()
else setBlendNormal()
LightmapRenderer.draw(g)
setBlendModeNormal()
setBlendNormal()
uiContainer.forEach { ui -> ui.render(gc, g) }
debugWindow.render(gc, g)

View File

@@ -6,8 +6,8 @@ import com.torvald.terrarum.Terrarum
import com.torvald.terrarum.tileproperties.TileNameCode
import com.torvald.terrarum.tileproperties.TilePropCodex
import com.jme3.math.FastMath
import com.torvald.terrarum.setBlendModeMul
import com.torvald.terrarum.setBlendModeNormal
import com.torvald.terrarum.setBlendMul
import com.torvald.terrarum.setBlendNormal
import org.lwjgl.opengl.GL11
import org.newdawn.slick.GameContainer
import org.newdawn.slick.Graphics
@@ -206,16 +206,16 @@ object MapCamera {
/**
* render to camera
*/
setBlendModeNormal()
setBlendNormal()
drawTiles(WALL, false)
drawTiles(TERRAIN, false)
}
@JvmStatic
fun renderFront(gc: GameContainer, g: Graphics) {
setBlendModeMul()
setBlendMul()
drawTiles(TERRAIN, true)
setBlendModeNormal()
setBlendNormal()
}
private fun drawTiles(mode: Int, drawModeTilesBlendMul: Boolean) {

View File

@@ -350,23 +350,23 @@ constructor(gamename: String) : StateBasedGame(gamename) {
fun main(args: Array<String>) = Terrarum.main(args)
fun setBlendModeMul() {
fun setBlendMul() {
GL11.glEnable(GL11.GL_BLEND)
GL11.glColorMask(true, true, true, true)
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_ONE_MINUS_SRC_ALPHA)
}
fun setBlendModeNormal() {
fun setBlendNormal() {
GL11.glEnable(GL11.GL_BLEND)
GL11.glColorMask(true, true, true, true)
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA)
}
fun setBlendModeAlphaMap() {
fun setBlendAlphaMap() {
GL11.glDisable(GL11.GL_BLEND)
GL11.glColorMask(false, false, false, true)
}
fun disableBlend() {
fun setBlendDisable() {
GL11.glDisable(GL11.GL_BLEND)
}

View File

@@ -14,7 +14,7 @@ import java.security.SecureRandom
object CreatureRawInjector {
const val JSONPATH = "./res/raw/creatures/"
private const val MULTIPLIER_RAW_ELEM_SUFFIX = AVKey.MULTIPLIER_SUFFIX
private const val MULTIPLIER_RAW_ELEM_SUFFIX = AVKey.MULT
/**
* 'Injects' creature raw ActorValue to the ActorValue reference provided.

View File

@@ -56,6 +56,8 @@ object PFSigrid {
p.actorValue[AVKey.LUMINOSITY] = 5980540
p.actorValue[AVKey.BASEDEFENCE] = 141
p.actorValue["selectedtile"] = 16
p.setHitboxDimension(15, p.actorValue.getAsInt(AVKey.BASEHEIGHT)!!, 10, 0)

View File

@@ -4,22 +4,22 @@ package com.torvald.terrarum.gameactors
* Created by minjaesong on 16-04-02.
*/
object AVKey {
const val MULTIPLIER_SUFFIX = "mult"
const val MULT = "mult"
const val SPEED = "speed"
const val SPEEDMULT = "speed$MULTIPLIER_SUFFIX"
const val SPEEDMULT = "speed$MULT"
const val ACCEL = "accel"
const val ACCELMULT = "accel$MULTIPLIER_SUFFIX"
const val ACCELMULT = "accel$MULT"
const val SCALE = "scale"
const val BASEHEIGHT = "baseheight"
const val BASEMASS = "basemass"
const val JUMPPOWER = "jumppower"
const val JUMPPOWERMULT = "jumppower$MULTIPLIER_SUFFIX"
const val JUMPPOWERMULT = "jumppower$MULT"
const val STRENGTH = "strength"
const val ENCUMBRANCE = "encumbrance"
const val LUMINOSITY = "luminosity"
const val PHYSIQUEMULT = "physique$MULTIPLIER_SUFFIX"
const val PHYSIQUEMULT = "physique$MULT"
const val NAME = "name"
@@ -27,4 +27,8 @@ object AVKey {
const val RACENAMEPLURAL = "racenameplural"
const val TOOLSIZE = "toolsize"
const val INTELLIGENT = "intelligent"
const val BASEDEFENCE = "basedefence" // creature base
const val ARMOURDEFENCE = "armourdefence" // armour points
const val ARMOURDEFENCEMULT = "armourdefence$MULT"
}

View File

@@ -2,8 +2,8 @@ package com.torvald.terrarum.ui
import com.torvald.imagefont.GameFontWhite
import com.jme3.math.FastMath
import com.torvald.terrarum.disableBlend
import com.torvald.terrarum.setBlendModeNormal
import com.torvald.terrarum.setBlendDisable
import com.torvald.terrarum.setBlendNormal
import org.lwjgl.opengl.GL11
import org.newdawn.slick.*
@@ -61,7 +61,7 @@ constructor(override var width: Int, isBlackVariant: Boolean) : UICanvas {
override fun render(gc: GameContainer, g: Graphics) {
val canvasG = uidrawCanvas.graphics
disableBlend()
setBlendDisable()
drawSegments(canvasG)
canvasG.setDrawMode(Graphics.MODE_ALPHA_MAP)
drawSegments(canvasG)
@@ -74,7 +74,7 @@ constructor(override var width: Int, isBlackVariant: Boolean) : UICanvas {
canvasG.drawString(messagesList[i], (messageWindowRadius + 4).toFloat(), (messageWindowRadius + GLYPH_HEIGHT * i).toFloat())
}
setBlendModeNormal()
setBlendNormal()
g.drawImage(uidrawCanvas, 0f, 0f, Color(1f,1f,1f,opacity))
canvasG.clear()