mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
New tileprop: opaque — whether the wall is completely hidden by the tile
Former-commit-id: f1680dd3fbe289ded64bea8c717996216113bca2 Former-commit-id: 98856da3d4b83ed9332cf50790967cdefbf8e622
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,46 +1,46 @@
|
||||
"id";"name" ;"opacity";"strength";"fluid";"viscosity";"solid";"wall";"lumcolor";"drop";"fall";"friction"
|
||||
# Friction: 0: frictionless, <16: slippery, 16: regular, >16: sticky | Opacity/Lumcolor: 40-step RGB
|
||||
"0";"TILE_AIR" ; "1641"; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "0";"16"
|
||||
"1";"TILE_STONE" ; "8205"; "25"; "0"; "N/A"; "1"; "1"; "0"; "1"; "0";"16"
|
||||
"2";"TILE_DIRT" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "2"; "0";"16"
|
||||
"3";"TILE_GRASS" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "2"; "0";"16"
|
||||
"4";"TILE_PLANK_NORMAL" ; "8205"; "12"; "0"; "N/A"; "1"; "1"; "0"; "4"; "0";"16"
|
||||
"5";"TILE_PLANK_EBONY" ; "8205"; "12"; "0"; "N/A"; "1"; "1"; "0"; "5"; "0";"16"
|
||||
"6";"TILE_PLANK_BIRCH" ; "8205"; "12"; "0"; "N/A"; "1"; "1"; "0"; "6"; "0";"16"
|
||||
"7";"TILE_PLANK_BLOODROSE" ; "8205"; "12"; "0"; "N/A"; "1"; "1"; "0"; "7"; "0";"16"
|
||||
"8";"TILE_TRUNK_NORMAL" ; "8205"; "12"; "0"; "N/A"; "1"; "0"; "0"; "8"; "0";"16"
|
||||
"9";"TILE_TRUNK_EBONY" ; "8205"; "12"; "0"; "N/A"; "1"; "0"; "0"; "9"; "0";"16"
|
||||
"10";"TILE_TRUNK_BIRCH" ; "8205"; "12"; "0"; "N/A"; "1"; "0"; "0"; "10"; "0";"16"
|
||||
"11";"TILE_TRUNK_BLOODROSE" ; "8205"; "12"; "0"; "N/A"; "1"; "0"; "0"; "11"; "0";"16"
|
||||
"12";"TILE_STONE_QUARRIED" ; "8205"; "25"; "0"; "N/A"; "1"; "1"; "0"; "12"; "0";"16"
|
||||
"13";"TILE_SAND" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "13"; "1";"16"
|
||||
"14";"TILE_GRAVEL" ; "8205"; "6"; "0"; "N/A"; "1"; "0"; "0"; "14"; "1";"16"
|
||||
"id";"name" ;"opacity";"strength";"fluid";"viscosity";"solid";"wall";"lumcolor";"opaque";"drop";"fall";"friction"
|
||||
# Friction: 0: frictionless, <16: slippery, 16: regular, >16: sticky | Opacity/Lumcolor: 40-step RGB | Opaque: whether the tile completely hides wall behind
|
||||
"0";"TILE_AIR" ; "1641"; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "0"; "0";"16"
|
||||
"1";"TILE_STONE" ; "8205"; "25"; "0"; "N/A"; "1"; "1"; "0"; "1"; "1"; "0";"16"
|
||||
"2";"TILE_DIRT" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "1"; "2"; "0";"16"
|
||||
"3";"TILE_GRASS" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "1"; "2"; "0";"16"
|
||||
"4";"TILE_PLANK_NORMAL" ; "8205"; "12"; "0"; "N/A"; "1"; "1"; "0"; "1"; "4"; "0";"16"
|
||||
"5";"TILE_PLANK_EBONY" ; "8205"; "12"; "0"; "N/A"; "1"; "1"; "0"; "1"; "5"; "0";"16"
|
||||
"6";"TILE_PLANK_BIRCH" ; "8205"; "12"; "0"; "N/A"; "1"; "1"; "0"; "1"; "6"; "0";"16"
|
||||
"7";"TILE_PLANK_BLOODROSE" ; "8205"; "12"; "0"; "N/A"; "1"; "1"; "0"; "1"; "7"; "0";"16"
|
||||
"8";"TILE_TRUNK_NORMAL" ; "8205"; "12"; "0"; "N/A"; "1"; "0"; "0"; "1"; "8"; "0";"16"
|
||||
"9";"TILE_TRUNK_EBONY" ; "8205"; "12"; "0"; "N/A"; "1"; "0"; "0"; "1"; "9"; "0";"16"
|
||||
"10";"TILE_TRUNK_BIRCH" ; "8205"; "12"; "0"; "N/A"; "1"; "0"; "0"; "1"; "10"; "0";"16"
|
||||
"11";"TILE_TRUNK_BLOODROSE" ; "8205"; "12"; "0"; "N/A"; "1"; "0"; "0"; "1"; "11"; "0";"16"
|
||||
"12";"TILE_STONE_QUARRIED" ; "8205"; "25"; "0"; "N/A"; "1"; "1"; "0"; "1"; "12"; "0";"16"
|
||||
"13";"TILE_SAND" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "1"; "13"; "1";"16"
|
||||
"14";"TILE_GRAVEL" ; "8205"; "6"; "0"; "N/A"; "1"; "0"; "0"; "1"; "14"; "1";"16"
|
||||
|
||||
"15";"TILE_ORE_MALACHITE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "15"; "0";"16"
|
||||
"16";"TILE_ORE_HEMATITE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "16"; "0";"16"
|
||||
"17";"TILE_ORE_NATURAL_GOLD" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "17"; "0";"16"
|
||||
"18";"TILE_ORE_NATURAL_SILVER" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "18"; "0";"16"
|
||||
"19";"TILE_ORE_RUTILE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "19"; "0";"16"
|
||||
"20";"TILE_ORE_AURICHALCUMITE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "20"; "0";"16"
|
||||
"21";"TILE_GEM_RUBY" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "21"; "0";"16"
|
||||
"22";"TILE_GEM_EMERALD" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "22"; "0";"16"
|
||||
"23";"TILE_GEM_SAPPHIRE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "23"; "0";"16"
|
||||
"24";"TILE_GEM_TOPAZ" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "24"; "0";"16"
|
||||
"25";"TILE_GEM_DIAMOND" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "25"; "0";"16"
|
||||
"26";"TILE_GEM_AMETHYST" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "26"; "0";"16"
|
||||
"15";"TILE_ORE_MALACHITE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "1"; "15"; "0";"16"
|
||||
"16";"TILE_ORE_HEMATITE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "1"; "16"; "0";"16"
|
||||
"17";"TILE_ORE_NATURAL_GOLD" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "1"; "17"; "0";"16"
|
||||
"18";"TILE_ORE_NATURAL_SILVER" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "1"; "18"; "0";"16"
|
||||
"19";"TILE_ORE_RUTILE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "1"; "19"; "0";"16"
|
||||
"20";"TILE_ORE_AURICHALCUMITE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "1"; "20"; "0";"16"
|
||||
"21";"TILE_GEM_RUBY" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "1"; "21"; "0";"16"
|
||||
"22";"TILE_GEM_EMERALD" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "1"; "22"; "0";"16"
|
||||
"23";"TILE_GEM_SAPPHIRE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "1"; "23"; "0";"16"
|
||||
"24";"TILE_GEM_TOPAZ" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "1"; "24"; "0";"16"
|
||||
"25";"TILE_GEM_DIAMOND" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "1"; "25"; "0";"16"
|
||||
"26";"TILE_GEM_AMETHYST" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "1"; "26"; "0";"16"
|
||||
|
||||
"27";"TILE_SNOW" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "27"; "0";"16"
|
||||
"28";"TILE_ICE_FRAGILE" ; "3282"; "1"; "0"; "N/A"; "1"; "0"; "0"; "28"; "0";"16"
|
||||
"29";"TILE_ICE_NATURAL" ; "6564"; "25"; "0"; "N/A"; "1"; "1"; "0"; "29"; "0"; "8"
|
||||
"30";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25"; "0"; "N/A"; "1"; "1"; "5009"; "30"; "0"; "8"
|
||||
"27";"TILE_SNOW" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "1"; "27"; "0";"16"
|
||||
"28";"TILE_ICE_FRAGILE" ; "3282"; "1"; "0"; "N/A"; "1"; "0"; "0"; "0"; "28"; "0";"16"
|
||||
"29";"TILE_ICE_NATURAL" ; "6564"; "25"; "0"; "N/A"; "1"; "1"; "0"; "1"; "29"; "0"; "8"
|
||||
"30";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25"; "0"; "N/A"; "1"; "1"; "5009"; "0"; "30"; "0"; "8"
|
||||
# see scandinavian name set female of this tile id!
|
||||
"31";"TILE_PLATFORM_STONE" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "31"; "0";"16"
|
||||
"32";"TILE_PLATFORM_WOODEN" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "32"; "0";"16"
|
||||
"33";"TILE_PLATFORM_EBONY" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "33"; "0";"16"
|
||||
"34";"TILE_PLATFORM_BIRCH" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "34"; "0";"16"
|
||||
"35";"TILE_PLATFORM_BLOODROSE" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "35"; "0";"16"
|
||||
"31";"TILE_PLATFORM_STONE" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "31"; "0";"16"
|
||||
"32";"TILE_PLATFORM_WOODEN" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "32"; "0";"16"
|
||||
"33";"TILE_PLATFORM_EBONY" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "33"; "0";"16"
|
||||
"34";"TILE_PLATFORM_BIRCH" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "34"; "0";"16"
|
||||
"35";"TILE_PLATFORM_BLOODROSE" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "35"; "0";"16"
|
||||
|
||||
"36";"TILE_TORCH" ; "0"; "0"; "0"; "N/A"; "0"; "0";"63412"; "36"; "0";"16"
|
||||
"36";"TILE_TORCH" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "63412"; "0"; "36"; "0";"16"
|
||||
# 63412 (ffa44e) : real candlelight colour taken from properly configured camera.
|
||||
"239";"TILE_WATER" ; "6522"; "100"; "1"; "2"; "0"; "0"; "0"; "239"; "0";"16"
|
||||
"255";"TILE_LAVA" ; "62358"; "100"; "1"; "2"; "0"; "0";"48320"; "239"; "0";"16"
|
||||
"239";"TILE_WATER" ; "6522"; "100"; "1"; "2"; "0"; "0"; "0"; "0"; "239"; "0";"16"
|
||||
"255";"TILE_LAVA" ; "62358"; "100"; "1"; "2"; "0"; "0"; "48320"; "0"; "239"; "0";"16"
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 1 and column 12.
|
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
7
src/com/Torvald/Terrarum/Actors/AI/ActorAI.java
Normal file
7
src/com/Torvald/Terrarum/Actors/AI/ActorAI.java
Normal file
@@ -0,0 +1,7 @@
|
||||
package com.Torvald.Terrarum.Actors.AI;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-02.
|
||||
*/
|
||||
public interface ActorAI {
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import com.Torvald.Terrarum.Actors.AI.ActorAI;
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-01-31.
|
||||
*/
|
||||
public interface AIControlled {
|
||||
|
||||
void attachAI();
|
||||
void attachAI(ActorAI ai);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.Torvald.Terrarum.Actors;
|
||||
|
||||
import com.Torvald.Terrarum.Actors.AI.ActorAI;
|
||||
import com.Torvald.Terrarum.Actors.Faction.Faction;
|
||||
import com.Torvald.Terrarum.GameItem.InventoryItem;
|
||||
import com.Torvald.Terrarum.Terrarum;
|
||||
@@ -14,19 +15,18 @@ import java.util.HashSet;
|
||||
public class NPCIntelligentBase extends ActorWithBody implements AIControlled, Pocketed, CanBeStoredAsItem,
|
||||
Factionable, Landholder {
|
||||
|
||||
private InventoryItem itemData;
|
||||
// private ActorAI ai;
|
||||
private InventoryItem itemData; // keep it for extendibility, like Carriers in SC1
|
||||
private ActorAI ai;
|
||||
private ActorInventory inventory;
|
||||
|
||||
private HashSet<Faction> factionSet = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Absolute tile index. index(x, y) = y * map.width + x <br />
|
||||
* The arraylist will be saved in JSON format with GSON.
|
||||
*/
|
||||
private ArrayList<Integer> houseTiles = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void attachAI() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assignFaction(Faction f) {
|
||||
factionSet.add(f);
|
||||
@@ -143,4 +143,9 @@ public class NPCIntelligentBase extends ActorWithBody implements AIControlled, P
|
||||
public void overwriteInventory(ActorInventory inventory) {
|
||||
this.inventory = inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void attachAI(ActorAI ai) {
|
||||
this.ai = ai;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class Game extends BasicGameState {
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
MapDrawer.update(gc, delta_t);
|
||||
MapCamera.update(gc, delta_t);
|
||||
|
||||
|
||||
@@ -108,33 +108,35 @@ public class LightmapRenderer {
|
||||
//System.out.println(for_x_start);
|
||||
//System.out.println(for_x_end);
|
||||
|
||||
for (int y = for_y_start; y < for_y_end; y++) {
|
||||
for (int x = for_x_start; x < for_x_end; x++) {
|
||||
staticLightMap[y][x] = calculate(x, y);
|
||||
try {
|
||||
for (int y = for_y_start; y < for_y_end; y++) {
|
||||
for (int x = for_x_start; x < for_x_end; x++) {
|
||||
staticLightMap[y][x] = calculate(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// Round 4
|
||||
for (int y = for_y_end - 1; y > for_y_start; y--) {
|
||||
for (int x = for_x_start; x < for_x_end; x++) {
|
||||
staticLightMap[y][x] = calculate(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// Round 3
|
||||
for (int y = for_y_end - 1; y > for_y_start; y--) {
|
||||
for (int x = for_x_end - 1; x >= for_x_start; x--) {
|
||||
staticLightMap[y][x] = calculate(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// Round 2
|
||||
for (int y = for_y_start; y < for_y_end; y++) {
|
||||
for (int x = for_x_end - 1; x >= for_x_start; x--) {
|
||||
staticLightMap[y][x] = calculate(x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Round 4
|
||||
for (int y = for_y_end - 1; y > for_y_start; y--) {
|
||||
for (int x = for_x_start; x < for_x_end; x++) {
|
||||
staticLightMap[y][x] = calculate(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// Round 3
|
||||
for (int y = for_y_end - 1; y > for_y_start; y--) {
|
||||
for (int x = for_x_end - 1; x >= for_x_start; x--) {
|
||||
staticLightMap[y][x] = calculate(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
// Round 2
|
||||
for (int y = for_y_start; y < for_y_end; y++) {
|
||||
for (int x = for_x_end - 1; x >= for_x_start; x--) {
|
||||
staticLightMap[y][x] = calculate(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
catch (ArrayIndexOutOfBoundsException e) {}
|
||||
}
|
||||
|
||||
public static void draw(Graphics g) {
|
||||
@@ -256,94 +258,88 @@ public class LightmapRenderer {
|
||||
}
|
||||
|
||||
private static char calculate(int x, int y){
|
||||
if (!outOfBounds(x, y)){
|
||||
char lightLevelThis = 0;
|
||||
int thisTerrain = Terrarum.game.map.getTileFromTerrain(x, y);
|
||||
int thisWall = Terrarum.game.map.getTileFromWall(x, y);
|
||||
char thisTileLuminosity = TilePropCodex.getProp(thisTerrain).getLuminosity();
|
||||
char thisTileOpacity = TilePropCodex.getProp(thisTerrain).getOpacity();
|
||||
char sunLight = Terrarum.game.map.getGlobalLight();
|
||||
|
||||
char lightLevelThis = 0;
|
||||
int thisTerrain = Terrarum.game.map.getTileFromTerrain(x, y);
|
||||
int thisWall = Terrarum.game.map.getTileFromWall(x, y);
|
||||
char thisTileLuminosity = TilePropCodex.getProp(thisTerrain).getLuminosity();
|
||||
char thisTileOpacity = TilePropCodex.getProp(thisTerrain).getOpacity();
|
||||
char sunLight = Terrarum.game.map.getGlobalLight();
|
||||
|
||||
// MIX TILE
|
||||
// open air
|
||||
if (thisTerrain == AIR && thisWall == AIR) {
|
||||
lightLevelThis = sunLight;
|
||||
}
|
||||
// luminous tile transparent (allows sunlight to pass)
|
||||
else if (thisWall == AIR && thisTileLuminosity > 0) {
|
||||
char darkenSunlight = darkenColoured(sunLight, thisTileOpacity);
|
||||
lightLevelThis = screenBlend(darkenSunlight, thisTileLuminosity);
|
||||
}
|
||||
// luminous tile (opaque)
|
||||
else if (thisWall != AIR && thisTileLuminosity > 0) {
|
||||
lightLevelThis = thisTileLuminosity;
|
||||
}
|
||||
// END MIX TILE
|
||||
|
||||
// mix lantern
|
||||
for (LightmapLantern lantern : lanterns) {
|
||||
if (lantern.getX() == x && lantern.getY() == y) {
|
||||
lightLevelThis = screenBlend(lightLevelThis, lantern.getIntensity());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// mix luminous actor
|
||||
// test player TODO for all actor.Luminous in the game
|
||||
int tileX = Math.round(Terrarum.game.getPlayer().getHitbox().getPointedX() / TSIZE);
|
||||
int tileY = Math.round(Terrarum.game.getPlayer().getHitbox().getPointedY() / TSIZE)
|
||||
- 1;
|
||||
char actorLuminosity = Terrarum.game.getPlayer().getLuminance();
|
||||
if (x == tileX && y == tileY) {
|
||||
lightLevelThis = screenBlend(lightLevelThis, actorLuminosity);
|
||||
}
|
||||
|
||||
|
||||
// calculate ambient
|
||||
char ambient = 0; char nearby = 0;
|
||||
findNearbyBrightest:
|
||||
for (int yoff = -1; yoff <= 1; yoff++) {
|
||||
for (int xoff = -1; xoff <= 1; xoff++) {
|
||||
/**
|
||||
* filter for 'v's as:
|
||||
* +-+-+-+
|
||||
* |a|v|a|
|
||||
* +-+-+-+
|
||||
* |v| |v|
|
||||
* +-+-+-+
|
||||
* |a|v|a|
|
||||
* +-+-+-+
|
||||
*/
|
||||
if (xoff != yoff && -xoff != yoff) { // 'v' tiles
|
||||
if (!outOfMapBounds(x + xoff, y + yoff)) {
|
||||
nearby = staticLightMap[y + yoff][x + xoff];
|
||||
}
|
||||
}
|
||||
else if (xoff != 0 && yoff != 0) { // 'a' tiles
|
||||
if (!outOfMapBounds(x + xoff, y + yoff)) {
|
||||
nearby = darkenUniformInt(staticLightMap[y + yoff][x + xoff]
|
||||
, 2); //2
|
||||
// mix some to have more 'spreading'
|
||||
// so that light spreads in a shape of an octagon instead of a diamond
|
||||
}
|
||||
}
|
||||
else {
|
||||
nearby = 0; // exclude 'me' tile
|
||||
}
|
||||
|
||||
ambient = maximiseRGB(ambient, nearby); // keep base value as brightest nearby
|
||||
}
|
||||
}
|
||||
|
||||
ambient = darkenColoured(ambient, thisTileOpacity); // get real ambient by appling opacity value
|
||||
|
||||
// mix and return lightlevel and ambient
|
||||
return maximiseRGB(lightLevelThis, ambient);
|
||||
// MIX TILE
|
||||
// open air
|
||||
if (thisTerrain == AIR && thisWall == AIR) {
|
||||
lightLevelThis = sunLight;
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Out of bounds of lightMap");
|
||||
// luminous tile transparent (allows sunlight to pass)
|
||||
else if (thisWall == AIR && thisTileLuminosity > 0) {
|
||||
char darkenSunlight = darkenColoured(sunLight, thisTileOpacity);
|
||||
lightLevelThis = screenBlend(darkenSunlight, thisTileLuminosity);
|
||||
}
|
||||
// luminous tile (opaque)
|
||||
else if (thisWall != AIR && thisTileLuminosity > 0) {
|
||||
lightLevelThis = thisTileLuminosity;
|
||||
}
|
||||
// END MIX TILE
|
||||
|
||||
// mix lantern
|
||||
for (LightmapLantern lantern : lanterns) {
|
||||
if (lantern.getX() == x && lantern.getY() == y) {
|
||||
lightLevelThis = screenBlend(lightLevelThis, lantern.getIntensity());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// mix luminous actor
|
||||
// test player TODO for all actor.Luminous in the game
|
||||
int tileX = Math.round(Terrarum.game.getPlayer().getHitbox().getPointedX() / TSIZE);
|
||||
int tileY = Math.round(Terrarum.game.getPlayer().getHitbox().getPointedY() / TSIZE)
|
||||
- 1;
|
||||
char actorLuminosity = Terrarum.game.getPlayer().getLuminance();
|
||||
if (x == tileX && y == tileY) {
|
||||
lightLevelThis = screenBlend(lightLevelThis, actorLuminosity);
|
||||
}
|
||||
|
||||
|
||||
// calculate ambient
|
||||
char ambient = 0; char nearby = 0;
|
||||
findNearbyBrightest:
|
||||
for (int yoff = -1; yoff <= 1; yoff++) {
|
||||
for (int xoff = -1; xoff <= 1; xoff++) {
|
||||
/**
|
||||
* filter for 'v's as:
|
||||
* +-+-+-+
|
||||
* |a|v|a|
|
||||
* +-+-+-+
|
||||
* |v| |v|
|
||||
* +-+-+-+
|
||||
* |a|v|a|
|
||||
* +-+-+-+
|
||||
*/
|
||||
if (xoff != yoff && -xoff != yoff) { // 'v' tiles
|
||||
if (!outOfMapBounds(x + xoff, y + yoff)) {
|
||||
nearby = staticLightMap[y + yoff][x + xoff];
|
||||
}
|
||||
}
|
||||
else if (xoff != 0 && yoff != 0) { // 'a' tiles
|
||||
if (!outOfMapBounds(x + xoff, y + yoff)) {
|
||||
nearby = darkenUniformInt(staticLightMap[y + yoff][x + xoff]
|
||||
, 2); //2
|
||||
// mix some to have more 'spreading'
|
||||
// so that light spreads in a shape of an octagon instead of a diamond
|
||||
}
|
||||
}
|
||||
else {
|
||||
nearby = 0; // exclude 'me' tile
|
||||
}
|
||||
|
||||
ambient = maximiseRGB(ambient, nearby); // keep base value as brightest nearby
|
||||
}
|
||||
}
|
||||
|
||||
ambient = darkenColoured(ambient, thisTileOpacity); // get real ambient by appling opacity value
|
||||
|
||||
// mix and return lightlevel and ambient
|
||||
return maximiseRGB(lightLevelThis, ambient);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.Torvald.Terrarum.*;
|
||||
import com.Torvald.Terrarum.Actors.Player;
|
||||
import com.Torvald.Terrarum.GameMap.GameMap;
|
||||
import com.Torvald.Terrarum.GameMap.MapLayer;
|
||||
import com.Torvald.Terrarum.TileProperties.TilePropCodex;
|
||||
import com.jme3.math.FastMath;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.newdawn.slick.*;
|
||||
@@ -398,7 +399,7 @@ public class MapCamera {
|
||||
}
|
||||
|
||||
private static boolean isOpaque(int x) {
|
||||
return !(x == GRASS || x == AIR);
|
||||
return TilePropCodex.getProp(x).isOpaque();
|
||||
}
|
||||
|
||||
public static int getCameraX() {
|
||||
|
||||
@@ -8,7 +8,7 @@ public class TileProp {
|
||||
private int id;
|
||||
private String name;
|
||||
|
||||
private char opacity;
|
||||
private char opacity; // colour attenuation
|
||||
|
||||
private int strength;
|
||||
|
||||
@@ -19,6 +19,8 @@ public class TileProp {
|
||||
|
||||
private boolean wallable;
|
||||
|
||||
private boolean opaque; // hides wall or not
|
||||
|
||||
private char luminosity;
|
||||
private int drop;
|
||||
|
||||
@@ -129,4 +131,12 @@ public class TileProp {
|
||||
void setFriction(int friction) {
|
||||
this.friction = friction;
|
||||
}
|
||||
|
||||
public boolean isOpaque() {
|
||||
return opaque;
|
||||
}
|
||||
|
||||
public void setOpaque(boolean opaque) {
|
||||
this.opaque = opaque;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,8 +66,9 @@ public class TilePropCodex {
|
||||
prop.setSolid(boolVal(record, "solid"));
|
||||
prop.setWallable(boolVal(record, "wall"));
|
||||
prop.setFallable(boolVal(record, "fall"));
|
||||
prop.setOpaque(boolVal(record, "opaque"));
|
||||
|
||||
if (prop.isFluid()) prop.setViscocity(intVal(record, "opacity"));
|
||||
if (prop.isFluid()) prop.setViscocity(intVal(record, "viscosity"));
|
||||
|
||||
System.out.print(prop.getId());
|
||||
System.out.println("\t" + prop.getName());
|
||||
|
||||
@@ -1,46 +1,49 @@
|
||||
"id";"name" ;"opacity";"strength";"fluid";"viscosity";"solid";"wall";"lumcolor";"drop";"fall";"friction"
|
||||
# Friction: 0: frictionless, <16: slippery, 16: regular, >16: sticky | Opacity/Lumcolor: 40-step RGB
|
||||
"0";"TILE_AIR" ; "1641"; "0"; "0"; "N/A"; "0"; "0"; "0"; "0"; "0";"16"
|
||||
"1";"TILE_STONE" ; "8205"; "25"; "0"; "N/A"; "1"; "1"; "0"; "1"; "0";"16"
|
||||
"2";"TILE_DIRT" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "2"; "0";"16"
|
||||
"3";"TILE_GRASS" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "2"; "0";"16"
|
||||
"4";"TILE_PLANK_NORMAL" ; "8205"; "12"; "0"; "N/A"; "1"; "1"; "0"; "4"; "0";"16"
|
||||
"5";"TILE_PLANK_EBONY" ; "8205"; "12"; "0"; "N/A"; "1"; "1"; "0"; "5"; "0";"16"
|
||||
"6";"TILE_PLANK_BIRCH" ; "8205"; "12"; "0"; "N/A"; "1"; "1"; "0"; "6"; "0";"16"
|
||||
"7";"TILE_PLANK_BLOODROSE" ; "8205"; "12"; "0"; "N/A"; "1"; "1"; "0"; "7"; "0";"16"
|
||||
"8";"TILE_TRUNK_NORMAL" ; "8205"; "12"; "0"; "N/A"; "1"; "0"; "0"; "8"; "0";"16"
|
||||
"9";"TILE_TRUNK_EBONY" ; "8205"; "12"; "0"; "N/A"; "1"; "0"; "0"; "9"; "0";"16"
|
||||
"10";"TILE_TRUNK_BIRCH" ; "8205"; "12"; "0"; "N/A"; "1"; "0"; "0"; "10"; "0";"16"
|
||||
"11";"TILE_TRUNK_BLOODROSE" ; "8205"; "12"; "0"; "N/A"; "1"; "0"; "0"; "11"; "0";"16"
|
||||
"12";"TILE_STONE_QUARRIED" ; "8205"; "25"; "0"; "N/A"; "1"; "1"; "0"; "12"; "0";"16"
|
||||
"13";"TILE_SAND" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "13"; "1";"16"
|
||||
"14";"TILE_GRAVEL" ; "8205"; "6"; "0"; "N/A"; "1"; "0"; "0"; "14"; "1";"16"
|
||||
"id";"name" ;"opacity";"strength";"fluid";"viscosity";"solid";"wall";"lumcolor";"opaque";"drop";"fall";"friction"
|
||||
"0";"TILE_AIR" ; "1641"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0";"16"
|
||||
"1";"TILE_STONE" ; "8205"; "25"; "0"; "0"; "1"; "1"; "0"; "1"; "1"; "0";"16"
|
||||
"2";"TILE_DIRT" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "2"; "0";"16"
|
||||
"3";"TILE_GRASS" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "2"; "0";"16"
|
||||
"4";"TILE_PLANK_NORMAL" ; "8205"; "12"; "0"; "0"; "1"; "1"; "0"; "1"; "4"; "0";"16"
|
||||
"5";"TILE_PLANK_EBONY" ; "8205"; "12"; "0"; "0"; "1"; "1"; "0"; "1"; "5"; "0";"16"
|
||||
"6";"TILE_PLANK_BIRCH" ; "8205"; "12"; "0"; "0"; "1"; "1"; "0"; "1"; "6"; "0";"16"
|
||||
"7";"TILE_PLANK_BLOODROSE" ; "8205"; "12"; "0"; "0"; "1"; "1"; "0"; "1"; "7"; "0";"16"
|
||||
"8";"TILE_TRUNK_NORMAL" ; "8205"; "12"; "0"; "0"; "1"; "0"; "0"; "1"; "8"; "0";"16"
|
||||
"9";"TILE_TRUNK_EBONY" ; "8205"; "12"; "0"; "0"; "1"; "0"; "0"; "1"; "9"; "0";"16"
|
||||
"10";"TILE_TRUNK_BIRCH" ; "8205"; "12"; "0"; "0"; "1"; "0"; "0"; "1"; "10"; "0";"16"
|
||||
"11";"TILE_TRUNK_BLOODROSE" ; "8205"; "12"; "0"; "0"; "1"; "0"; "0"; "1"; "11"; "0";"16"
|
||||
"12";"TILE_STONE_QUARRIED" ; "8205"; "25"; "0"; "0"; "1"; "1"; "0"; "1"; "12"; "0";"16"
|
||||
"13";"TILE_SAND" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "13"; "1";"16"
|
||||
"14";"TILE_GRAVEL" ; "8205"; "6"; "0"; "0"; "1"; "0"; "0"; "1"; "14"; "1";"16"
|
||||
|
||||
"15";"TILE_ORE_MALACHITE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "15"; "0";"16"
|
||||
"16";"TILE_ORE_HEMATITE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "16"; "0";"16"
|
||||
"17";"TILE_ORE_NATURAL_GOLD" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "17"; "0";"16"
|
||||
"18";"TILE_ORE_NATURAL_SILVER" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "18"; "0";"16"
|
||||
"19";"TILE_ORE_RUTILE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "19"; "0";"16"
|
||||
"20";"TILE_ORE_AURICHALCUMITE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "20"; "0";"16"
|
||||
"21";"TILE_GEM_RUBY" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "21"; "0";"16"
|
||||
"22";"TILE_GEM_EMERALD" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "22"; "0";"16"
|
||||
"23";"TILE_GEM_SAPPHIRE" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "23"; "0";"16"
|
||||
"24";"TILE_GEM_TOPAZ" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "24"; "0";"16"
|
||||
"25";"TILE_GEM_DIAMOND" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "25"; "0";"16"
|
||||
"26";"TILE_GEM_AMETHYST" ; "8205"; "25"; "0"; "N/A"; "1"; "0"; "0"; "26"; "0";"16"
|
||||
"15";"TILE_ORE_MALACHITE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "15"; "0";"16"
|
||||
"16";"TILE_ORE_HEMATITE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "16"; "0";"16"
|
||||
"17";"TILE_ORE_NATURAL_GOLD" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "17"; "0";"16"
|
||||
"18";"TILE_ORE_NATURAL_SILVER" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "18"; "0";"16"
|
||||
"19";"TILE_ORE_RUTILE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "19"; "0";"16"
|
||||
"20";"TILE_ORE_AURICHALCUMITE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "20"; "0";"16"
|
||||
"21";"TILE_GEM_RUBY" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "21"; "0";"16"
|
||||
"22";"TILE_GEM_EMERALD" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "22"; "0";"16"
|
||||
"23";"TILE_GEM_SAPPHIRE" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "23"; "0";"16"
|
||||
"24";"TILE_GEM_TOPAZ" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "24"; "0";"16"
|
||||
"25";"TILE_GEM_DIAMOND" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "25"; "0";"16"
|
||||
"26";"TILE_GEM_AMETHYST" ; "8205"; "25"; "0"; "0"; "1"; "0"; "0"; "1"; "26"; "0";"16"
|
||||
|
||||
"27";"TILE_SNOW" ; "8205"; "6"; "0"; "N/A"; "1"; "1"; "0"; "27"; "0";"16"
|
||||
"28";"TILE_ICE_FRAGILE" ; "3282"; "1"; "0"; "N/A"; "1"; "0"; "0"; "28"; "0";"16"
|
||||
"29";"TILE_ICE_NATURAL" ; "6564"; "25"; "0"; "N/A"; "1"; "1"; "0"; "29"; "0"; "8"
|
||||
"30";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25"; "0"; "N/A"; "1"; "1"; "5009"; "30"; "0"; "8"
|
||||
"27";"TILE_SNOW" ; "8205"; "6"; "0"; "0"; "1"; "1"; "0"; "1"; "27"; "0";"16"
|
||||
"28";"TILE_ICE_FRAGILE" ; "3282"; "1"; "0"; "0"; "1"; "0"; "0"; "0"; "28"; "0";"16"
|
||||
"29";"TILE_ICE_NATURAL" ; "6564"; "25"; "0"; "0"; "1"; "1"; "0"; "1"; "29"; "0"; "8"
|
||||
"30";"TILE_ICE_CLEAR_MAGICAL" ; "8205"; "25"; "0"; "0"; "1"; "1"; "5009"; "0"; "30"; "0"; "8"
|
||||
# see scandinavian name set female of this tile id!
|
||||
"31";"TILE_PLATFORM_STONE" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "31"; "0";"16"
|
||||
"32";"TILE_PLATFORM_WOODEN" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "32"; "0";"16"
|
||||
"33";"TILE_PLATFORM_EBONY" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "33"; "0";"16"
|
||||
"34";"TILE_PLATFORM_BIRCH" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "34"; "0";"16"
|
||||
"35";"TILE_PLATFORM_BLOODROSE" ; "0"; "0"; "0"; "N/A"; "0"; "0"; "0"; "35"; "0";"16"
|
||||
"31";"TILE_PLATFORM_STONE" ; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "31"; "0";"16"
|
||||
"32";"TILE_PLATFORM_WOODEN" ; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "32"; "0";"16"
|
||||
"33";"TILE_PLATFORM_EBONY" ; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "33"; "0";"16"
|
||||
"34";"TILE_PLATFORM_BIRCH" ; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "34"; "0";"16"
|
||||
"35";"TILE_PLATFORM_BLOODROSE" ; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "0"; "35"; "0";"16"
|
||||
|
||||
"36";"TILE_TORCH" ; "0"; "0"; "0"; "N/A"; "0"; "0";"63412"; "36"; "0";"16"
|
||||
"36";"TILE_TORCH" ; "0"; "0"; "0"; "0"; "0"; "0"; "63412"; "0"; "36"; "0";"16"
|
||||
# 63412 (ffa44e) : real candlelight colour taken from properly configured camera.
|
||||
"239";"TILE_WATER" ; "6522"; "100"; "1"; "2"; "0"; "0"; "0"; "239"; "0";"16"
|
||||
"255";"TILE_LAVA" ; "62358"; "100"; "1"; "2"; "0"; "0";"48320"; "239"; "0";"16"
|
||||
"239";"TILE_WATER" ; "6522"; "100"; "1"; "16"; "0"; "0"; "0"; "0"; "239"; "0";"16"
|
||||
"255";"TILE_LAVA" ; "62358"; "100"; "1"; "16"; "0"; "0"; "48320"; "0"; "239"; "0";"16"
|
||||
# Friction: 0: frictionless, <16: slippery, 16: regular, >16: sticky
|
||||
# Opacity/Lumcolor: 40-step RGB
|
||||
# Opaque: whether the tile completely hides wall behind
|
||||
# Viscosity: (walkspeedmax) * (1 + (n/16))
|
||||
|
Can't render this file because it contains an unexpected character in line 1 and column 12.
|
@@ -34,3 +34,4 @@ def colFromNum(raw):
|
||||
|
||||
print(colFromNum(9979))
|
||||
print(intFromRGB24(255, 164, 78))
|
||||
print(intFromCol(6, 10, 18))
|
||||
|
||||
Reference in New Issue
Block a user