Split map into layers for base image, features, overlays, and fog

Added Marsh and Lakes images
IT LOOKS SO GOOD NOW DAMN
This commit is contained in:
Yair Morgenstern 2019-03-20 12:09:54 +02:00
parent fe9fc110d8
commit 1d88e76452
13 changed files with 96 additions and 70 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 387 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 399 B

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 510 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

View file

@ -2125,13 +2125,6 @@ TileSets/Default/MarshOverlay
orig: 100, 100
offset: 0, 0
index: -1
TileSets/FantasyHex/MarshOverlay
rotate: false
xy: 386, 538
size: 100, 100
orig: 100, 100
offset: 0, 0
index: -1
TileSets/ThorfMaps/MarshOverlay
rotate: false
xy: 386, 538
@ -2189,40 +2182,40 @@ TileSets/FantasyHex/City
offset: 0, 0
index: -1
TileSets/FantasyHex/Coast
rotate: false
xy: 912, 31
size: 32, 27
orig: 32, 27
offset: 0, 0
index: -1
TileSets/FantasyHex/Desert
rotate: false
xy: 488, 540
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Desert+Flood plains
rotate: false
xy: 334, 1050
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Desert+Oasis
TileSets/FantasyHex/Desert
rotate: false
xy: 408, 744
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Grassland
TileSets/FantasyHex/Desert+Flood plains
rotate: false
xy: 1458, 365
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Desert+Oasis
rotate: false
xy: 878, 30
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Grassland
rotate: false
xy: 1458, 335
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Grassland+Forest
rotate: false
xy: 2015, 1813
@ -2230,6 +2223,13 @@ TileSets/FantasyHex/Grassland+Forest
orig: 31, 29
offset: 0, 0
index: -1
TileSets/FantasyHex/Grassland+Marsh
rotate: false
xy: 488, 539
size: 32, 29
orig: 32, 29
offset: 0, 0
index: -1
TileSets/FantasyHex/Hill
rotate: false
xy: 810, 26
@ -2244,6 +2244,13 @@ TileSets/FantasyHex/Hill+Forest
orig: 32, 45
offset: 0, 0
index: -1
TileSets/FantasyHex/Lakes
rotate: false
xy: 912, 30
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Mountain
rotate: false
xy: 132, 542
@ -2253,14 +2260,14 @@ TileSets/FantasyHex/Mountain
index: -1
TileSets/FantasyHex/Ocean
rotate: false
xy: 878, 30
xy: 946, 30
size: 32, 28
orig: 32, 28
offset: 0, 0
index: -1
TileSets/FantasyHex/Plains
rotate: false
xy: 1458, 335
xy: 980, 30
size: 32, 28
orig: 32, 28
offset: 0, 0
@ -2799,7 +2806,7 @@ UnitPromotionIcons/Boarding_Party_I_(Civ5)
index: -1
UnitPromotionIcons/Bombardment_III_(Civ5)
rotate: false
xy: 946, 38
xy: 1014, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2834,7 +2841,7 @@ UnitPromotionIcons/Coastal_Raider_III_(Civ5)
index: -1
UnitPromotionIcons/Coastal_Raider_II_(Civ5)
rotate: false
xy: 968, 38
xy: 1036, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2855,7 +2862,7 @@ UnitPromotionIcons/Cover_II_(Civ5)
index: -1
UnitPromotionIcons/Cover_I_(Civ5)
rotate: false
xy: 990, 38
xy: 1058, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2869,7 +2876,7 @@ UnitPromotionIcons/Drill_III_(Civ5)
index: -1
UnitPromotionIcons/Drill_II_(Civ5)
rotate: false
xy: 1012, 38
xy: 1080, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2883,7 +2890,7 @@ UnitPromotionIcons/Drill_I_(Civ5)
index: -1
UnitPromotionIcons/Formation_II_(Civ5)
rotate: false
xy: 1034, 38
xy: 1102, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2897,7 +2904,7 @@ UnitPromotionIcons/Formation_I_(Civ5)
index: -1
UnitPromotionIcons/Indirect_Fire_(Civ5)
rotate: false
xy: 1056, 38
xy: 1124, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2911,7 +2918,7 @@ UnitPromotionIcons/Logistics_(Civ5)
index: -1
UnitPromotionIcons/March_(Civ5)
rotate: false
xy: 1078, 38
xy: 1146, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2925,7 +2932,7 @@ UnitPromotionIcons/Mobility_(Civ5)
index: -1
UnitPromotionIcons/Range_(Civ5)
rotate: false
xy: 1100, 38
xy: 1168, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
@ -2939,98 +2946,98 @@ UnitPromotionIcons/Scouting_III_(Civ5)
index: -1
UnitPromotionIcons/Scouting_II_(Civ5)
rotate: false
xy: 1122, 38
xy: 1190, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Scouting_I_(Civ5)
rotate: false
xy: 1144, 38
xy: 1212, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Sentry_(Civ5)
rotate: false
xy: 1166, 38
xy: 1234, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_III_(Civ5)
rotate: false
xy: 1188, 38
xy: 1256, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_II_(Civ5)
rotate: false
xy: 1210, 38
xy: 1278, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Shock_I_(Civ5)
rotate: false
xy: 1232, 38
xy: 1300, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Siege_(Civ5)
rotate: false
xy: 1254, 38
xy: 1322, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Targeting_III_(Civ5)
rotate: false
xy: 1276, 38
xy: 1344, 38
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Targeting_II_(Civ5)
rotate: false
xy: 1298, 38
xy: 2000, 1150
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Targeting_I_(Civ5)
rotate: false
xy: 1320, 38
xy: 1492, 407
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Volley_(Civ5)
rotate: false
xy: 1342, 38
xy: 1492, 385
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Wolfpack_III_(Civ5)
rotate: false
xy: 2000, 1150
xy: 1492, 363
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Wolfpack_II_(Civ5)
rotate: false
xy: 1492, 407
xy: 1492, 341
size: 20, 20
orig: 20, 20
offset: 0, 0
index: -1
UnitPromotionIcons/Wolfpack_I_(Civ5)
rotate: false
xy: 1492, 385
xy: 442, 752
size: 20, 20
orig: 20, 20
offset: 0, 0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 925 KiB

After

Width:  |  Height:  |  Size: 930 KiB

View file

@ -11,7 +11,7 @@ class GameSettings {
var hasCrashedRecently = false
var soundEffectsVolume = 0.5f
var turnsBetweenAutosaves = 1
var tileSet:String = "Default"
var tileSet:String = "FantasyHex"
fun save(){
GameSaver().setGeneralSettings(this)

View file

@ -17,7 +17,7 @@ class UnCivGame : Game() {
* This exists so that when debugging we can see the entire map.
* Remember to turn this to false before commit and upload!
*/
val viewEntireMapForDebug = false
val viewEntireMapForDebug = true
// For when you need to test something in an advanced game and don't have time to faff around
val superchargedForDebug = false

View file

@ -26,7 +26,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
Layers:
Base image + overlay
Feature overlay / city overlay
Units, improvements, resources, border
Misc: Units, improvements, resources, border
Circle, Crosshair, Fog layer
City name
*/
@ -51,7 +51,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
protected var civilianUnitImage: UnitGroup? = null
protected var militaryUnitImage: UnitGroup? = null
val circleCrosshairFogLayerGroup = Group().apply { isTransform=false }
private val circleImage = ImageGetter.getCircle() // for blue and red circles on the tile
private val crosshairImage = ImageGetter.getImage("OtherIcons/Crosshair.png") // for when a unit is targete
protected val fogImage = ImageGetter.getImage(tileSetLocation+"CrosshatchHexagon")
@ -68,6 +68,10 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
val groupSize = 54f
init {
this.setSize(groupSize, groupSize)
this.addActor(baseLayerGroup)
this.addActor(featureLayerGroup)
this.addActor(miscLayerGroup)
this.addActor(circleCrosshairFogLayerGroup)
updateTileImage(false)
@ -82,7 +86,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
circleImage.width = 50f
circleImage.height = 50f
circleImage.center(this)
addActor(circleImage)
circleCrosshairFogLayerGroup.addActor(circleImage)
circleImage.isVisible = false
}
@ -92,7 +96,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
fogImage.setOrigin(Align.center)
fogImage.center(this)
fogImage.color = Color.WHITE.cpy().apply { a = 0.2f }
addActor(fogImage)
circleCrosshairFogLayerGroup.addActor(fogImage)
}
private fun addCrosshairImage() {
@ -101,7 +105,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
crosshairImage.center(this)
crosshairImage.isVisible = false
crosshairImage.color = Color.WHITE.cpy().apply { a = 0.5f }
addActor(crosshairImage)
circleCrosshairFogLayerGroup.addActor(crosshairImage)
}
fun showCrosshair() {
@ -134,11 +138,10 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
tileBaseImage.y = -groupSize/6
tileBaseImage.toBack()
addActor(tileBaseImage)
baseLayerGroup.addActor(tileBaseImage)
}
fun addAcquirableIcon(){
this.
populationImage = ImageGetter.getStatIcon("Acquire")
populationImage!!.run {
color = Color.GREEN.cpy().lerp(Color.BLACK, 0.5f)
@ -146,7 +149,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
center(this@TileGroup)
x += 20 // right
}
addActor(populationImage)
miscLayerGroup.addActor(populationImage)
}
fun addPopulationIcon() {
@ -158,7 +161,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
center(this@TileGroup)
x += 20 // right
}
addActor(populationImage)
miscLayerGroup.addActor(populationImage)
}
protected fun removePopulationIcon() {
@ -219,13 +222,13 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
setSize(40f, 40f)
center(this@TileGroup)
}
addActor(baseTerrainOverlayImage)
baseLayerGroup.addActor(baseTerrainOverlayImage)
}
private fun updateCityImage() {
if (cityImage == null && tileInfo.isCityCenter()) {
cityImage = ImageGetter.getImage("OtherIcons/City.png")
addActor(cityImage)
featureLayerGroup.addActor(cityImage)
cityImage!!.run {
setSize(60f, 60f)
center(this@TileGroup)
@ -287,7 +290,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
image.moveBy(relativeWorldPosition.y * i * 4, -relativeWorldPosition.x * i * 4)
image.color = civColor
addActor(image)
miscLayerGroup.addActor(image)
images.add(image)
}
}
@ -331,7 +334,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
image.setOrigin(0f, 1f) // This is so that the rotation is calculated from the middle of the road and not the edge
image.rotation = (180 / Math.PI * Math.atan2(relativeWorldPosition.y.toDouble(), relativeWorldPosition.x.toDouble())).toFloat()
addActor(image)
featureLayerGroup.addActor(image)
}
@ -355,7 +358,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
val terrainFeatureOverlayLocation = tileSetLocation +"$terrainFeature"+"Overlay"
if(!ImageGetter.imageExists(terrainFeatureOverlayLocation)) return
terrainFeatureOverlayImage = ImageGetter.getImage(terrainFeatureOverlayLocation)
addActor(terrainFeatureOverlayImage)
featureLayerGroup.addActor(terrainFeatureOverlayImage)
terrainFeatureOverlayImage!!.run {
setSize(30f, 30f)
setColor(1f, 1f, 1f, 0.5f)
@ -373,7 +376,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
if (tileInfo.improvement != null && showResourcesAndImprovements) {
improvementImage = ImageGetter.getImprovementIcon(tileInfo.improvement!!)
addActor(improvementImage)
miscLayerGroup.addActor(improvementImage)
improvementImage!!.run {
setSize(20f, 20f)
center(this@TileGroup)
@ -403,7 +406,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
resourceImage!!.center(this)
resourceImage!!.x = resourceImage!!.x - 22 // left
resourceImage!!.y = resourceImage!!.y + 10 // top
addActor(resourceImage!!)
miscLayerGroup.addActor(resourceImage!!)
}
}
@ -419,7 +422,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
newImage.blackSpinningCircle = ImageGetter.getCircle()
.apply { rotation= oldUnitGroup.blackSpinningCircle!!.rotation}
}
addActor(newImage)
miscLayerGroup.addActor(newImage)
newImage.center(this)
newImage.y += yFromCenter

View file

@ -17,7 +17,6 @@ class TileGroupMap<T: TileGroup>(tileGroups:Collection<T>, padding:Float): Group
tileGroup.setPosition(positionalVector.x * 0.8f * groupSize.toFloat(),
positionalVector.y * 0.8f * groupSize.toFloat())
addActor(tileGroup)
topX = Math.max(topX, tileGroup.x + groupSize)
topY = Math.max(topY, tileGroup.y + groupSize)
bottomX = Math.min(bottomX, tileGroup.x)
@ -28,8 +27,25 @@ class TileGroupMap<T: TileGroup>(tileGroups:Collection<T>, padding:Float): Group
group.moveBy(-bottomX + padding, -bottomY + padding)
}
for(group in tileGroups.sortedByDescending { it.tileInfo.position.x + it.tileInfo.position.y })
group.toFront()
val baseLayers = ArrayList<Group>()
val featureLayers = ArrayList<Group>()
val miscLayers = ArrayList<Group>()
val circleCrosshairFogLayers = ArrayList<Group>()
for(group in tileGroups.sortedByDescending { it.tileInfo.position.x + it.tileInfo.position.y }){
// now, we steal the subgroups from all the tilegroups, that's how we form layers!
baseLayers.add(group.baseLayerGroup.apply { setPosition(group.x,group.y) })
featureLayers.add(group.featureLayerGroup.apply { setPosition(group.x,group.y) })
miscLayers.add(group.miscLayerGroup.apply { setPosition(group.x,group.y) })
circleCrosshairFogLayers.add(group.circleCrosshairFogLayerGroup.apply { setPosition(group.x,group.y) })
}
for(group in baseLayers) addActor(group)
for(group in featureLayers) addActor(group)
for(group in miscLayers) addActor(group)
for(group in circleCrosshairFogLayers) addActor(group)
for(group in tileGroups) addActor(group) // The above layers are for the visual layers, this is for the clicks
// there are tiles "below the zero",
// so we zero out the starting position of the whole board so they will be displayed as well

View file

@ -179,7 +179,7 @@ class TileMapHolder(internal val worldScreen: WorldScreen, internal val tileMap:
tileGroup.update(canSeeTile, showSubmarine)
val unitsInTile = tileGroup.tileInfo.getUnits()
val canSeeEnemy = unitsInTile.isNotEmpty() && !unitsInTile.first().civInfo.isPlayerCivilization()
val canSeeEnemy = unitsInTile.isNotEmpty() && unitsInTile.first().civInfo.isAtWarWith(civInfo)
&& (showSubmarine || unitsInTile.firstOrNull {!it.isInvisible()}!=null)
if(canSeeTile && canSeeEnemy)
tileGroup.showCircle(Color.RED) // Display ALL viewable enemies with a red circle so that users don't need to go "hunting" for enemy units